[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 idris 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
|
||||
autocmd BufNewFile *.vue 0r ~/.vim/skeletons/vue.skel
|
||||
|
|
|
|||
143
.vim/nvim.lua
143
.vim/nvim.lua
|
|
@ -73,77 +73,77 @@ nvim_lsp.gopls.setup({
|
|||
})
|
||||
|
||||
local function filter(arr, func)
|
||||
-- Filter in place
|
||||
-- https://stackoverflow.com/questions/49709998/how-to-filter-a-lua-array-inplace
|
||||
local new_index = 1
|
||||
local size_orig = #arr
|
||||
for old_index, v in ipairs(arr) do
|
||||
if func(v, old_index) then
|
||||
arr[new_index] = v
|
||||
new_index = new_index + 1
|
||||
end
|
||||
-- Filter in place
|
||||
-- https://stackoverflow.com/questions/49709998/how-to-filter-a-lua-array-inplace
|
||||
local new_index = 1
|
||||
local size_orig = #arr
|
||||
for old_index, v in ipairs(arr) do
|
||||
if func(v, old_index) then
|
||||
arr[new_index] = v
|
||||
new_index = new_index + 1
|
||||
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
|
||||
|
||||
local function pyright_accessed_filter(diagnostic)
|
||||
-- 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,
|
||||
-- so kwargs is used to suck up all the extras
|
||||
if diagnostic.message == '"kwargs" is not accessed' then
|
||||
return false
|
||||
end
|
||||
-- Allow variables starting with an underscore
|
||||
if string.match(diagnostic.message, '"_.+" is not accessed') then
|
||||
return false
|
||||
end
|
||||
-- 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,
|
||||
-- so kwargs is used to suck up all the extras
|
||||
if diagnostic.message == '"kwargs" is not accessed' then
|
||||
return false
|
||||
end
|
||||
-- Allow variables starting with an underscore
|
||||
if string.match(diagnostic.message, '"_.+" is not accessed') then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
return true
|
||||
end
|
||||
|
||||
local function pyright_custom_diagnostic(a, params, client_id, c, config)
|
||||
filter(params.diagnostics, pyright_accessed_filter)
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(a, params, client_id, c, config)
|
||||
filter(params.diagnostics, pyright_accessed_filter)
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(a, params, client_id, c, config)
|
||||
end
|
||||
|
||||
nvim_lsp.pyright.setup({ on_attach = function(client, bufnr)
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(pyright_custom_diagnostic, diagnostic_options)
|
||||
end})
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(pyright_custom_diagnostic, diagnostic_options)
|
||||
end })
|
||||
--nvim_lsp.pyright.setup({ on_attach = on_attach })
|
||||
--nvim_lsp.pylsp.setup({
|
||||
--on_attach = on_attach,
|
||||
--settings = {
|
||||
--pylsp = {
|
||||
--plugins = {
|
||||
---- formatter options
|
||||
----black = { enabled = true },
|
||||
--autopep8 = { enabled = false },
|
||||
--yapf = { enabled = false },
|
||||
---- linter options
|
||||
--pylint = { enabled = false, executable = "pylint" },
|
||||
--pyflakes = { enabled = false },
|
||||
--pycodestyle = { enabled = false },
|
||||
---- type checker
|
||||
--pylsp_mypy = { enabled = true },
|
||||
---- auto-completion options
|
||||
--jedi_completion = { enabled = false },
|
||||
---- import sorting
|
||||
----pyls_isort = { enabled = true },
|
||||
----flake8 = {
|
||||
----maxLineLength = 100,
|
||||
----},
|
||||
--pycodestyle = {
|
||||
--maxLineLength = 100,
|
||||
--},
|
||||
----rope_autoimport = {
|
||||
----enabled = true
|
||||
----},
|
||||
----rope_completion = {
|
||||
----enabled = true
|
||||
----},
|
||||
--}
|
||||
--}
|
||||
--}
|
||||
--on_attach = on_attach,
|
||||
--settings = {
|
||||
--pylsp = {
|
||||
--plugins = {
|
||||
---- formatter options
|
||||
----black = { enabled = true },
|
||||
--autopep8 = { enabled = false },
|
||||
--yapf = { enabled = false },
|
||||
---- linter options
|
||||
--pylint = { enabled = false, executable = "pylint" },
|
||||
--pyflakes = { enabled = false },
|
||||
--pycodestyle = { enabled = false },
|
||||
---- type checker
|
||||
--pylsp_mypy = { enabled = true },
|
||||
---- auto-completion options
|
||||
--jedi_completion = { enabled = false },
|
||||
---- import sorting
|
||||
----pyls_isort = { enabled = true },
|
||||
----flake8 = {
|
||||
----maxLineLength = 100,
|
||||
----},
|
||||
--pycodestyle = {
|
||||
--maxLineLength = 100,
|
||||
--},
|
||||
----rope_autoimport = {
|
||||
----enabled = true
|
||||
----},
|
||||
----rope_completion = {
|
||||
----enabled = true
|
||||
----},
|
||||
--}
|
||||
--}
|
||||
--}
|
||||
--})
|
||||
|
||||
--nvim_lsp.clangd.setup({ on_attach = on_attach })
|
||||
|
|
@ -250,7 +250,8 @@ require('lspconfig').efm.setup(vim.tbl_extend('force', efmls_config, {
|
|||
-- Enable diagnostics
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||
diagnostic_options)
|
||||
diagnostic_options
|
||||
)
|
||||
|
||||
-- Compe setup
|
||||
require 'compe'.setup {
|
||||
|
|
@ -283,7 +284,7 @@ require 'compe'.setup {
|
|||
|
||||
--require'lsp_signature'.on_attach(signature_cfg)
|
||||
|
||||
saga_cfg = {
|
||||
local saga_cfg = {
|
||||
code_action_prompt = {
|
||||
enable = false,
|
||||
sign = false,
|
||||
|
|
@ -317,6 +318,7 @@ _G.tab_complete = function()
|
|||
return vim.fn['compe#complete']()
|
||||
end
|
||||
end
|
||||
|
||||
_G.s_tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
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
|
||||
--
|
||||
|
|
@ -607,7 +590,7 @@ function string.insert(str1, str2, pos)
|
|||
end
|
||||
|
||||
function string.split(s, delimiter)
|
||||
result = {};
|
||||
local result = {};
|
||||
for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
|
||||
table.insert(result, match);
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue