Skip to content

Commit 0630be8

Browse files
authored
Merge branch 'main' into fix-typo-in-configuration-general
2 parents 78bbe66 + 9cbbe60 commit 0630be8

78 files changed

Lines changed: 4472 additions & 1730 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/configuration/general.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ local opt = vim.opt
106106
opt.autowrite = true -- Enable auto write
107107
-- only set clipboard if not in ssh, to make sure the OSC 52
108108
-- integration works automatically.
109-
opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus" -- Sync with system clipboard
109+
opt.clipboard = vim.env.SSH_CONNECTION and "" or "unnamedplus" -- Sync with system clipboard
110110
opt.completeopt = "menu,menuone,noselect"
111111
opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions
112112
opt.confirm = true -- Confirm to save changes before exiting modified buffer
@@ -120,17 +120,15 @@ opt.fillchars = {
120120
diff = "",
121121
eob = " ",
122122
}
123-
opt.foldexpr = "v:lua.LazyVim.ui.foldexpr()" -- treesitter folds
124123
opt.foldlevel = 99
125-
opt.foldmethod = "expr"
124+
opt.foldmethod = "indent"
126125
opt.foldtext = ""
127-
opt.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()"
126+
opt.formatexpr = "v:lua.LazyVim.format.formatexpr()"
128127
opt.formatoptions = "jcroqlnt" -- tcqj
129128
opt.grepformat = "%f:%l:%c:%m"
130129
opt.grepprg = "rg --vimgrep"
131130
opt.ignorecase = true -- Ignore case
132131
opt.inccommand = "nosplit" -- preview incremental substitute
133-
opt.indentexpr = "v:lua.LazyVim.ui.indentexpr()" -- treesitter indents
134132
opt.jumpoptions = "view"
135133
opt.laststatus = 3 -- global statusline
136134
opt.linebreak = true -- Wrap lines at convenient points
@@ -156,7 +154,7 @@ opt.spelllang = { "en" }
156154
opt.splitbelow = true -- Put new windows below current
157155
opt.splitkeep = "screen"
158156
opt.splitright = true -- Put new windows right of current
159-
opt.statuscolumn = [[%!v:lua.require'snacks.statuscolumn'.get()]]
157+
opt.statuscolumn = [[%!v:lua.LazyVim.statuscolumn()]]
160158
opt.tabstop = 2 -- Number of spaces tabs count for
161159
opt.termguicolors = true -- True color support
162160
opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key
@@ -275,8 +273,8 @@ map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save File" })
275273
map("n", "<leader>K", "<cmd>norm! K<cr>", { desc = "Keywordprg" })
276274

277275
-- better indenting
278-
map("v", "<", "<gv")
279-
map("v", ">", ">gv")
276+
map("x", "<", "<gv")
277+
map("x", ">", ">gv")
280278

281279
-- commenting
282280
map("n", "gco", "o<esc>Vcx<esc><cmd>normal gcc<cr>fxa<bs>", { desc = "Add Comment Below" })
@@ -308,16 +306,18 @@ map("n", "[q", vim.cmd.cprev, { desc = "Previous Quickfix" })
308306
map("n", "]q", vim.cmd.cnext, { desc = "Next Quickfix" })
309307

310308
-- formatting
311-
map({ "n", "v" }, "<leader>cf", function()
309+
map({ "n", "x" }, "<leader>cf", function()
312310
LazyVim.format({ force = true })
313311
end, { desc = "Format" })
314312

315313
-- diagnostic
316314
local diagnostic_goto = function(next, severity)
317-
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
318-
severity = severity and vim.diagnostic.severity[severity] or nil
319315
return function()
320-
go({ severity = severity })
316+
vim.diagnostic.jump({
317+
count = (next and 1 or -1) * vim.v.count1,
318+
severity = severity and vim.diagnostic.severity[severity] or nil,
319+
float = true,
320+
})
321321
end
322322
end
323323
map("n", "<leader>cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" })
@@ -357,12 +357,12 @@ end
357357
if vim.fn.executable("lazygit") == 1 then
358358
map("n", "<leader>gg", function() Snacks.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" })
359359
map("n", "<leader>gG", function() Snacks.lazygit() end, { desc = "Lazygit (cwd)" })
360-
map("n", "<leader>gf", function() Snacks.picker.git_log_file() end, { desc = "Git Current File History" })
361-
map("n", "<leader>gl", function() Snacks.picker.git_log({ cwd = LazyVim.root.git() }) end, { desc = "Git Log" })
362-
map("n", "<leader>gL", function() Snacks.picker.git_log() end, { desc = "Git Log (cwd)" })
363360
end
364361

362+
map("n", "<leader>gL", function() Snacks.picker.git_log() end, { desc = "Git Log (cwd)" })
365363
map("n", "<leader>gb", function() Snacks.picker.git_log_line() end, { desc = "Git Blame Line" })
364+
map("n", "<leader>gf", function() Snacks.picker.git_log_file() end, { desc = "Git Current File History" })
365+
map("n", "<leader>gl", function() Snacks.picker.git_log({ cwd = LazyVim.root.git() }) end, { desc = "Git Log" })
366366
map({ "n", "x" }, "<leader>gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" })
367367
map({"n", "x" }, "<leader>gY", function()
368368
Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end, notify = false })
@@ -381,12 +381,8 @@ map("n", "<leader>L", function() LazyVim.news.changelog() end, { desc = "LazyVim
381381
-- floating terminal
382382
map("n", "<leader>fT", function() Snacks.terminal() end, { desc = "Terminal (cwd)" })
383383
map("n", "<leader>ft", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
384-
map("n", "<c-/>", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
385-
map("n", "<c-_>", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" })
386-
387-
-- Terminal Mappings
388-
map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
389-
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
384+
map({"n","t"}, "<c-/>",function() Snacks.terminal.focus(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
385+
map({"n","t"}, "<c-_>",function() Snacks.terminal.focus(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" })
390386

391387
-- windows
392388
map("n", "<leader>-", "<C-W>s", { desc = "Split Window Below", remap = true })
@@ -404,6 +400,9 @@ map("n", "<leader><tab>]", "<cmd>tabnext<cr>", { desc = "Next Tab" })
404400
map("n", "<leader><tab>d", "<cmd>tabclose<cr>", { desc = "Close Tab" })
405401
map("n", "<leader><tab>[", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
406402

403+
-- lua
404+
map({"n", "x"}, "<localleader>r", function() Snacks.debug.run() end, { desc = "Run Lua", ft = "lua" })
405+
407406
```
408407

409408
</TabItem>
@@ -488,6 +487,7 @@ vim.api.nvim_create_autocmd("FileType", {
488487
pattern = {
489488
"PlenaryTestPopup",
490489
"checkhealth",
490+
"dap-float",
491491
"dbout",
492492
"gitsigns-blame",
493493
"grug-far",

docs/configuration/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ return {
6767
neovim = false,
6868
},
6969
-- icons used by other plugins
70-
-- stylua: ignore
7170
icons = {
7271
misc = {
7372
dots = "󰇘",
7473
},
7574
ft = {
76-
octo = "",
75+
octo = "",
76+
gh = "",
77+
["markdown.gh"] = "",
7778
},
7879
dap = {
7980
Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" },

docs/configuration/keymaps.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,53 @@ For more info on configuring plugin keymaps, see [Adding & Disabling Plugin Keym
2020

2121
## LSP keymaps
2222

23-
These are the default keymaps that will be added when an LSP server is attached to the current buffer.
23+
LSP keymaps are configured using the `keys` option in your LSP server configuration.
24+
You can add global keymaps that apply to all LSP servers using the special `servers['*']` key,
25+
or server-specific keymaps.
26+
2427
For more info see [Customizing LSP Keymaps](/plugins/lsp#%EF%B8%8F-customizing-lsp-keymaps)
2528

26-
### LSP Server keymaps
29+
### Global LSP Keymaps
30+
31+
Global LSP keymaps apply to all LSP servers:
32+
33+
```lua
34+
{
35+
"neovim/nvim-lspconfig",
36+
opts = {
37+
servers = {
38+
['*'] = {
39+
keys = {
40+
-- Add or change a keymap
41+
{ "K", vim.lsp.buf.hover, desc = "Hover" },
42+
-- Disable a keymap
43+
{ "gd", false },
44+
-- Capability-based keymap (only set if server supports it)
45+
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action", has = "codeAction" },
46+
},
47+
},
48+
},
49+
},
50+
}
51+
```
52+
53+
### Server-Specific Keymaps
2754

28-
Sometimes it may be necessary to add keymaps for a specific LSP server.
29-
Lazyutils provides a `keys` LSP option for this purpose.
55+
Add keymaps for specific LSP servers:
3056

3157
```lua
3258
{
3359
"neovim/nvim-lspconfig",
3460
opts = {
3561
servers = {
36-
tsserver = {
62+
vtsls = {
3763
keys = {
38-
{ "<leader>co", "<cmd>TypescriptOrganizeImports<CR>", desc = "Organize Imports" },
39-
{ "<leader>cR", "<cmd>TypescriptRenameFile<CR>", desc = "Rename File" },
64+
{ "<leader>co", function()
65+
vim.lsp.buf.code_action({
66+
apply = true,
67+
context = { only = { "source.organizeImports" }, diagnostics = {} },
68+
})
69+
end, desc = "Organize Imports" },
4070
},
4171
},
4272
},

0 commit comments

Comments
 (0)