2022-04-03 21:05:52 -05:00
|
|
|
local util = require('lspconfig').util
|
|
|
|
|
|
|
|
-- autocomplete config
|
|
|
|
local cmp = require 'cmp'
|
|
|
|
cmp.setup {
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
vim.fn["vsnip#anonymous"](args.body)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
mapping = {
|
|
|
|
['<Tab>'] = cmp.mapping.select_next_item(),
|
|
|
|
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
|
|
|
['<CR>'] = cmp.mapping.confirm({
|
|
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
select = false,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
preselect = cmp.PreselectMode.None,
|
|
|
|
confirmation = { get_commit_characters = function(_) return {} end },
|
|
|
|
sources = {
|
|
|
|
{ name = 'nvim_lsp', },
|
|
|
|
{ name = 'buffer' },
|
|
|
|
{ name = 'path' },
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
-- gitsigns
|
|
|
|
require('gitsigns').setup()
|
|
|
|
|
|
|
|
-- lsp configs
|
|
|
|
require'lspconfig'.openscad_ls.setup {
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
require'lspconfig'.omnisharp.setup {
|
|
|
|
root_dir = function(file, _)
|
|
|
|
if file:sub(-#".csx") == ".csx" then
|
|
|
|
return util.path.dirname(file)
|
|
|
|
end
|
|
|
|
return util.root_pattern("*.sln")(file) or util.root_pattern("*.csproj")(file)
|
|
|
|
end,
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
|
|
|
cmd = { "/home/rudism/.local/share/omnisharp/OmniSharp", "--languageserver" , "--hostPID", tostring(pid) },
|
|
|
|
}
|
|
|
|
require'lspconfig'.tsserver.setup {
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
2022-06-05 06:33:03 -05:00
|
|
|
--cmd = { 'npx', 'typescript-language-server', '--stdio' },
|
2022-04-03 21:05:52 -05:00
|
|
|
}
|
|
|
|
require'lspconfig'.yamlls.setup {
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
require'lspconfig'.ccls.setup {
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
local runtime_path = vim.split(package.path, ';')
|
|
|
|
table.insert(runtime_path, "lua/?.lua")
|
|
|
|
table.insert(runtime_path, "lua/?/init.lua")
|
|
|
|
require'lspconfig'.sumneko_lua.setup {
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
|
|
|
cmd = { "lua-language-server", "-E" },
|
|
|
|
settings = {
|
|
|
|
Lua = {
|
|
|
|
runtime = {
|
|
|
|
version = 'LuaJIT',
|
|
|
|
path = runtime_path,
|
|
|
|
},
|
|
|
|
diagnostics = {
|
|
|
|
globals = {'vim', 'use'},
|
|
|
|
},
|
|
|
|
workspace = {
|
|
|
|
library = vim.api.nvim_get_runtime_file("", true),
|
|
|
|
},
|
|
|
|
telemetry = {
|
|
|
|
enable = false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
require'lspconfig'.perlpls.setup {
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
|
|
|
settings = {
|
|
|
|
perl = {
|
|
|
|
perlcritic = {
|
|
|
|
enabled = false
|
|
|
|
},
|
|
|
|
syntax = {
|
|
|
|
enabled = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
require'lspconfig'.efm.setup {
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
|
|
|
filetypes = {"sh", "markdown"},
|
|
|
|
settings = {
|
|
|
|
languages = {
|
|
|
|
sh = {{
|
|
|
|
lintCommand = "shellcheck -f gcc -x",
|
|
|
|
lintSource = "shellcheck",
|
|
|
|
lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" },
|
|
|
|
lintIgnoreExitCode = true
|
|
|
|
}},
|
|
|
|
markdown = {{
|
|
|
|
lintCommand = "write-good --parse",
|
|
|
|
lintSource = "write-good",
|
|
|
|
lintFormats = { "%f:%l:%c:%m" },
|
|
|
|
}},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-23 08:29:32 -05:00
|
|
|
require'lspconfig'.pyright.setup {
|
|
|
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end,
|
|
|
|
}
|
2022-04-03 21:05:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
-- status line setup
|
|
|
|
require'lualine'.setup {
|
|
|
|
options = {
|
|
|
|
theme = 'wombat',
|
|
|
|
component_separators = { left = '', right = '' },
|
|
|
|
section_separators = { left = '', right = '' },
|
|
|
|
},
|
|
|
|
sections = {
|
|
|
|
lualine_a = {'mode'},
|
|
|
|
lualine_b = {'branch'},
|
|
|
|
lualine_c = {{
|
|
|
|
'filename',
|
|
|
|
symbols = {
|
|
|
|
modified = '✎ ',
|
|
|
|
readonly = '🔒 ',
|
|
|
|
unnamed = '[No Name]'
|
|
|
|
}
|
|
|
|
}},
|
|
|
|
lualine_x = {{
|
|
|
|
"diagnostics",
|
|
|
|
sources = {"nvim_lsp"},
|
|
|
|
icons_enabled = false
|
|
|
|
}},
|
|
|
|
lualine_y = {'progress'},
|
|
|
|
lualine_z = {'location'},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-- zen mode setup
|
|
|
|
local true_zen = require('true-zen')
|
|
|
|
true_zen.setup {
|
|
|
|
modes = {
|
|
|
|
ataraxis = {
|
2022-04-09 10:06:46 -05:00
|
|
|
custom_bg = { "solid", "#141414" },
|
2022-04-03 21:05:52 -05:00
|
|
|
ideal_writing_area_width = { 90, 150, "max" },
|
|
|
|
affected_higroups = {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
integrations = {
|
|
|
|
tmux = true,
|
|
|
|
gitsigns = true,
|
|
|
|
lualine = true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
true_zen.before_mode_ataraxis_on = function ()
|
|
|
|
vim.cmd("set nolist")
|
|
|
|
vim.cmd("set nocursorline")
|
|
|
|
vim.cmd("set spell")
|
|
|
|
vim.cmd("set lbr")
|
2022-04-09 10:06:46 -05:00
|
|
|
vim.cmd("hi Normal guibg=#141414")
|
|
|
|
vim.cmd("hi StatusLine guibg=#141414 guifg=#141414")
|
|
|
|
vim.cmd("hi StatusLineNC guibg=#141414 guifg=#141414")
|
2022-04-03 21:05:52 -05:00
|
|
|
local opts = { noremap = true, silent = true }
|
|
|
|
vim.api.nvim_set_keymap("", "k", "gk", opts)
|
|
|
|
vim.api.nvim_set_keymap("", "j", "gj", opts)
|
|
|
|
vim.api.nvim_set_keymap("", "<Up>", "gk", opts)
|
|
|
|
vim.api.nvim_set_keymap("", "<Down>", "gj", opts)
|
|
|
|
end
|
|
|
|
true_zen.after_mode_ataraxis_off = function ()
|
|
|
|
vim.cmd("set list")
|
|
|
|
vim.cmd("set cursorline")
|
|
|
|
vim.cmd("set nospell")
|
|
|
|
vim.cmd("set nolbr")
|
|
|
|
vim.cmd("hi Normal guibg=#242424")
|
|
|
|
vim.cmd("hi StatusLine guifg=NONE guibg=NONE")
|
|
|
|
vim.cmd("hi StatusLineNC guifg=NONE guibg=NONE")
|
|
|
|
vim.api.nvim_del_keymap("", "k")
|
|
|
|
vim.api.nvim_del_keymap("", "j")
|
|
|
|
vim.api.nvim_del_keymap("", "<Up>")
|
|
|
|
vim.api.nvim_del_keymap("", "<Down>")
|
|
|
|
end
|