Compare commits
No commits in common. "f2792252017b3362274aed489284cd092e8c9235" and "b6f292076898941bf385554feb08d1afca3f8de4" have entirely different histories.
f279225201
...
b6f2920768
26 changed files with 478 additions and 148 deletions
9
.gitmodules
vendored
9
.gitmodules
vendored
|
@ -4,6 +4,12 @@
|
||||||
[submodule "bundle/fzf-lua"]
|
[submodule "bundle/fzf-lua"]
|
||||||
path = bundle/fzf-lua
|
path = bundle/fzf-lua
|
||||||
url = https://github.com/ibhagwan/fzf-lua.git
|
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"]
|
[submodule "bundle/nvim-treesitter"]
|
||||||
path = bundle/nvim-treesitter
|
path = bundle/nvim-treesitter
|
||||||
url = https://github.com/nvim-treesitter/nvim-treesitter.git
|
url = https://github.com/nvim-treesitter/nvim-treesitter.git
|
||||||
|
@ -19,6 +25,3 @@
|
||||||
[submodule "bundle/nvim-format-buffer"]
|
[submodule "bundle/nvim-format-buffer"]
|
||||||
path = bundle/nvim-format-buffer
|
path = bundle/nvim-format-buffer
|
||||||
url = https://github.com/acro5piano/nvim-format-buffer.git
|
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
|
|
||||||
|
|
5
README.md
Normal file
5
README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# NVIM Configuration
|
||||||
|
|
||||||
|
## Lua
|
||||||
|
|
||||||
|
<https://github.com/LuaLS/lua-language-server/releases/>
|
1
after/syntax/c.vim
Normal file
1
after/syntax/c.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
syn keyword cOperator assert
|
15
build.sh
Executable file
15
build.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/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 34de8546d932497d90b24081045b8238b9818c76
|
Subproject commit 03eed634a3b1f4a4dc53f928868566b0b697dabe
|
1
bundle/haskell-vim
Submodule
1
bundle/haskell-vim
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit f35d02204b4813d1dbe8b0e98cc39701a4b8e15e
|
1
bundle/html5.vim
Submodule
1
bundle/html5.vim
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 485f2cd62162c81e56d8604b4c630f0b5ef69d1f
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 8b0f47d851ee5343d38fe194a06ad16b9b9bd086
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 684eeac91ed8e297685a97ef70031d19ac1de25a
|
Subproject commit 2586ea65faf45dcf1caf8d34510d50bb545c215a
|
|
@ -1 +1 @@
|
||||||
Subproject commit c90dee4e930ab9f49fa6d77f289bff335b49e972
|
Subproject commit d0cafff5c4347a604a07edf7bb9a91fda7eb577e
|
3
init.vim
3
init.vim
|
@ -19,10 +19,9 @@ set ts=2
|
||||||
set et
|
set et
|
||||||
|
|
||||||
set smartcase
|
set smartcase
|
||||||
|
"set smarttab
|
||||||
set nohlsearch
|
set nohlsearch
|
||||||
|
|
||||||
let g:c_syntax_for_h = 1
|
|
||||||
|
|
||||||
autocmd FileType c,cpp set cindent
|
autocmd FileType c,cpp set cindent
|
||||||
autocmd FileType c,cpp set cinoptions=:0,l0,t0,g0,(0
|
autocmd FileType c,cpp set cinoptions=:0,l0,t0,g0,(0
|
||||||
|
|
||||||
|
|
14
lua/config/format.lua
Normal file
14
lua/config/format.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
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 -" }
|
||||||
|
},
|
||||||
|
})
|
3
lua/config/init.lua
Normal file
3
lua/config/init.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
require("config.tab")
|
||||||
|
require("config.format")
|
||||||
|
require("config.lsp.init")
|
29
lua/config/lsp/clangd.lua
Normal file
29
lua/config/lsp/clangd.lua
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
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
|
159
lua/config/lsp/init.lua
Normal file
159
lua/config/lsp/init.lua
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
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,
|
||||||
|
})
|
43
lua/config/lsp/pylsp.lua
Normal file
43
lua/config/lsp/pylsp.lua
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
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,
|
||||||
|
})
|
28
lua/config/lsp/pyright.lua
Normal file
28
lua/config/lsp/pyright.lua
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
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,
|
||||||
|
})
|
28
lua/config/lsp/ruff.lua
Normal file
28
lua/config/lsp/ruff.lua
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
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,
|
||||||
|
})
|
44
lua/config/lsp/rust_analyzer.lua
Normal file
44
lua/config/lsp/rust_analyzer.lua
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
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
|
27
lua/config/lsp/typescript.lua
Normal file
27
lua/config/lsp/typescript.lua
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
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,
|
||||||
|
})
|
41
lua/config/lsp/vls.lua
Normal file
41
lua/config/lsp/vls.lua
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
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,
|
||||||
|
})
|
14
lua/config/tab.lua
Normal file
14
lua/config/tab.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
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,27 +1,10 @@
|
||||||
-- Work around https://github.com/neovim/neovim/issues/21856
|
-- Work around https://github.com/neovim/neovim/issues/21856
|
||||||
vim.api.nvim_create_autocmd({ "VimLeave" }, {
|
vim.api.nvim_create_autocmd({ "VimLeave" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.fn.jobstart("/bin/true", { detach = true })
|
vim.fn.jobstart('/bin/true', {detach=true})
|
||||||
end,
|
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("nvim-web-devicons").setup {}
|
||||||
|
|
||||||
require("fidget").setup {
|
require("fidget").setup {
|
||||||
|
@ -48,14 +31,13 @@ require("fzf-lua").setup {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-p>", "<cmd>lua require('fzf-lua').files()<CR>", { noremap = true, silent = true })
|
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>", { noremap = true, 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>", { noremap = true, 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>", { noremap = true, 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>", { noremap = true, silent = true })
|
vim.keymap.set('n', '<C-b>', '<cmd>lua require("fzf-lua").builtin()<CR>', { 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 = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
|
@ -66,105 +48,4 @@ require("nvim-treesitter.configs").setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require("nvim-format-buffer").setup({
|
require("config.init")
|
||||||
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,13 +1,6 @@
|
||||||
execute pathogen#infect()
|
execute pathogen#infect()
|
||||||
|
|
||||||
colorscheme wildcharm
|
colorscheme vim
|
||||||
highlight SignColumn guibg=#222222
|
|
||||||
|
|
||||||
set winblend=0
|
|
||||||
|
|
||||||
if has('nvim-0.11')
|
|
||||||
set winborder=solid
|
|
||||||
end
|
|
||||||
|
|
||||||
highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
|
highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
|
||||||
match ExtraWhitespace /\s\+$\| \+\ze\t/
|
match ExtraWhitespace /\s\+$\| \+\ze\t/
|
||||||
|
@ -27,10 +20,10 @@ autocmd BufNewFile *.adoc 0r ~/.vim/template/adoc
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead *.pio setfiletype pioasm
|
autocmd BufNewFile,BufRead *.pio setfiletype pioasm
|
||||||
|
|
||||||
"highlight Pmenu ctermbg=235 guibg=black
|
highlight Pmenu ctermbg=235 guibg=black
|
||||||
"highlight Pmenu ctermfg=white guifg=white
|
highlight Pmenu ctermfg=white guifg=white
|
||||||
"highlight PmenuSel ctermbg=235 guibg=black
|
highlight PmenuSel ctermbg=235 guibg=black
|
||||||
"highlight PmenuSel ctermfg=yellow guifg=yellow
|
highlight PmenuSel ctermfg=yellow guifg=yellow
|
||||||
|
|
||||||
" For Pandoc
|
" For Pandoc
|
||||||
let g:pandoc#spell#enabled=0
|
let g:pandoc#spell#enabled=0
|
||||||
|
|
1
opt/bin/lua-language-server
Symbolic link
1
opt/bin/lua-language-server
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../lua-language-server/bin/lua-language-server
|
1
opt/lua-language-server
Submodule
1
opt/lua-language-server
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 2dfb12ad3759acb7ff47b4c5c54ad0a62c598b22
|
Loading…
Reference in a new issue