[nvim] filetype-lua update and nvim.lua cleanup
This commit is contained in:
parent
2e87881195
commit
fc663940ff
2 changed files with 66 additions and 82 deletions
|
|
@ -124,6 +124,7 @@ autocmd FileType proto let b:auto_trim_whitespace=1
|
||||||
autocmd FileType hy let b:auto_trim_whitespace=1
|
autocmd FileType hy let b:auto_trim_whitespace=1
|
||||||
autocmd FileType idris let b:auto_trim_whitespace=1
|
autocmd FileType idris let b:auto_trim_whitespace=1
|
||||||
autocmd FileType java let b:auto_trim_whitespace=1
|
autocmd FileType java let b:auto_trim_whitespace=1
|
||||||
|
autocmd FileType lua let b:auto_trim_whitespace=1
|
||||||
|
|
||||||
augroup templates
|
augroup templates
|
||||||
autocmd BufNewFile *.vue 0r ~/.vim/skeletons/vue.skel
|
autocmd BufNewFile *.vue 0r ~/.vim/skeletons/vue.skel
|
||||||
|
|
|
||||||
147
.vim/nvim.lua
147
.vim/nvim.lua
|
|
@ -73,77 +73,77 @@ nvim_lsp.gopls.setup({
|
||||||
})
|
})
|
||||||
|
|
||||||
local function filter(arr, func)
|
local function filter(arr, func)
|
||||||
-- Filter in place
|
-- Filter in place
|
||||||
-- https://stackoverflow.com/questions/49709998/how-to-filter-a-lua-array-inplace
|
-- https://stackoverflow.com/questions/49709998/how-to-filter-a-lua-array-inplace
|
||||||
local new_index = 1
|
local new_index = 1
|
||||||
local size_orig = #arr
|
local size_orig = #arr
|
||||||
for old_index, v in ipairs(arr) do
|
for old_index, v in ipairs(arr) do
|
||||||
if func(v, old_index) then
|
if func(v, old_index) then
|
||||||
arr[new_index] = v
|
arr[new_index] = v
|
||||||
new_index = new_index + 1
|
new_index = new_index + 1
|
||||||
end
|
|
||||||
end
|
end
|
||||||
for i = new_index, size_orig do arr[i] = nil end
|
end
|
||||||
|
for i = new_index, size_orig do arr[i] = nil end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function pyright_accessed_filter(diagnostic)
|
local function pyright_accessed_filter(diagnostic)
|
||||||
-- Allow kwargs to be unused, sometimes you want many functions to take the
|
-- Allow kwargs to be unused, sometimes you want many functions to take the
|
||||||
-- same arguments but you don't use all the arguments in all the functions,
|
-- same arguments but you don't use all the arguments in all the functions,
|
||||||
-- so kwargs is used to suck up all the extras
|
-- so kwargs is used to suck up all the extras
|
||||||
if diagnostic.message == '"kwargs" is not accessed' then
|
if diagnostic.message == '"kwargs" is not accessed' then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
-- Allow variables starting with an underscore
|
-- Allow variables starting with an underscore
|
||||||
if string.match(diagnostic.message, '"_.+" is not accessed') then
|
if string.match(diagnostic.message, '"_.+" is not accessed') then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function pyright_custom_diagnostic(a, params, client_id, c, config)
|
local function pyright_custom_diagnostic(a, params, client_id, c, config)
|
||||||
filter(params.diagnostics, pyright_accessed_filter)
|
filter(params.diagnostics, pyright_accessed_filter)
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics(a, params, client_id, c, config)
|
vim.lsp.diagnostic.on_publish_diagnostics(a, params, client_id, c, config)
|
||||||
end
|
end
|
||||||
|
|
||||||
nvim_lsp.pyright.setup({ on_attach = function(client, bufnr)
|
nvim_lsp.pyright.setup({ on_attach = function(client, bufnr)
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(pyright_custom_diagnostic, diagnostic_options)
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(pyright_custom_diagnostic, diagnostic_options)
|
||||||
end})
|
end })
|
||||||
--nvim_lsp.pyright.setup({ on_attach = on_attach })
|
--nvim_lsp.pyright.setup({ on_attach = on_attach })
|
||||||
--nvim_lsp.pylsp.setup({
|
--nvim_lsp.pylsp.setup({
|
||||||
--on_attach = on_attach,
|
--on_attach = on_attach,
|
||||||
--settings = {
|
--settings = {
|
||||||
--pylsp = {
|
--pylsp = {
|
||||||
--plugins = {
|
--plugins = {
|
||||||
---- formatter options
|
---- formatter options
|
||||||
----black = { enabled = true },
|
----black = { enabled = true },
|
||||||
--autopep8 = { enabled = false },
|
--autopep8 = { enabled = false },
|
||||||
--yapf = { enabled = false },
|
--yapf = { enabled = false },
|
||||||
---- linter options
|
---- linter options
|
||||||
--pylint = { enabled = false, executable = "pylint" },
|
--pylint = { enabled = false, executable = "pylint" },
|
||||||
--pyflakes = { enabled = false },
|
--pyflakes = { enabled = false },
|
||||||
--pycodestyle = { enabled = false },
|
--pycodestyle = { enabled = false },
|
||||||
---- type checker
|
---- type checker
|
||||||
--pylsp_mypy = { enabled = true },
|
--pylsp_mypy = { enabled = true },
|
||||||
---- auto-completion options
|
---- auto-completion options
|
||||||
--jedi_completion = { enabled = false },
|
--jedi_completion = { enabled = false },
|
||||||
---- import sorting
|
---- import sorting
|
||||||
----pyls_isort = { enabled = true },
|
----pyls_isort = { enabled = true },
|
||||||
----flake8 = {
|
----flake8 = {
|
||||||
----maxLineLength = 100,
|
----maxLineLength = 100,
|
||||||
----},
|
----},
|
||||||
--pycodestyle = {
|
--pycodestyle = {
|
||||||
--maxLineLength = 100,
|
--maxLineLength = 100,
|
||||||
--},
|
--},
|
||||||
----rope_autoimport = {
|
----rope_autoimport = {
|
||||||
----enabled = true
|
----enabled = true
|
||||||
----},
|
----},
|
||||||
----rope_completion = {
|
----rope_completion = {
|
||||||
----enabled = true
|
----enabled = true
|
||||||
----},
|
----},
|
||||||
--}
|
--}
|
||||||
--}
|
--}
|
||||||
--}
|
--}
|
||||||
--})
|
--})
|
||||||
|
|
||||||
--nvim_lsp.clangd.setup({ on_attach = on_attach })
|
--nvim_lsp.clangd.setup({ on_attach = on_attach })
|
||||||
|
|
@ -249,8 +249,9 @@ require('lspconfig').efm.setup(vim.tbl_extend('force', efmls_config, {
|
||||||
|
|
||||||
-- Enable diagnostics
|
-- Enable diagnostics
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||||
diagnostic_options)
|
diagnostic_options
|
||||||
|
)
|
||||||
|
|
||||||
-- Compe setup
|
-- Compe setup
|
||||||
require 'compe'.setup {
|
require 'compe'.setup {
|
||||||
|
|
@ -283,7 +284,7 @@ require 'compe'.setup {
|
||||||
|
|
||||||
--require'lsp_signature'.on_attach(signature_cfg)
|
--require'lsp_signature'.on_attach(signature_cfg)
|
||||||
|
|
||||||
saga_cfg = {
|
local saga_cfg = {
|
||||||
code_action_prompt = {
|
code_action_prompt = {
|
||||||
enable = false,
|
enable = false,
|
||||||
sign = false,
|
sign = false,
|
||||||
|
|
@ -317,6 +318,7 @@ _G.tab_complete = function()
|
||||||
return vim.fn['compe#complete']()
|
return vim.fn['compe#complete']()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.s_tab_complete = function()
|
_G.s_tab_complete = function()
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 then
|
||||||
return t "<C-p>"
|
return t "<C-p>"
|
||||||
|
|
@ -482,25 +484,6 @@ require('telescope').setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local dropdown = require 'telescope.themes'.get_dropdown({
|
|
||||||
--previewer = false,
|
|
||||||
--prompt_title = "",
|
|
||||||
--results_height = 16,
|
|
||||||
--width = 0.6,
|
|
||||||
--borderchars = {
|
|
||||||
--{"─", "│", "─", "│", "╭", "╮", "╯", "╰"},
|
|
||||||
--prompt = {"─", "│", " ", "│", "╭", "╮", "│", "│"},
|
|
||||||
--results = {"─", "│", "─", "│", "├", "┤", "╯", "╰"},
|
|
||||||
--preview = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"}
|
|
||||||
--},
|
|
||||||
--winblend = 10
|
|
||||||
})
|
|
||||||
|
|
||||||
local telescope_ivy = require 'telescope.themes'.get_ivy({
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
--
|
--
|
||||||
|
|
@ -607,7 +590,7 @@ function string.insert(str1, str2, pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
function string.split(s, delimiter)
|
function string.split(s, delimiter)
|
||||||
result = {};
|
local result = {};
|
||||||
for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
|
for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
|
||||||
table.insert(result, match);
|
table.insert(result, match);
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue