Compare commits
3 commits
b6f2920768
...
f279225201
Author | SHA1 | Date | |
---|---|---|---|
f279225201 | |||
031b6403df | |||
46b767e26f |
26 changed files with 148 additions and 478 deletions
9
.gitmodules
vendored
9
.gitmodules
vendored
|
@ -4,12 +4,6 @@
|
|||
[submodule "bundle/fzf-lua"]
|
||||
path = bundle/fzf-lua
|
||||
url = https://github.com/ibhagwan/fzf-lua.git
|
||||
[submodule "bundle/haskell-vim"]
|
||||
path = bundle/haskell-vim
|
||||
url = https://github.com/neovimhaskell/haskell-vim.git
|
||||
[submodule "bundle/html5.vim"]
|
||||
path = bundle/html5.vim
|
||||
url = https://github.com/othree/html5.vim.git
|
||||
[submodule "bundle/nvim-treesitter"]
|
||||
path = bundle/nvim-treesitter
|
||||
url = https://github.com/nvim-treesitter/nvim-treesitter.git
|
||||
|
@ -25,3 +19,6 @@
|
|||
[submodule "bundle/nvim-format-buffer"]
|
||||
path = bundle/nvim-format-buffer
|
||||
url = https://github.com/acro5piano/nvim-format-buffer.git
|
||||
[submodule "bundle/nvim-lspconfig"]
|
||||
path = bundle/nvim-lspconfig
|
||||
url = https://github.com/neovim/nvim-lspconfig.git
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# NVIM Configuration
|
||||
|
||||
## Lua
|
||||
|
||||
<https://github.com/LuaLS/lua-language-server/releases/>
|
|
@ -1 +0,0 @@
|
|||
syn keyword cOperator assert
|
15
build.sh
15
build.sh
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
(
|
||||
cd opt/lua-language-server
|
||||
git submodule update --init --recursive
|
||||
|
||||
(
|
||||
cd 3rd/luamake
|
||||
./compile/build.sh
|
||||
)
|
||||
|
||||
3rd/luamake/luamake rebuild
|
||||
)
|
||||
|
||||
# EOF
|
|
@ -1 +1 @@
|
|||
Subproject commit 03eed634a3b1f4a4dc53f928868566b0b697dabe
|
||||
Subproject commit 34de8546d932497d90b24081045b8238b9818c76
|
|
@ -1 +0,0 @@
|
|||
Subproject commit f35d02204b4813d1dbe8b0e98cc39701a4b8e15e
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 485f2cd62162c81e56d8604b4c630f0b5ef69d1f
|
1
bundle/nvim-lspconfig
Submodule
1
bundle/nvim-lspconfig
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 8b0f47d851ee5343d38fe194a06ad16b9b9bd086
|
|
@ -1 +1 @@
|
|||
Subproject commit 2586ea65faf45dcf1caf8d34510d50bb545c215a
|
||||
Subproject commit 684eeac91ed8e297685a97ef70031d19ac1de25a
|
|
@ -1 +1 @@
|
|||
Subproject commit d0cafff5c4347a604a07edf7bb9a91fda7eb577e
|
||||
Subproject commit c90dee4e930ab9f49fa6d77f289bff335b49e972
|
3
init.vim
3
init.vim
|
@ -19,9 +19,10 @@ set ts=2
|
|||
set et
|
||||
|
||||
set smartcase
|
||||
"set smarttab
|
||||
set nohlsearch
|
||||
|
||||
let g:c_syntax_for_h = 1
|
||||
|
||||
autocmd FileType c,cpp set cindent
|
||||
autocmd FileType c,cpp set cinoptions=:0,l0,t0,g0,(0
|
||||
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
require('nvim-format-buffer').setup({
|
||||
verbose = false,
|
||||
format_rules = {
|
||||
{ pattern = { '*.c', '*.h' }, command = 'clang-format' },
|
||||
{
|
||||
pattern = { '*.js', '*.mjs', '*.ts', '*.mts', '*.cjs', '*.tsx', '*.vue', '*.css' },
|
||||
command = function()
|
||||
return 'prettier --stdin-filepath ' .. vim.api.nvim_buf_get_name(0)
|
||||
end,
|
||||
},
|
||||
{ pattern = { "*.sql" }, command = "pg_format --spaces=2 --wrap-limit=1000 --no-rcfile" },
|
||||
{ pattern = { "*.py", "*.pyi" }, command = "ruff check --select I --fix --silent - | ruff format -" }
|
||||
},
|
||||
})
|
|
@ -1,3 +0,0 @@
|
|||
require("config.tab")
|
||||
require("config.format")
|
||||
require("config.lsp.init")
|
|
@ -1,29 +0,0 @@
|
|||
local bin_name = "clangd"
|
||||
local cmd = {
|
||||
bin_name,
|
||||
"--background-index",
|
||||
"--suggest-missing-includes",
|
||||
"--enable-config",
|
||||
"--query-driver=/usr/lib64/ccache/*,/usr/bin/*",
|
||||
}
|
||||
|
||||
local config = vim.fs.find(".clangd", {
|
||||
upward = true,
|
||||
stop = vim.loop.os_homedir(),
|
||||
path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
|
||||
})
|
||||
|
||||
if next(config) then
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "c,cpp",
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "clangd",
|
||||
cmd = cmd,
|
||||
root_dir = config[1],
|
||||
settings = {
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
|
@ -1,159 +0,0 @@
|
|||
require('vim.lsp.log').set_format_func(vim.inspect)
|
||||
-- vim.lsp.set_log_level("debug")
|
||||
|
||||
require("config.lsp.pyright")
|
||||
require("config.lsp.ruff")
|
||||
-- require("config.lsp.pylsp")
|
||||
-- require("config.lsp.typescript")
|
||||
require("config.lsp.clangd")
|
||||
require("config.lsp.vls")
|
||||
require("config.lsp.rust_analyzer")
|
||||
|
||||
local api = vim.api
|
||||
local keymap = vim.keymap.set
|
||||
|
||||
local function keymappings(_, bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
keymap("n", "K", vim.lsp.buf.hover, { buffer = bufnr })
|
||||
keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
|
||||
keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
|
||||
keymap("n", "[e", "<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<CR>", opts)
|
||||
keymap("n", "]e", "<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<CR>", opts)
|
||||
|
||||
keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
keymap("n", "gh", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
keymap("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
keymap("n", "gb", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
|
||||
keymap("n", "ca", "<cmd>lua require('fzf-lua').lsp_code_actions()<CR>", opts)
|
||||
|
||||
keymap("n", "gl", "<cmd>lua vim.diagnostic.reset()<CR>", opts)
|
||||
|
||||
-- api.nvim_set_keymap("i", "<Tab>", [[pumvisible() ? "\<C-n>" : "\<Tab>"]], { noremap = true, expr = true })
|
||||
-- api.nvim_set_keymap("i", "<S-Tab>", [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]], { noremap = true, expr = true })
|
||||
end
|
||||
|
||||
local function highlighting(client, bufnr)
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
local lsp_highlight_grp = api.nvim_create_augroup("LspDocumentHighlight", { clear = true })
|
||||
api.nvim_create_autocmd("CursorHold", {
|
||||
callback = function()
|
||||
vim.schedule(vim.lsp.buf.document_highlight)
|
||||
end,
|
||||
group = lsp_highlight_grp,
|
||||
buffer = bufnr,
|
||||
})
|
||||
api.nvim_create_autocmd("CursorMoved", {
|
||||
callback = function()
|
||||
vim.schedule(vim.lsp.buf.clear_references)
|
||||
end,
|
||||
group = lsp_highlight_grp,
|
||||
buffer = bufnr,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local function lsp_handlers()
|
||||
local diagnostics = {
|
||||
Error = "E:",
|
||||
Warning = "W:",
|
||||
Hint = "",
|
||||
Information = "I:",
|
||||
Question = "Q:",
|
||||
}
|
||||
local signs = {
|
||||
{ name = "DiagnosticSignError", text = diagnostics.Error },
|
||||
{ name = "DiagnosticSignWarn", text = diagnostics.Warning },
|
||||
{ name = "DiagnosticSignHint", text = diagnostics.Hint },
|
||||
{ name = "DiagnosticSignInfo", text = diagnostics.Info },
|
||||
}
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
|
||||
end
|
||||
|
||||
-- LSP handlers configuration
|
||||
local config = {
|
||||
float = {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
},
|
||||
|
||||
diagnostic = {
|
||||
virtual_text = false,
|
||||
signs = {
|
||||
active = signs,
|
||||
},
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config(config.diagnostic)
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, config.float)
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, config.float)
|
||||
end
|
||||
|
||||
local function formatting(client, bufnr)
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
local function format()
|
||||
local view = vim.fn.winsaveview()
|
||||
vim.lsp.buf.format({
|
||||
async = true,
|
||||
filter = function(attached_client)
|
||||
return attached_client.name ~= ""
|
||||
end,
|
||||
})
|
||||
vim.fn.winrestview(view)
|
||||
end
|
||||
|
||||
local lsp_format_grp = api.nvim_create_augroup("LspFormat", { clear = true })
|
||||
api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function()
|
||||
vim.schedule(format)
|
||||
end,
|
||||
group = lsp_format_grp,
|
||||
buffer = bufnr,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local function on_attach(client, bufnr)
|
||||
if client.server_capabilities.completionProvider then
|
||||
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
vim.bo[bufnr].completefunc = "v:lua.vim.lsp.omnifunc"
|
||||
end
|
||||
|
||||
if client.server_capabilities.definitionProvider then
|
||||
vim.bo[bufnr].tagfunc = "v:lua.vim.lsp.tagfunc"
|
||||
end
|
||||
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.bo[bufnr].formatexpr = "v:lua.vim.lsp.formatexpr()"
|
||||
end
|
||||
|
||||
keymappings(client, bufnr)
|
||||
--highlighting(client, bufnr)
|
||||
--formatting(client, bufnr)
|
||||
end
|
||||
|
||||
lsp_handlers()
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
})
|
|
@ -1,43 +0,0 @@
|
|||
local root_files = {
|
||||
"pyproject.toml",
|
||||
"setup.py",
|
||||
"setup.cfg",
|
||||
"requirements.txt",
|
||||
"Pipfile",
|
||||
"pyrightconfig.json",
|
||||
".git",
|
||||
}
|
||||
|
||||
local root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1])
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "python",
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "pylsp",
|
||||
cmd = { "pylsp", "--log-config", "/tmp/logging.json", },
|
||||
root_dir = root_dir,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pyflakes = {
|
||||
enabled = false,
|
||||
},
|
||||
pycodestyle = {
|
||||
enabled = false,
|
||||
},
|
||||
mccabe = {
|
||||
enabled = false,
|
||||
},
|
||||
flake8 = {
|
||||
enabled = true,
|
||||
},
|
||||
pylsp_mypy = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
|
@ -1,28 +0,0 @@
|
|||
local bin_name = "pyright-langserver"
|
||||
local cmd = { bin_name, "--stdio", }
|
||||
|
||||
local root_files = {
|
||||
"pyproject.toml",
|
||||
"requirements.txt",
|
||||
".git",
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "python",
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "pyright",
|
||||
cmd = cmd,
|
||||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = "workspace",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
|
@ -1,28 +0,0 @@
|
|||
local bin_name = "ruff"
|
||||
local cmd = { bin_name, "server", }
|
||||
|
||||
local root_files = {
|
||||
"pyproject.toml",
|
||||
"requirements.txt",
|
||||
".git",
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "python",
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "ruff-server",
|
||||
cmd = cmd,
|
||||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
settings = {
|
||||
},
|
||||
})
|
||||
|
||||
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
-- pattern = { "*.py", "*.pyi" },
|
||||
-- callback = function()
|
||||
-- vim.lsp.buf.format { timeout_ms = 2000 }
|
||||
-- end,
|
||||
-- })
|
||||
end,
|
||||
})
|
|
@ -1,44 +0,0 @@
|
|||
local bin_name = "rust-analyzer"
|
||||
local cmd = { bin_name }
|
||||
|
||||
local config = vim.fs.find("Cargo.toml", {
|
||||
upward = true,
|
||||
stop = vim.loop.os_homedir(),
|
||||
path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
|
||||
})
|
||||
|
||||
if next(config) then
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "rust",
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "rust-analyzer",
|
||||
cmd = cmd,
|
||||
root_dir = config[1],
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
enable = true
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
},
|
||||
check = {
|
||||
command = "check",
|
||||
extraArgs = {"--all-features"}
|
||||
},
|
||||
},
|
||||
},
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities(),
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.rs",
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ timeout_ms = 2000 })
|
||||
end,
|
||||
})
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
local bin_name = "typescript-language-server"
|
||||
local cmd = { bin_name, "--stdio" }
|
||||
|
||||
local root_files = {
|
||||
"package.json",
|
||||
".git",
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "typescript,javascript,javascriptreact,typescriptreact",
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
name = "typescript-language-server",
|
||||
cmd = cmd,
|
||||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
settings = {
|
||||
init_options = {
|
||||
completionDisableFilterText = true,
|
||||
hostInfo = 'neovim',
|
||||
preferences = {
|
||||
includeCompletionsForModuleExports = false
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
|
@ -1,41 +0,0 @@
|
|||
local root_files = {
|
||||
"package.json",
|
||||
".git",
|
||||
}
|
||||
|
||||
local root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1])
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "typescript,javascript,javascriptreact,typescriptreact,vue",
|
||||
callback = function()
|
||||
-- vim.lsp.start({
|
||||
-- name = "typescript-language-server",
|
||||
-- cmd = { "typescript-language-server", "--stdio" },
|
||||
-- root_dir = root_dir,
|
||||
-- settings = {
|
||||
-- init_options = {
|
||||
-- completionDisableFilterText = true,
|
||||
-- plugins = {
|
||||
-- name = "@vue/typescript-plugin",
|
||||
-- location = "/home/mordae/.config/yarn/global/node_modules/@vue/language-server",
|
||||
-- languages = { "vue" }
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
|
||||
vim.lsp.start({
|
||||
name = "volar",
|
||||
cmd = { "vue-language-server", "--stdio" },
|
||||
root_dir = root_dir,
|
||||
init_options = {
|
||||
typescript = {
|
||||
tsdk = "/home/mordae/.config/yarn/global/node_modules/typescript/lib",
|
||||
},
|
||||
vue = {
|
||||
hybridMode = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
|
@ -1,14 +0,0 @@
|
|||
local function check_back_space()
|
||||
local col = vim.fn.col('.') - 1
|
||||
return col <= 0 or vim.fn.getline('.'):sub(col, col):match('%s')
|
||||
end
|
||||
|
||||
function tab_complete()
|
||||
if check_back_space() then
|
||||
return vim.api.nvim_replace_termcodes('<Tab>', true, false, true)
|
||||
end
|
||||
return vim.api.nvim_replace_termcodes('<C-p>', true, false, true)
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('i', '<Tab>', 'v:lua.tab_complete()', { expr = true, noremap = true })
|
||||
vim.api.nvim_set_keymap('i', '<S-Tab>', '<C-n>', { noremap = true })
|
135
lua/init.lua
135
lua/init.lua
|
@ -1,10 +1,27 @@
|
|||
-- Work around https://github.com/neovim/neovim/issues/21856
|
||||
vim.api.nvim_create_autocmd({ "VimLeave" }, {
|
||||
callback = function()
|
||||
vim.fn.jobstart('/bin/true', {detach=true})
|
||||
vim.fn.jobstart("/bin/true", { detach = true })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
-- Use the default configuration
|
||||
-- virtual_lines = true,
|
||||
|
||||
-- Alternatively, customize specific options
|
||||
-- virtual_lines = {
|
||||
-- -- Only show virtual line diagnostics for the current cursor line
|
||||
-- current_line = true,
|
||||
-- },
|
||||
|
||||
-- Open in floating window
|
||||
float = {
|
||||
source = "always",
|
||||
border = "shadow",
|
||||
},
|
||||
})
|
||||
|
||||
require("nvim-web-devicons").setup {}
|
||||
|
||||
require("fidget").setup {
|
||||
|
@ -31,13 +48,14 @@ require("fzf-lua").setup {
|
|||
},
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<C-p>', '<cmd>lua require("fzf-lua").files()<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<C-g>', '<cmd>lua require("fzf-lua").git_status()<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<C-/>', '<cmd>lua require("fzf-lua").live_grep()<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<C-\\>', '<cmd>lua require("fzf-lua").buffers()<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<C-b>', '<cmd>lua require("fzf-lua").builtin()<CR>', { silent = true })
|
||||
vim.keymap.set("n", "<C-p>", "<cmd>lua require('fzf-lua').files()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-g>", "<cmd>lua require('fzf-lua').git_status()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-/>", "<cmd>lua require('fzf-lua').live_grep()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-\\>", "<cmd>lua require('fzf-lua').buffers()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-b>", "<cmd>lua require('fzf-lua').builtin()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "ca", "<cmd>lua require('fzf-lua').lsp_code_actions()<CR>", { noremap = true, silent = true })
|
||||
|
||||
require('nvim-treesitter.configs').setup {
|
||||
require("nvim-treesitter.configs").setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
|
@ -48,4 +66,105 @@ require('nvim-treesitter.configs').setup {
|
|||
}
|
||||
}
|
||||
|
||||
require("config.init")
|
||||
require("nvim-format-buffer").setup({
|
||||
verbose = false,
|
||||
format_rules = {
|
||||
{ pattern = { "*.c", "*.h" }, command = "clang-format" },
|
||||
{
|
||||
pattern = { "*.js", "*.mjs", "*.ts", "*.mts", "*.cjs", "*.tsx", "*.vue", "*.css" },
|
||||
command = function()
|
||||
return "prettier --stdin-filepath " .. vim.api.nvim_buf_get_name(0)
|
||||
end,
|
||||
},
|
||||
{ pattern = { "*.sql" }, command = "pg_format --spaces=2 --wrap-limit=1000 --no-rcfile" },
|
||||
{ pattern = { "*.py", "*.pyi" }, command = "ruff check --select I --fix --silent - | ruff format -" }
|
||||
},
|
||||
})
|
||||
|
||||
require("vim.lsp.log").set_format_func(vim.inspect)
|
||||
-- vim.lsp.set_log_level("debug")
|
||||
|
||||
vim.keymap.set("n", "[d", "<cmd>lua vim.diagnostic.jump({count = -1, float = true})<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "]d", "<cmd>lua vim.diagnostic.jump({count = 1, float = true})<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "[e", "<cmd>lua vim.diagnostic.jump({count = -1, severity = vim.diagnostic.severity.ERROR, float = true})<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "]e", "<cmd>lua vim.diagnostic.jump({count = -1, severity = vim.diagnostic.severity.ERROR, float = true})<CR>", { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "gh", "<cmd>lua vim.lsp.buf.signature_help()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "gl", "<cmd>lua vim.diagnostic.reset()<CR>", { noremap = true, silent = true })
|
||||
|
||||
vim.lsp.enable("pyright")
|
||||
vim.lsp.config("pyright", {})
|
||||
|
||||
vim.lsp.enable("ts_ls")
|
||||
vim.lsp.config("ts_ls", {
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
location = "/home/mordae/.config/yarn/global/node_modules/@vue/typescript-plugin",
|
||||
languages = { "javascript", "typescript", "vue" },
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.enable("volar")
|
||||
vim.lsp.config("volar", {
|
||||
init_options = {
|
||||
typescript = {
|
||||
tsdk = "/home/mordae/.config/yarn/global/node_modules/typescript/lib",
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
vim.lsp.enable("clangd")
|
||||
vim.lsp.config("clangd", {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--suggest-missing-includes",
|
||||
"--enable-config",
|
||||
"--query-driver=/usr/lib64/ccache/*,/usr/bin/*",
|
||||
}
|
||||
})
|
||||
|
||||
vim.lsp.enable("ruff")
|
||||
vim.lsp.config("ruff", {})
|
||||
|
||||
vim.lsp.enable("rust_analyzer")
|
||||
vim.lsp.config("rust_analyzer", {})
|
||||
|
||||
-- Automatic completion triggering
|
||||
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||
-- callback = function(ev)
|
||||
-- local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
-- if client:supports_method("textDocument/completion") then
|
||||
-- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
local function check_back_space()
|
||||
local col = vim.fn.col('.') - 1
|
||||
return col <= 0 or vim.fn.getline('.'):sub(col, col):match('%s')
|
||||
end
|
||||
|
||||
function tab_complete()
|
||||
if check_back_space() then
|
||||
return vim.api.nvim_replace_termcodes('<Tab>', true, false, true)
|
||||
end
|
||||
return vim.api.nvim_replace_termcodes('<C-p>', true, false, true)
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('i', '<Tab>', 'v:lua.tab_complete()', { expr = true, noremap = true })
|
||||
vim.api.nvim_set_keymap('i', '<S-Tab>', '<C-n>', { noremap = true })
|
||||
|
|
17
nvim.vim
17
nvim.vim
|
@ -1,6 +1,13 @@
|
|||
execute pathogen#infect()
|
||||
|
||||
colorscheme vim
|
||||
colorscheme wildcharm
|
||||
highlight SignColumn guibg=#222222
|
||||
|
||||
set winblend=0
|
||||
|
||||
if has('nvim-0.11')
|
||||
set winborder=solid
|
||||
end
|
||||
|
||||
highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
|
||||
match ExtraWhitespace /\s\+$\| \+\ze\t/
|
||||
|
@ -20,10 +27,10 @@ autocmd BufNewFile *.adoc 0r ~/.vim/template/adoc
|
|||
|
||||
autocmd BufNewFile,BufRead *.pio setfiletype pioasm
|
||||
|
||||
highlight Pmenu ctermbg=235 guibg=black
|
||||
highlight Pmenu ctermfg=white guifg=white
|
||||
highlight PmenuSel ctermbg=235 guibg=black
|
||||
highlight PmenuSel ctermfg=yellow guifg=yellow
|
||||
"highlight Pmenu ctermbg=235 guibg=black
|
||||
"highlight Pmenu ctermfg=white guifg=white
|
||||
"highlight PmenuSel ctermbg=235 guibg=black
|
||||
"highlight PmenuSel ctermfg=yellow guifg=yellow
|
||||
|
||||
" For Pandoc
|
||||
let g:pandoc#spell#enabled=0
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../lua-language-server/bin/lua-language-server
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 2dfb12ad3759acb7ff47b4c5c54ad0a62c598b22
|
Loading…
Reference in a new issue