many small fixes and improvements, i think
This commit is contained in:
parent
31a6fc294d
commit
468195ab00
7 changed files with 53 additions and 57 deletions
|
|
@ -32,7 +32,7 @@ vim.filetype.add({
|
||||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
group = group,
|
group = group,
|
||||||
callback = function()
|
callback = function()
|
||||||
if vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then
|
if vim.bo.buftype ~= "terminal" and vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then
|
||||||
vim.api.nvim_command("stopinsert")
|
vim.api.nvim_command("stopinsert")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ vim.opt.mouse = "a"
|
||||||
vim.opt.updatetime = 250
|
vim.opt.updatetime = 250
|
||||||
-- Decrease mapped sequence wait time
|
-- Decrease mapped sequence wait time
|
||||||
-- Displays which-key popup sooner
|
-- Displays which-key popup sooner
|
||||||
vim.opt.timeoutlen = 300
|
vim.opt.timeoutlen = 250
|
||||||
|
|
||||||
-- line numbering, relative
|
-- line numbering, relative
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
|
|
@ -54,7 +54,6 @@ vim.opt.list = true
|
||||||
vim.opt.listchars = { tab = "│ ", trail = "·", nbsp = "␣", eol = "↴" }
|
vim.opt.listchars = { tab = "│ ", trail = "·", nbsp = "␣", eol = "↴" }
|
||||||
|
|
||||||
-- Search settings
|
-- Search settings
|
||||||
vim.opt.hlsearch = true
|
|
||||||
vim.opt.incsearch = true
|
vim.opt.incsearch = true
|
||||||
|
|
||||||
-- Preview substitutions live, as you type
|
-- Preview substitutions live, as you type
|
||||||
|
|
@ -71,6 +70,7 @@ vim.opt.splitright = true
|
||||||
vim.opt.completeopt = "menu,menuone,noinsert"
|
vim.opt.completeopt = "menu,menuone,noinsert"
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
float = { border = "single" },
|
float = { border = "single" },
|
||||||
|
virtual_text = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Minimal number of screen lines to keep above and below the cursor.
|
-- Minimal number of screen lines to keep above and below the cursor.
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ return {
|
||||||
-- Scroll the documentation window [b]ack / [f]orward
|
-- Scroll the documentation window [b]ack / [f]orward
|
||||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
["<esc>"] = cmp.mapping(function(fallback)
|
["<esc>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.abort()
|
cmp.abort()
|
||||||
|
|
|
||||||
|
|
@ -159,9 +159,6 @@ return {
|
||||||
vim.keymap.set("n", "m", api.marks.toggle, opts("Toggle Bookmark"))
|
vim.keymap.set("n", "m", api.marks.toggle, opts("Toggle Bookmark"))
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>c", api.fs.copy.absolute_path, opts("Copy Path to Clipboard"))
|
vim.keymap.set("n", "<leader>c", api.fs.copy.absolute_path, opts("Copy Path to Clipboard"))
|
||||||
|
|
||||||
vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("Close Directory"))
|
|
||||||
|
|
||||||
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
|
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ return {
|
||||||
U.safeRequire("cmp_nvim_lsp", function(c)
|
U.safeRequire("cmp_nvim_lsp", function(c)
|
||||||
capabilities = vim.tbl_deep_extend("force", capabilities, c.default_capabilities())
|
capabilities = vim.tbl_deep_extend("force", capabilities, c.default_capabilities())
|
||||||
end)
|
end)
|
||||||
|
-- Export common capabilities to all servers via vim.lsp.config('*')
|
||||||
|
vim.lsp.config('*', { capabilities = capabilities })
|
||||||
local schemastore = require("schemastore")
|
local schemastore = require("schemastore")
|
||||||
|
|
||||||
-- TODO finish porting over lsp configs: https://github.com/RingOfStorms/nvim/blob/master/lua/plugins/lsp.lua
|
-- TODO finish porting over lsp configs: https://github.com/RingOfStorms/nvim/blob/master/lua/plugins/lsp.lua
|
||||||
|
|
@ -84,7 +86,6 @@ return {
|
||||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||||
-- Note that `rust-analyzer` is done via mrcjkb/rustaceanvim plugin above, do not register it here.
|
-- Note that `rust-analyzer` is done via mrcjkb/rustaceanvim plugin above, do not register it here.
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
|
|
@ -133,26 +134,21 @@ return {
|
||||||
-- },
|
-- },
|
||||||
-- },
|
-- },
|
||||||
gopls = {
|
gopls = {
|
||||||
capabilities = capabilities,
|
|
||||||
single_file_support = true,
|
single_file_support = true,
|
||||||
},
|
},
|
||||||
nil_ls = { -- nix
|
nil_ls = { -- nix
|
||||||
capabilities = capabilities,
|
|
||||||
},
|
},
|
||||||
ts_ls = {
|
ts_ls = {
|
||||||
-- typescript/javascript
|
-- typescript/javascript
|
||||||
capabilities = capabilities,
|
|
||||||
implicitProjectConfiguration = {
|
implicitProjectConfiguration = {
|
||||||
checkJs = true,
|
checkJs = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
svelte = {
|
svelte = {
|
||||||
-- svelte
|
-- svelte
|
||||||
capabilities = capabilities,
|
|
||||||
},
|
},
|
||||||
tailwindcss = {
|
tailwindcss = {
|
||||||
-- tailwind css
|
-- tailwind css
|
||||||
capabilities = capabilities,
|
|
||||||
-- https://www.tailwind-variants.org/docs/getting-started#intellisense-setup-optional
|
-- https://www.tailwind-variants.org/docs/getting-started#intellisense-setup-optional
|
||||||
tailwindCSS = {
|
tailwindCSS = {
|
||||||
experimental = {
|
experimental = {
|
||||||
|
|
@ -164,11 +160,9 @@ return {
|
||||||
},
|
},
|
||||||
cssls = {
|
cssls = {
|
||||||
-- css
|
-- css
|
||||||
capabilities = capabilities,
|
|
||||||
},
|
},
|
||||||
jsonls = {
|
jsonls = {
|
||||||
-- json
|
-- json
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
settings = {
|
||||||
json = {
|
json = {
|
||||||
schemas = schemastore.json.schemas(),
|
schemas = schemastore.json.schemas(),
|
||||||
|
|
@ -178,19 +172,15 @@ return {
|
||||||
},
|
},
|
||||||
-- python
|
-- python
|
||||||
pylsp = {
|
pylsp = {
|
||||||
capabilities = capabilities,
|
|
||||||
},
|
},
|
||||||
marksman = {
|
marksman = {
|
||||||
-- markdown
|
-- markdown
|
||||||
capabilities = capabilities,
|
|
||||||
},
|
},
|
||||||
taplo = {
|
taplo = {
|
||||||
-- toml
|
-- toml
|
||||||
capabilities = capabilities,
|
|
||||||
},
|
},
|
||||||
yamlls = {
|
yamlls = {
|
||||||
-- yaml
|
-- yaml
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
settings = {
|
||||||
yaml = {
|
yaml = {
|
||||||
schemas = schemastore.yaml.schemas(),
|
schemas = schemastore.yaml.schemas(),
|
||||||
|
|
@ -203,18 +193,32 @@ return {
|
||||||
},
|
},
|
||||||
lemminx = {
|
lemminx = {
|
||||||
-- xml
|
-- xml
|
||||||
capabilities = capabilities,
|
|
||||||
},
|
},
|
||||||
-- ocamllsp = {
|
-- ocamllsp = {
|
||||||
-- -- ocaml
|
-- -- ocaml
|
||||||
-- capabilities = capabilities,
|
-- capabilities = capabilities,
|
||||||
-- }
|
-- }
|
||||||
}
|
}
|
||||||
|
-- Remove new global default keymaps added by Nvim if you prefer your own bindings
|
||||||
|
local global_unmaps = {
|
||||||
|
{ mode = 'n', lhs = 'gra' },
|
||||||
|
{ mode = 'n', lhs = 'gri' },
|
||||||
|
{ mode = 'n', lhs = 'grn' },
|
||||||
|
{ mode = 'n', lhs = 'grr' },
|
||||||
|
{ mode = 'n', lhs = 'grt' },
|
||||||
|
{ mode = 'n', lhs = 'gO' },
|
||||||
|
{ mode = 'n', lhs = 'K' },
|
||||||
|
{ mode = 'i', lhs = '<C-S>' },
|
||||||
|
}
|
||||||
|
for _, m in ipairs(global_unmaps) do
|
||||||
|
pcall(vim.keymap.del, m.mode, m.lhs)
|
||||||
|
end
|
||||||
|
|
||||||
if NIX then
|
if NIX then
|
||||||
local lsp_servers = vim.tbl_keys(servers or {})
|
local lsp_servers = vim.tbl_keys(servers or {})
|
||||||
for _, server_name in ipairs(lsp_servers) do
|
for _, server_name in ipairs(lsp_servers) do
|
||||||
local server_opts = servers[server_name] or {}
|
local server_opts = servers[server_name] or {}
|
||||||
vim.lsp.config[server_name] = server_opts
|
vim.lsp.config(server_name, server_opts)
|
||||||
vim.lsp.enable(server_name)
|
vim.lsp.enable(server_name)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
@ -229,9 +233,8 @@ return {
|
||||||
handlers = {
|
handlers = {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
local server = servers[server_name] or {}
|
local server = servers[server_name] or {}
|
||||||
server.capabilities =
|
-- let vim.lsp.config('*') provide the base capabilities; do not reassign capabilities here
|
||||||
vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
vim.lsp.config(server_name, server)
|
||||||
vim.lsp.config[server_name] = server
|
|
||||||
vim.lsp.enable(server_name)
|
vim.lsp.enable(server_name)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,8 @@ return {
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
incremental_selection = { enable = true },
|
incremental_selection = { enable = true },
|
||||||
ident = { enable = true },
|
indent = { enable = true },
|
||||||
autotag = { enable = true },
|
autotag = { enable = true },
|
||||||
rainbow = {
|
|
||||||
enable = true,
|
|
||||||
extended_mode = true,
|
|
||||||
max_file_lines = nil,
|
|
||||||
},
|
|
||||||
}, nonNixOpts)
|
}, nonNixOpts)
|
||||||
end,
|
end,
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue