Fix tab width and insertion defaults.
This commit is contained in:
parent
e7547cf9e7
commit
e15bb92e27
11 changed files with 320 additions and 316 deletions
|
|
@ -1,79 +1,79 @@
|
|||
require("which-key").add({
|
||||
{ "<leader>b", group = "buffer" },
|
||||
{ "<leader>bd", ":bd<CR>", name = "delete current" },
|
||||
{ "<leader>b", group = "buffer" },
|
||||
{ "<leader>bd", ":bd<CR>", name = "delete current" },
|
||||
|
||||
{ "<leader>c", group = "code" },
|
||||
{ "<leader>ca", vim.lsp.buf.code_action, name = "code action" },
|
||||
{ "<leader>cd", vim.diagnostic.open_float, name = "diagnostic" },
|
||||
{ "<leader>cr", vim.lsp.buf.rename, name = "rename" },
|
||||
{ "<leader>c", group = "code" },
|
||||
{ "<leader>ca", vim.lsp.buf.code_action, name = "code action" },
|
||||
{ "<leader>cd", vim.diagnostic.open_float, name = "diagnostic" },
|
||||
{ "<leader>cr", vim.lsp.buf.rename, name = "rename" },
|
||||
|
||||
{ "<leader>e", Snacks.explorer.open, name = "explorer" },
|
||||
{ "<leader>e", Snacks.explorer.open, name = "explorer" },
|
||||
|
||||
{ "<leader>f", group = "find" },
|
||||
{ "<leader>fb", Snacks.picker.buffers, name = "buffers" },
|
||||
{ "<leader>ff", Snacks.picker.files, name = "files" },
|
||||
{ "<leader>fg", Snacks.picker.grep, name = "grep" },
|
||||
{ "<leader>f", group = "find" },
|
||||
{ "<leader>fb", Snacks.picker.buffers, name = "buffers" },
|
||||
{ "<leader>ff", Snacks.picker.files, name = "files" },
|
||||
{ "<leader>fg", Snacks.picker.grep, name = "grep" },
|
||||
|
||||
{ "<leader>g", group = "git" },
|
||||
{ "<leader>gb", group = "blame" },
|
||||
{ "<leader>gbf", ":Gitsigns blame<CR>", name = "file" },
|
||||
{ "<leader>gbh", ":Gitsigns blame_line<CR>", name = "hover" },
|
||||
{ "<leader>gbl", ":Gitsigns toggle_current_line_blame<CR>", name = "virtual text" },
|
||||
{ "<leader>gh", group = "hunk" },
|
||||
{ "<leader>ghr", ":Gitsigns reset_hunk<CR>", name = "reset hunk" },
|
||||
{ "<leader>ghp", ":Gitsigns preview_hunk<CR>", name = "preview hunk" },
|
||||
{ "<leader>g", group = "git" },
|
||||
{ "<leader>gb", group = "blame" },
|
||||
{ "<leader>gbf", ":Gitsigns blame<CR>", name = "file" },
|
||||
{ "<leader>gbh", ":Gitsigns blame_line<CR>", name = "hover" },
|
||||
{ "<leader>gbl", ":Gitsigns toggle_current_line_blame<CR>", name = "virtual text" },
|
||||
{ "<leader>gh", group = "hunk" },
|
||||
{ "<leader>ghr", ":Gitsigns reset_hunk<CR>", name = "reset hunk" },
|
||||
{ "<leader>ghp", ":Gitsigns preview_hunk<CR>", name = "preview hunk" },
|
||||
|
||||
{ "<leader>s", group = "search" },
|
||||
{ "<leader>ss", Snacks.picker.lsp_workspace_symbols, name = "symbols" },
|
||||
{ "<leader>sg", Snacks.picker.grep, name = "grep" },
|
||||
{ "<leader>s", group = "search" },
|
||||
{ "<leader>ss", Snacks.picker.lsp_workspace_symbols, name = "symbols" },
|
||||
{ "<leader>sg", Snacks.picker.grep, name = "grep" },
|
||||
|
||||
{ "<leader>u", group = "ui" },
|
||||
{ "<leader>ut", Snacks.picker.colorschemes, name = "colorschemes" },
|
||||
{
|
||||
"<leader>ul",
|
||||
function()
|
||||
local ll = vim.diagnostic.config().virtual_lines
|
||||
if ll == false then
|
||||
ll = { current_line = true }
|
||||
else
|
||||
ll = false
|
||||
end
|
||||
vim.diagnostic.config({ virtual_lines = ll })
|
||||
end,
|
||||
name = "toggle lsp lines",
|
||||
},
|
||||
{ "<leader>u", group = "ui" },
|
||||
{ "<leader>ut", Snacks.picker.colorschemes, name = "colorschemes" },
|
||||
{
|
||||
"<leader>ul",
|
||||
function()
|
||||
local ll = vim.diagnostic.config().virtual_lines
|
||||
if ll == false then
|
||||
ll = { current_line = true }
|
||||
else
|
||||
ll = false
|
||||
end
|
||||
vim.diagnostic.config({ virtual_lines = ll })
|
||||
end,
|
||||
name = "toggle lsp lines",
|
||||
},
|
||||
|
||||
{ "<leader>w", group = "window" },
|
||||
{ "<leader>wh", "<C-w>h", name = "left" },
|
||||
{ "<leader>wj", "<C-w>j", name = "down" },
|
||||
{ "<leader>wk", "<C-w>k", name = "right" },
|
||||
{ "<leader>wl", "<C-w>l", name = "up" },
|
||||
{ "<leader>wq", ":q<CR>", name = "quit" },
|
||||
{ "<leader>w", group = "window" },
|
||||
{ "<leader>wh", "<C-w>h", name = "left" },
|
||||
{ "<leader>wj", "<C-w>j", name = "down" },
|
||||
{ "<leader>wk", "<C-w>k", name = "right" },
|
||||
{ "<leader>wl", "<C-w>l", name = "up" },
|
||||
{ "<leader>wq", ":q<CR>", name = "quit" },
|
||||
|
||||
{ "g", group = "goto" },
|
||||
{ "gd", vim.lsp.buf.definition, name = "definition" },
|
||||
{ "gr", Snacks.picker.lsp_references, nowait = true, name = "references" },
|
||||
{ "g", group = "goto" },
|
||||
{ "gd", vim.lsp.buf.definition, name = "definition" },
|
||||
{ "gr", Snacks.picker.lsp_references, nowait = true, name = "references" },
|
||||
|
||||
{ "H", ":bprev<CR>", name = "previous buffer" },
|
||||
{ "L", ":bnext<CR>", name = "next buffer" },
|
||||
{ "H", ":bprev<CR>", name = "previous buffer" },
|
||||
{ "L", ":bnext<CR>", name = "next buffer" },
|
||||
|
||||
{
|
||||
"[h",
|
||||
function()
|
||||
require("gitsigns").nav_hunk("prev")
|
||||
end,
|
||||
name = "Next Hunk",
|
||||
},
|
||||
{
|
||||
"]h",
|
||||
function()
|
||||
require("gitsigns").nav_hunk("next")
|
||||
end,
|
||||
name = "Next Hunk",
|
||||
},
|
||||
{
|
||||
"[h",
|
||||
function()
|
||||
require("gitsigns").nav_hunk("prev")
|
||||
end,
|
||||
name = "Next Hunk",
|
||||
},
|
||||
{
|
||||
"]h",
|
||||
function()
|
||||
require("gitsigns").nav_hunk("next")
|
||||
end,
|
||||
name = "Next Hunk",
|
||||
},
|
||||
|
||||
{ "[h", function() require("gitsigns").nav_hunk("prev") end, name = "previous hunk" },
|
||||
{ "]h", function() require("gitsigns").nav_hunk("next") end, name = "next hunk" },
|
||||
{ "[h", function() require("gitsigns").nav_hunk("prev") end, name = "previous hunk" },
|
||||
{ "]h", function() require("gitsigns").nav_hunk("next") end, name = "next hunk" },
|
||||
})
|
||||
|
||||
Snacks.toggle.diagnostics():map("<leader>ud")
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
|
|
@ -23,16 +23,16 @@ vim.g.maplocalleader = "\\"
|
|||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = {},
|
||||
-- automatically check for plugin updates
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = false,
|
||||
},
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = {},
|
||||
-- automatically check for plugin updates
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = false,
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,102 +6,102 @@ require("lspconfig").ruff.setup({ capabilities = capabilities })
|
|||
require("lspconfig").ccls.setup({ capabilities = capabilities })
|
||||
|
||||
require("lspconfig").lua_ls.setup({
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath("config")
|
||||
and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc"))
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath("config")
|
||||
and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc"))
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.g.rustaceanvim = {
|
||||
-- Plugin configuration
|
||||
-- tools = {
|
||||
-- },
|
||||
-- LSP configuration
|
||||
server = {
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- -- you can also put keymaps in here
|
||||
--end,
|
||||
default_settings = {
|
||||
-- rust-analyzer language server configuration
|
||||
["rust-analyzer"] = {
|
||||
cargoWatch = true,
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
allTargets = false,
|
||||
loadOutDirsFromCheck = true,
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
allTargets = false,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
["async-trait"] = { "async_trait" },
|
||||
["napi-derive"] = { "napi" },
|
||||
["async-recursion"] = { "async_recursion" },
|
||||
},
|
||||
},
|
||||
files = {
|
||||
excludeDirs = {
|
||||
".direnv",
|
||||
".git",
|
||||
".github",
|
||||
".gitlab",
|
||||
"bin",
|
||||
"node_modules",
|
||||
"target",
|
||||
"venv",
|
||||
".venv",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- DAP configuration
|
||||
dap = {},
|
||||
-- Plugin configuration
|
||||
-- tools = {
|
||||
-- },
|
||||
-- LSP configuration
|
||||
server = {
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- -- you can also put keymaps in here
|
||||
--end,
|
||||
default_settings = {
|
||||
-- rust-analyzer language server configuration
|
||||
["rust-analyzer"] = {
|
||||
cargoWatch = true,
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
allTargets = false,
|
||||
loadOutDirsFromCheck = true,
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
allTargets = false,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
["async-trait"] = { "async_trait" },
|
||||
["napi-derive"] = { "napi" },
|
||||
["async-recursion"] = { "async_recursion" },
|
||||
},
|
||||
},
|
||||
files = {
|
||||
excludeDirs = {
|
||||
".direnv",
|
||||
".git",
|
||||
".github",
|
||||
".gitlab",
|
||||
"bin",
|
||||
"node_modules",
|
||||
"target",
|
||||
"venv",
|
||||
".venv",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- DAP configuration
|
||||
dap = {},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
|
||||
callback = function(args)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false, id = args.data.client_id })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
|
||||
callback = function(args)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false, id = args.data.client_id })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,22 +1,25 @@
|
|||
vim.opt.termguicolors = true
|
||||
vim.cmd("colorscheme tokyonight")
|
||||
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.expandtab = true
|
||||
vim.o.smartindent = true
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
virtual_lines = {
|
||||
current_line = true,
|
||||
},
|
||||
update_in_insert = true,
|
||||
signs = true,
|
||||
virtual_text = true,
|
||||
virtual_lines = {
|
||||
current_line = true,
|
||||
},
|
||||
update_in_insert = true,
|
||||
signs = true,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
desc = "Highlight when yanking (copying) text",
|
||||
group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
desc = "Highlight when yanking (copying) text",
|
||||
group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue