Set options per OS

This commit is contained in:
Eduardo Cueto-Mendoza 2024-05-07 11:59:07 +01:00
parent 5744a63865
commit 33e13ebba6
2 changed files with 225 additions and 61 deletions

View File

@ -7,10 +7,9 @@ if (f ~= nil) then
f:close()
end
print(_G.MY_OS)
lsp.preset("recommended")
if (_G.MY_OS == 'Linux')
if (MY_OS == 'Linux')
then
lsp.ensure_installed({
-- Replace these with whatever servers you want to install
@ -24,7 +23,7 @@ then
'rust_analyzer',
'zls'
})
elseif (_G.MY_OS == 'FreeBSD') or (MY_OS == 'OpenBSD')
elseif (MY_OS == 'FreeBSD') or (MY_OS == 'OpenBSD')
then
lsp.ensure_installed({
-- Replace these with whatever servers you want to install
@ -32,7 +31,7 @@ then
'ocamllsp',
'pylsp'
})
elseif (_G.MY_OS == 'Darwin')
elseif (MY_OS == 'Darwin')
then
lsp.ensure_installed({
-- Replace these with whatever servers you want to install
@ -81,7 +80,7 @@ lsp.on_attach(function(client, bufnr)
end)
if (_G.MY_OS == 'Linux')
if (MY_OS == 'Linux')
then
-- Installed for Linux
require('lspconfig').bashls.setup({})
@ -162,7 +161,7 @@ then
require('lspconfig').zls.setup({})
elseif (_G.MY_OS == 'FreeBSD') or (_G.MY_OS == 'OpenBSD')
elseif (MY_OS == 'FreeBSD') or (MY_OS == 'OpenBSD')
then
-- Installed for BSD
require('lspconfig').bashls.setup({})
@ -185,7 +184,7 @@ then
require('lspconfig').zls.setup({})
elseif (_G.MY_OS == 'Darwin')
elseif (MY_OS == 'Darwin')
then
-- Installed for Linux
require('lspconfig').clangd.setup({})

View File

@ -1,73 +1,238 @@
vim.opt.guicursor = ""
local f = io.popen("uname -s")
if (f ~= nil) then
MY_OS = f:read("*a")
MY_OS = string.gsub(MY_OS, "%s+", "")
f:close()
end
vim.opt.spelllang = 'en_gb'
vim.opt.spell = true
if (MY_OS == 'Linux')
then
-- on Linux
vim.opt.guicursor = ""
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.spelllang = 'en_gb'
vim.opt.spell = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.smartindent = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.wrap = true
-- Fonts
vim.opt.encoding = "utf-8"
vim.opt.guifont = "FiraCodeNerdFont-Regular:h10"
vim.opt.smartindent = true
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.wrap = true
-- Fonts
vim.opt.encoding = "utf-8"
vim.opt.guifont = "FiraCodeNerdFont-Regular:h10"
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.termguicolors = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.termguicolors = true
vim.opt.updatetime = 50
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.colorcolumn = "80"
vim.opt.updatetime = 50
-- LSP options
vim.diagnostic.config({
virtual_text = false
})
vim.opt.colorcolumn = "80"
-- Show line diagnostics automatically in hover window
vim.o.updatetime = 250
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
-- LSP options
vim.diagnostic.config({
virtual_text = false
})
-- Vimtex options:
--vim.g.vimtex_view_method = "zathura"
--vim.g.vimtex_general_viewer = "zathura"
vim.g.vimtex_view_method = "skim"
vim.g.vimtex_general_viewer = "skim"
vim.g.vimtex_quickfix_mode = 0
-- Show line diagnostics automatically in hover window
vim.o.updatetime = 250
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
-- OBSD options
--vim.g.vimtex_compiler_latexmk={ 'cmd': '' }
-- Vimtex options:
vim.g.vimtex_view_method = "zathura"
vim.g.vimtex_general_viewer = "zathura"
vim.g.vimtex_quickfix_mode = 0
-- Ignore mappings
vim.g.vimtex_mappings_enabled = 1
-- Ignore mappings
vim.g.vimtex_mappings_enabled = 1
---- Auto Indent
--vim.g["vimtex_indent_enabled"] = 1
---- Auto Indent
vim.g["vimtex_indent_enabled"] = 1
---- Syntax highlighting
vim.g.vimtex_syntax_enabled = 0
---- Syntax highlighting
vim.g.vimtex_syntax_enabled = 0
-- Error suppression:
vim.g.vimtex_log_ignore = ({
"Underfull",
"Overfull",
"specifier changed to",
"Token not allowed in a PDF string",
})
-- Python provider
vim.g.python3_host_prog = "/usr/share/pyenv/shims/python"
elseif (MY_OS == 'FreeBSD') or (MY_OS == 'OpenBSD')
then
-- on BSD
vim.opt.guicursor = ""
vim.opt.spelllang = 'en_gb'
vim.opt.spell = true
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = true
-- Fonts
vim.opt.encoding = "utf-8"
vim.opt.guifont = "FiraCodeNerdFont-Regular:h10"
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "80"
-- LSP options
vim.diagnostic.config({
virtual_text = false
})
-- Show line diagnostics automatically in hover window
vim.o.updatetime = 250
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
-- Vimtex options:
vim.g.vimtex_view_method = "zathura"
vim.g.vimtex_general_viewer = "zathura"
vim.g.vimtex_quickfix_mode = 0
-- OBSD options
--vim.g.vimtex_compiler_latexmk={ 'cmd': '' }
-- Ignore mappings
vim.g.vimtex_mappings_enabled = 1
---- Auto Indent
vim.g["vimtex_indent_enabled"] = 1
---- Syntax highlighting
vim.g.vimtex_syntax_enabled = 0
-- Error suppression:
vim.g.vimtex_log_ignore = ({
"Underfull",
"Overfull",
"specifier changed to",
"Token not allowed in a PDF string",
})
-- Python provider
vim.g.python3_host_prog = "/usr/local/share/pyenv/shims/python"
elseif (MY_OS == 'Darwin')
then
-- on MacOS
vim.opt.guicursor = ""
vim.opt.spelllang = 'en_gb'
vim.opt.spell = true
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = true
-- Fonts
vim.opt.encoding = "utf-8"
vim.opt.guifont = "FiraCodeNerdFont-Regular:h10"
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "80"
-- LSP options
vim.diagnostic.config({
virtual_text = false
})
-- Show line diagnostics automatically in hover window
vim.o.updatetime = 250
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
-- Vimtex options:
vim.g.vimtex_view_method = "skim"
vim.g.vimtex_general_viewer = "skim"
vim.g.vimtex_quickfix_mode = 0
-- Ignore mappings
vim.g.vimtex_mappings_enabled = 1
---- Auto Indent
vim.g["vimtex_indent_enabled"] = 1
---- Syntax highlighting
vim.g.vimtex_syntax_enabled = 0
-- Error suppression:
vim.g.vimtex_log_ignore = ({
"Underfull",
"Overfull",
"specifier changed to",
"Token not allowed in a PDF string",
})
-- Python provider
vim.g.python3_host_prog = "/usr/local/share/pyenv/shims/python"
else
print('Should never be here LSP')
end
-- Error suppression:
vim.g.vimtex_log_ignore = ({
"Underfull",
"Overfull",
"specifier changed to",
"Token not allowed in a PDF string",
})