Merge branch 'main' of https://arrakis.fly.dev/weeheavy/neovim
This commit is contained in:
commit
12c87776a5
35 changed files with 522 additions and 645 deletions
7
.luarc.json
Normal file
7
.luarc.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"runtime.version": "LuaJIT",
|
||||||
|
"runtime.path": ["lua/?.lua", "lua/?/init.lua"],
|
||||||
|
"diagnostics.globals": ["vim"],
|
||||||
|
"workspace.checkThirdParty": false,
|
||||||
|
"workspace.library": ["$VIMRUNTIME"]
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
- `;` leader key
|
- `;` leader key
|
||||||
- `:checkhealth [<pluginname>]` check base or plugin status
|
- `:checkhealth [<pluginname>]` check base or plugin status
|
||||||
|
- `:checkhealth vim.lsp` show details of LSP attached to buffer
|
||||||
- `:verbose set expandtab?` check where `expandtab` has been set last
|
- `:verbose set expandtab?` check where `expandtab` has been set last
|
||||||
- `:Lazy` show package manager UI
|
- `:Lazy` show package manager UI
|
||||||
- `:Mason` show Mason UI
|
- `:Mason` show Mason UI
|
||||||
|
|
@ -49,6 +50,7 @@
|
||||||
- `Ctrl`+`l` accept selected suggestion
|
- `Ctrl`+`l` accept selected suggestion
|
||||||
- `gd` go to definition
|
- `gd` go to definition
|
||||||
- `gr` show references of function
|
- `gr` show references of function
|
||||||
|
- `grn` renames all refs of the symbol under cursor
|
||||||
- `leader`+`q` toggle `trouble.nvim` quickfix list
|
- `leader`+`q` toggle `trouble.nvim` quickfix list
|
||||||
- `leader`+`da` go to next diagnostic (any severity)
|
- `leader`+`da` go to next diagnostic (any severity)
|
||||||
- `leader`+`dw` go to next diagnostic (_warning_ severity)
|
- `leader`+`dw` go to next diagnostic (_warning_ severity)
|
||||||
|
|
|
||||||
36
README.md
36
README.md
|
|
@ -29,20 +29,16 @@ It's not too important. Still, I try to balance increasing startup time with
|
||||||
the usefullness of a plugin.
|
the usefullness of a plugin.
|
||||||
|
|
||||||
Output from lazy.nvim profiling (`:Lazy profile`) on a MacBook Pro M2 Max,
|
Output from lazy.nvim profiling (`:Lazy profile`) on a MacBook Pro M2 Max,
|
||||||
macOS 14 on Neovim 0.10.1.
|
macOS 15 on Neovim 0.11.0.
|
||||||
|
|
||||||
### Start and open init.lua
|
### Start and open init.lua
|
||||||
|
|
||||||
Around 10% of the plugins are lazy-loaded.
|
Around 15% of the plugins are lazy-loaded.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
Startuptime: 96.76ms
|
LazyStart 18.67ms
|
||||||
|
LazyDone 43.52ms (+24.85ms)
|
||||||
Based on the actual CPU time of the Neovim process till UIEnter.
|
UIEnter 110.71ms (+67.19ms)
|
||||||
This is more accurate than `nvim --startuptime`.
|
|
||||||
LazyStart 13.3ms
|
|
||||||
LazyDone 41.06ms (+27.76ms)
|
|
||||||
UIEnter 96.76ms (+55.71ms)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Starting with an empty file
|
### Starting with an empty file
|
||||||
|
|
@ -50,13 +46,9 @@ This is more accurate than `nvim --startuptime`.
|
||||||
Around 50% of the plugins are lazy-loaded.
|
Around 50% of the plugins are lazy-loaded.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
Startuptime: 49.82ms
|
LazyStart 18.15ms
|
||||||
|
LazyDone 46.91ms (+28.76ms)
|
||||||
Based on the actual CPU time of the Neovim process till UIEnter.
|
UIEnter 59.08ms (+12.17ms)
|
||||||
This is more accurate than `nvim --startuptime`.
|
|
||||||
LazyStart 13.75ms
|
|
||||||
LazyDone 40.39ms (+26.64ms)
|
|
||||||
UIEnter 49.82ms (+9.43ms)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
|
|
@ -70,26 +62,20 @@ This is more accurate than `nvim --startuptime`.
|
||||||
| **nvim-treesitter-context** | Shows current line context | <https://github.com/nvim-treesitter/nvim-treesitter-context> |
|
| **nvim-treesitter-context** | Shows current line context | <https://github.com/nvim-treesitter/nvim-treesitter-context> |
|
||||||
| **nvim-treesitter-textobjects** | ? | <https://github.com/nvim-treesitter/nvim-treesitter-textobjects> |
|
| **nvim-treesitter-textobjects** | ? | <https://github.com/nvim-treesitter/nvim-treesitter-textobjects> |
|
||||||
| **oil.nvim** | file explorer, (bulk file creation/rename) | <https://github.com/stevearc/oil.nvim> |
|
| **oil.nvim** | file explorer, (bulk file creation/rename) | <https://github.com/stevearc/oil.nvim> |
|
||||||
| **tokyonight.nvim** | Theme with treesitter/lsp support | <https://github.com/folke/tokyonight.nvim> |
|
| **rose-pine** | Theme | <https://github.com/rose-pine/neovim> |
|
||||||
| **lualine.nvim** | Status line | <https://github.com/nvim-lualine/lualine.nvim> |
|
| **lualine.nvim** | Status line | <https://github.com/nvim-lualine/lualine.nvim> |
|
||||||
| **gitsigns.nvim** | Git change indicator | <https://github.com/lewis6991/gitsigns.nvim> |
|
| **gitsigns.nvim** | Git change indicator | <https://github.com/lewis6991/gitsigns.nvim> |
|
||||||
| **which-key.nvim** | Shows contextual key bindings | <https://github.com/folke/which-key.nvim> |
|
| **which-key.nvim** | Shows contextual key bindings | <https://github.com/folke/which-key.nvim> |
|
||||||
| **vim-illuminate** | Highlight similar words (w/ LSP, Treesitter, regex) | <https://github.com/RRethy/vim-illuminate> |
|
| **vim-illuminate** | Highlight similar words (w/ LSP, Treesitter, regex) | <https://github.com/RRethy/vim-illuminate> |
|
||||||
| **lsp-zero.nvim** | LSP for mere mortals | <https://github.com/VonHeikemen/lsp-zero.nvim> |
|
|
||||||
| **nvim-lspconfig** | Component of lsp-zero.nvim | <https://github.com/neovim/nvim-lspconfig> |
|
|
||||||
| **cmp-nvim-lsp** | Dependency of lsp-zero.nvim | <https://github.com/hrsh7th/cmp-nvim-lsp> |
|
|
||||||
| **conform.nvim** | Formatter configuration, replacement for `null-ls` | <https://github.com/stevearc/conform.nvim> |
|
| **conform.nvim** | Formatter configuration, replacement for `null-ls` | <https://github.com/stevearc/conform.nvim> |
|
||||||
| **mason.nvim** | Install/manage LSP/DAP servers, linters and formatters | <https://github.com/williamboman/mason.nvim> |
|
| **mason.nvim** | Install/manage LSP/DAP servers, linters and formatters | <https://github.com/williamboman/mason.nvim> |
|
||||||
| **mason-lspconfig.nvim** | Bridges mason.nvim with the lspconfig plugin | <https://github.com/williamboman/mason-lspconfig.nvim> |
|
|
||||||
| **zen-mode.nvim** | Distraction-free coding for Neovim | <https://github.com/folke/zen-mode.nvim> |
|
|
||||||
| **twilight.nvim** | Dims inactive portions of the code you're editing | <https://github.com/folke/twilight.nvim> |
|
|
||||||
| **todo-comments.nvim** | Highlights `NOTE:`, `FIXME:` etc. and makes them findable via Telescope | <https://github.com/folke/todo-comments.nvim> |
|
| **todo-comments.nvim** | Highlights `NOTE:`, `FIXME:` etc. and makes them findable via Telescope | <https://github.com/folke/todo-comments.nvim> |
|
||||||
| **mini.nvim** | I use the icons | <https://github.com/echasnovski/mini.nvim> |
|
| **mini.nvim** | I use the icons | <https://github.com/echasnovski/mini.nvim> |
|
||||||
| **flash.nvim** | Navigation and Treesitter selection w/ search labels | <https://github.com/folke/flash.nvim> |
|
| **flash.nvim** | Navigation and Treesitter selection w/ search labels | <https://github.com/folke/flash.nvim> |
|
||||||
| **copilot.lua** | The better github.com/github/copilot.vim | <https://github.com/zbirenbaum/copilot.lua> |
|
|
||||||
| **copilot-cmp** | transforms zbirenbaum/copilot.lua into a cmp source. | <https://github.com/zbirenbaum/copilot-cmp> |
|
|
||||||
| **nvim-lint** | Narrow-scope linter plugin to use via Neovim diagnostic framework | <https://github.com/mfussenegger/nvim-lint> |
|
| **nvim-lint** | Narrow-scope linter plugin to use via Neovim diagnostic framework | <https://github.com/mfussenegger/nvim-lint> |
|
||||||
| **snipe.nvim** | Buffer navigation | <https://github.com/leath-dub/snipe.nvim> |
|
| **snipe.nvim** | Buffer navigation | <https://github.com/leath-dub/snipe.nvim> |
|
||||||
|
| **blink.cmp** | Fuzzy code completion | <https://github.com/Saghen/blink.cmp> |
|
||||||
|
| **diffview.nvim** | Git diff viewer/stager | <https://github.com/sindrets/diffview.nvim> |
|
||||||
|
|
||||||
## Looks
|
## Looks
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
-- Disable column width indicators in quickfix/Trouble windows
|
|
||||||
-- vim.opt.colorcolumn = ""
|
|
||||||
vim.opt.colorcolumn = ""
|
|
||||||
vim.opt_local.colorcolumn = ""
|
|
||||||
vim.wo.colorcolumn = "0"
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
-- Disable column width indicators in quickfix/Trouble windows
|
|
||||||
-- vim.opt.colorcolumn = ""
|
|
||||||
vim.opt.colorcolumn = ""
|
|
||||||
vim.opt_local.colorcolumn = ""
|
|
||||||
vim.wo.colorcolumn = "0"
|
|
||||||
7
init.lua
7
init.lua
|
|
@ -1,12 +1,17 @@
|
||||||
--[[
|
--[[
|
||||||
My simple(TM) Neovim configuration. Made from scratch, inspired by
|
My simple(TM) Neovim configuration. Made from scratch, inspired by
|
||||||
https://www.youtube.com/watch?v=w7i4amO_zaE
|
https://www.youtube.com/watch?v=w7i4amO_zaE
|
||||||
|
Later on, switched to native LSP setup with the help of
|
||||||
|
https://gpanders.com/blog/whats-new-in-neovim-0-11/
|
||||||
|
|
||||||
NOTE: EXTERNAL DEPENDENCIES MACOS
|
NOTE: EXTERNAL DEPENDENCIES MACOS
|
||||||
- ripgrep (https://github.com/BurntSushi/ripgrep, used by telescope)
|
- ripgrep (https://github.com/BurntSushi/ripgrep, used by telescope)
|
||||||
- fd (https://github.com/sharkdp/fd, used by telescope)
|
- fd (https://github.com/sharkdp/fd, used by telescope)
|
||||||
- A Nerd font (https://www.nerdfonts.com/, used by various plugins)
|
- A Nerd font (https://www.nerdfonts.com/, used by various plugins)
|
||||||
|
|
||||||
|
NOTE: EXTERNAL DEPENDENCIES FREEBSD
|
||||||
|
- cmake, ripgrep (pkg install <pkgname>)
|
||||||
|
|
||||||
NOTE: EXTERNAL DEPENDENCIES WINDOWS
|
NOTE: EXTERNAL DEPENDENCIES WINDOWS
|
||||||
See https://blog.nikfp.com/how-to-install-and-set-up-neovim-on-windows
|
See https://blog.nikfp.com/how-to-install-and-set-up-neovim-on-windows
|
||||||
- ripgrep (https://github.com/BurntSushi/ripgrep, used by telescope)
|
- ripgrep (https://github.com/BurntSushi/ripgrep, used by telescope)
|
||||||
|
|
@ -20,5 +25,5 @@ Then run "make" in your users telescope-fzf-native plugin directory:
|
||||||
C:\Users\foobar\AppData\Local\nvim-data\lazy\telescope-fzf-native.nvim
|
C:\Users\foobar\AppData\Local\nvim-data\lazy\telescope-fzf-native.nvim
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- Include customized configuration
|
-- Include my custom configuration
|
||||||
require("weeheavy")
|
require("weeheavy")
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,30 @@
|
||||||
{
|
{
|
||||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
"blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" },
|
||||||
"auto-dark-mode.nvim": { "branch": "master", "commit": "02ef9553e2a1d6e861bc6955d58ce5883d28a6ad" },
|
"ccc.nvim": { "branch": "main", "commit": "9abb22d5d47460852a935129b4feff39fd8033e3" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "80b57f662b5e13ae8c2c7c38639966084625fa5e" },
|
|
||||||
"copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" },
|
|
||||||
"copilot.lua": { "branch": "master", "commit": "886ee73b6d464b2b3e3e6a7ff55ce87feac423a9" },
|
|
||||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||||
"flash.nvim": { "branch": "main", "commit": "f899265876ecdcf7352dbc9f0adf87068cedefbb" },
|
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "9772ce68a9a6d156f3f2166bfd0a17a09ab37eba" },
|
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" },
|
"gitsigns.nvim": { "branch": "main", "commit": "3c76f7fabac723aa682365ef782f88a83ccdb4ac" },
|
||||||
"lsp-zero.nvim": { "branch": "v4.x", "commit": "baff1ca10ecad7efe04f02f06d2647dd2ae90074" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
"lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
|
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
"mini.nvim": { "branch": "main", "commit": "687fa868d869078194c02065628712982d971fd6" },
|
||||||
"mini.nvim": { "branch": "main", "commit": "87fc38a8a2b8d498cecb021d057a38ea2e9f5a79" },
|
|
||||||
"newpaper.nvim": { "branch": "main", "commit": "d8f2a29001f795a59e4f28713427c200c15449ea" },
|
"newpaper.nvim": { "branch": "main", "commit": "d8f2a29001f795a59e4f28713427c200c15449ea" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
"nvim-lint": { "branch": "master", "commit": "81e8ba7655cc4395b1092ef4e1b6e83f54cd54ad" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "789b7ada1b4f00e08d026dffde410dcfa6a0ba87" },
|
"nvim-treesitter": { "branch": "master", "commit": "997288c55253e27f782d991099490f80205d65bf" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "00dae9f5f4ad215d4561f2fd2f26478c48b0ca7f" },
|
"nvim-treesitter-context": { "branch": "master", "commit": "93b29a32d5f4be10e39226c6b796f28d68a8b483" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "cced713b4993ddbfba8f82e9e60fcab7cbee8101" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" },
|
||||||
"nvim-treesitter-context": { "branch": "master", "commit": "9a49f43a2ec9bf77aecfb0fcbc43af43338375c0" },
|
"nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
|
"oil.nvim": { "branch": "master", "commit": "302bbaceeafc690e6419e0c8296e804d60cb9446" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"oil.nvim": { "branch": "master", "commit": "add50252b5e9147c0a09d36480d418c7e2737472" },
|
"rose-pine": { "branch": "main", "commit": "96ff3993a67356ee85d1cdab9be652cdc1c5d1ac" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
|
"snipe.nvim": { "branch": "main", "commit": "f43a1f0090de03d48ce5c55df630c1aa4d0b4291" },
|
||||||
"rose-pine": { "branch": "main", "commit": "20c7940da844aa4f162a64e552ae3c7e9fdc3b93" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||||
"smear-cursor.nvim": { "branch": "main", "commit": "110f7d8771fff9dde6b2aa7e20c29bae8bb4d834" },
|
|
||||||
"snipe.nvim": { "branch": "main", "commit": "0d0a482ac713370196e4fc0025d5aaac5030104d" },
|
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
|
|
||||||
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "b262293ef481b0d1f7a14c708ea7ca649672e200" },
|
"tokyonight.nvim": { "branch": "main", "commit": "b262293ef481b0d1f7a14c708ea7ca649672e200" },
|
||||||
"trouble.nvim": { "branch": "main", "commit": "6f380b8826fb819c752c8fd7daaee9ef96d4c689" },
|
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||||
"twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
|
"vim-illuminate": { "branch": "master", "commit": "19cb21f513fc2b02f0c66be70107741e837516a1" },
|
||||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||||
"which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" },
|
|
||||||
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
28
lsp/ansible.lua
Normal file
28
lsp/ansible.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
--- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/ansiblels.lua
|
||||||
|
--- https://github.com/neovim/nvim-lspconfig/pull/3659/files#diff-5ecad9b03732db4dfd97f3aa9874fa465b88ee4e121bf152e670f46e4f19cc6e
|
||||||
|
return {
|
||||||
|
cmd = { "ansible-language-server", "--stdio" },
|
||||||
|
settings = {
|
||||||
|
ansible = {
|
||||||
|
python = {
|
||||||
|
interpreterPath = "python",
|
||||||
|
},
|
||||||
|
ansible = {
|
||||||
|
path = "ansible",
|
||||||
|
},
|
||||||
|
executionEnvironment = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
validation = {
|
||||||
|
enabled = true,
|
||||||
|
lint = {
|
||||||
|
enabled = true,
|
||||||
|
path = "ansible-lint",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = { "yaml.ansible" },
|
||||||
|
root_markers = { "ansible.cfg", ".ansible-lint" },
|
||||||
|
}
|
||||||
6
lsp/go.lua
Normal file
6
lsp/go.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { "gopls" },
|
||||||
|
root_markers = { "go.work", "go.mod", ".git" },
|
||||||
|
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
||||||
|
}
|
||||||
14
lsp/lua.lua
Normal file
14
lsp/lua.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { "lua-language-server" },
|
||||||
|
filetypes = { "lua" },
|
||||||
|
root_markers = { ".luarc.json", ".luarc.jsonc" },
|
||||||
|
telemetry = { enabled = false },
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
6
lsp/marksman.lua
Normal file
6
lsp/marksman.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { "marksman" },
|
||||||
|
root_markers = { ".md" },
|
||||||
|
filetypes = { "markdown" },
|
||||||
|
}
|
||||||
34
lsp/tailwind.lua
Normal file
34
lsp/tailwind.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { "tailwindcss-language-server", "--stdio" },
|
||||||
|
root_markers = { "tailwind.config.js" },
|
||||||
|
filetypes = { "javascript", "htmldjango", "css" },
|
||||||
|
settings = {
|
||||||
|
tailwindCSS = {
|
||||||
|
validate = true,
|
||||||
|
lint = {
|
||||||
|
cssConflict = "warning",
|
||||||
|
invalidApply = "error",
|
||||||
|
invalidScreen = "error",
|
||||||
|
invalidVariant = "error",
|
||||||
|
invalidConfigPath = "error",
|
||||||
|
invalidTailwindDirective = "error",
|
||||||
|
recommendedVariantOrder = "warning",
|
||||||
|
},
|
||||||
|
classAttributes = {
|
||||||
|
"class",
|
||||||
|
"className",
|
||||||
|
"class:list",
|
||||||
|
"classList",
|
||||||
|
"ngClass",
|
||||||
|
},
|
||||||
|
includeLanguages = {
|
||||||
|
eelixir = "html-eex",
|
||||||
|
eruby = "erb",
|
||||||
|
templ = "html",
|
||||||
|
htmlangular = "html",
|
||||||
|
htmldjango = "html",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
6
lsp/terraform.lua
Normal file
6
lsp/terraform.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { "terraform-ls", "serve" },
|
||||||
|
root_markers = { ".terraform", ".terraform.lock.hcl", ".git" },
|
||||||
|
filetypes = { "terraform" },
|
||||||
|
}
|
||||||
5
lsp/yaml.lua
Normal file
5
lsp/yaml.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
filetypes = { "yaml" },
|
||||||
|
cmd = { "yaml-language-server", "--stdio" },
|
||||||
|
}
|
||||||
|
|
@ -1,23 +1,60 @@
|
||||||
-- Highlight yanked text on e.g. yy,yap etc.
|
-- Native autocompletion
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
desc = "Highlight when yanking (copying) text",
|
-- callback = function(ev)
|
||||||
group = vim.api.nvim_create_augroup("weeheavy-highlight-yank", { clear = true }),
|
-- local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||||
callback = function()
|
-- if client:supports_method("textDocument/completion") then
|
||||||
vim.highlight.on_yank()
|
-- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
||||||
end,
|
-- end
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("my.lsp", {}),
|
||||||
|
callback = function(args)
|
||||||
|
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||||
|
if client:supports_method("textDocument/implementation") then
|
||||||
|
-- Create a keymap for vim.lsp.buf.implementation ...
|
||||||
|
end
|
||||||
|
-- Enable auto-completion. Note: Use CTRL-Y to select an item. |complete_CTRL-Y|
|
||||||
|
if client:supports_method("textDocument/completion") then
|
||||||
|
-- Optional: trigger autocompletion on EVERY keypress. May be slow!
|
||||||
|
-- local chars = {}
|
||||||
|
-- for i = 32, 126 do
|
||||||
|
-- table.insert(chars, string.char(i))
|
||||||
|
-- end
|
||||||
|
-- client.server_capabilities.completionProvider.triggerCharacters = chars
|
||||||
|
-- vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||||
|
end
|
||||||
|
-- Auto-format ("lint") on save.
|
||||||
|
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
|
||||||
|
if
|
||||||
|
not client:supports_method("textDocument/willSaveWaitUntil")
|
||||||
|
and client:supports_method("textDocument/formatting")
|
||||||
|
then
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = vim.api.nvim_create_augroup("my.lsp", { clear = false }),
|
||||||
|
buffer = args.buf,
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
-- Highlight yanked text on e.g. yy,yap etc.
|
||||||
pattern = "trouble",
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
callback = function()
|
desc = "Highlight when yanking (copying) text",
|
||||||
vim.opt.colorcolumn = ""
|
group = vim.api.nvim_create_augroup("weeheavy-highlight-yank", { clear = true }),
|
||||||
end,
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- https://github.com/LazyVim/LazyVim/discussions/654
|
-- https://github.com/LazyVim/LazyVim/discussions/654
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "terraform",
|
pattern = "terraform",
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.bo.commentstring = "# %s"
|
vim.bo.commentstring = "# %s"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
-- https://github.com/f-person/auto-dark-mode.nvim
|
|
||||||
return {
|
|
||||||
"f-person/auto-dark-mode.nvim",
|
|
||||||
opts = {
|
|
||||||
-- in ms. needs to be larger than whatever time your system takes to
|
|
||||||
-- query dark mode. Otherwise you risk freezing neovim on shutdown
|
|
||||||
update_interval = 4000,
|
|
||||||
set_dark_mode = function()
|
|
||||||
vim.api.nvim_set_option_value("background", "dark", {})
|
|
||||||
vim.cmd("colorscheme rose-pine-moon")
|
|
||||||
end,
|
|
||||||
set_light_mode = function()
|
|
||||||
vim.api.nvim_set_option_value("background", "light", {})
|
|
||||||
vim.cmd("colorscheme rose-pine-dawn")
|
|
||||||
end,
|
|
||||||
fallback = "light",
|
|
||||||
},
|
|
||||||
-- config = function()
|
|
||||||
-- local darkmode = require("auto-dark-mode")
|
|
||||||
-- darkmode.setup({})
|
|
||||||
-- end,
|
|
||||||
}
|
|
||||||
20
lua/weeheavy/plugins/ccc.lua
Normal file
20
lua/weeheavy/plugins/ccc.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
-- File system operations for nerds
|
||||||
|
-- https://github.com/uga-rosa/ccc.nvim
|
||||||
|
return {
|
||||||
|
"uga-rosa/ccc.nvim",
|
||||||
|
lazy = true,
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
config = function()
|
||||||
|
local ccc = require("ccc")
|
||||||
|
local mapping = ccc.mapping
|
||||||
|
ccc.setup({
|
||||||
|
|
||||||
|
-- Your preferred settings
|
||||||
|
-- Example: enable highlighter
|
||||||
|
highlighter = {
|
||||||
|
auto_enable = true,
|
||||||
|
lsp = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
-- Fully featured & enhanced replacement for copilot.vim complete with API for
|
|
||||||
-- interacting with Github Copilot
|
|
||||||
-- https://github.com/zbirenbaum/copilot.lua
|
|
||||||
return {
|
|
||||||
"zbirenbaum/copilot.lua",
|
|
||||||
lazy = true,
|
|
||||||
enabled = false,
|
|
||||||
event = "InsertEnter",
|
|
||||||
config = function()
|
|
||||||
local copilot = require("copilot")
|
|
||||||
copilot.setup({
|
|
||||||
panel = {
|
|
||||||
enabled = false,
|
|
||||||
auto_refresh = false,
|
|
||||||
keymap = {
|
|
||||||
jump_prev = "[[",
|
|
||||||
jump_next = "]]",
|
|
||||||
accept = "<CR>",
|
|
||||||
refresh = "gr",
|
|
||||||
open = "<M-CR>",
|
|
||||||
},
|
|
||||||
layout = {
|
|
||||||
position = "bottom", -- | top | left | right
|
|
||||||
ratio = 0.4,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
suggestion = {
|
|
||||||
enabled = false,
|
|
||||||
auto_trigger = false,
|
|
||||||
debounce = 75,
|
|
||||||
keymap = {
|
|
||||||
accept = "<M-l>",
|
|
||||||
accept_word = false,
|
|
||||||
accept_line = false,
|
|
||||||
next = "<M-]>",
|
|
||||||
prev = "<M-[>",
|
|
||||||
dismiss = "<C-]>",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filetypes = {
|
|
||||||
yaml = true,
|
|
||||||
markdown = false,
|
|
||||||
help = false,
|
|
||||||
gitcommit = false,
|
|
||||||
gitrebase = false,
|
|
||||||
hgcommit = false,
|
|
||||||
svn = false,
|
|
||||||
cvs = false,
|
|
||||||
["."] = false,
|
|
||||||
},
|
|
||||||
copilot_node_command = "node", -- Node.js version must be > 18.x
|
|
||||||
server_opts_overrides = {},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +1,22 @@
|
||||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
return {
|
return {
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
-- See `:help gitsigns.txt`
|
-- See `:help gitsigns.txt`
|
||||||
signs = {
|
signs = {
|
||||||
add = { text = "+" },
|
add = { text = "+" },
|
||||||
change = { text = "~" },
|
change = { text = "~" },
|
||||||
delete = { text = "_" },
|
delete = { text = "_" },
|
||||||
topdelete = { text = "‾" },
|
topdelete = { text = "‾" },
|
||||||
changedelete = { text = "~" },
|
changedelete = { text = "~" },
|
||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
--vim.keymap.set(
|
vim.keymap.set(
|
||||||
-- "n",
|
"n",
|
||||||
-- "<leader>ggh",
|
"<leader>gg",
|
||||||
-- require("gitsigns").preview_hunk,
|
require("gitsigns").preview_hunk,
|
||||||
-- { buffer = bufnr, desc = "Preview git hunk" }
|
{ buffer = bufnr, desc = "Preview git hunk" }
|
||||||
--)
|
)
|
||||||
|
end,
|
||||||
-- don't override the built-in and fugitive keymaps
|
},
|
||||||
local gs = package.loaded.gitsigns
|
|
||||||
vim.keymap.set({ "n", "v" }, "]c", function()
|
|
||||||
if vim.wo.diff then
|
|
||||||
return "]c"
|
|
||||||
end
|
|
||||||
vim.schedule(function()
|
|
||||||
gs.next_hunk()
|
|
||||||
end)
|
|
||||||
return "<Ignore>"
|
|
||||||
end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" })
|
|
||||||
vim.keymap.set({ "n", "v" }, "[c", function()
|
|
||||||
if vim.wo.diff then
|
|
||||||
return "[c"
|
|
||||||
end
|
|
||||||
vim.schedule(function()
|
|
||||||
gs.prev_hunk()
|
|
||||||
end)
|
|
||||||
return "<Ignore>"
|
|
||||||
end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
return {
|
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
|
||||||
enabled = false,
|
|
||||||
lazy = true,
|
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
|
||||||
main = "ibl",
|
|
||||||
opts = {},
|
|
||||||
config = function()
|
|
||||||
local indent = require("ibl").setup({
|
|
||||||
-- disable scope highlighting as it requires some tuning
|
|
||||||
scope = { enabled = false },
|
|
||||||
indent = {
|
|
||||||
char = "│",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
61
lua/weeheavy/plugins/lsp/blink.lua
Normal file
61
lua/weeheavy/plugins/lsp/blink.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
return {
|
||||||
|
"saghen/blink.cmp",
|
||||||
|
lazy = true,
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
-- optional: provides snippets for the snippet source
|
||||||
|
dependencies = { "rafamadriz/friendly-snippets" },
|
||||||
|
|
||||||
|
-- use a release tag to download pre-built binaries
|
||||||
|
version = "1.*",
|
||||||
|
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||||
|
-- build = 'cargo build --release',
|
||||||
|
-- If you use nix, you can build from source using latest nightly rust with:
|
||||||
|
-- build = 'nix run .#build-plugin',
|
||||||
|
|
||||||
|
---@module 'blink.cmp'
|
||||||
|
---@type blink.cmp.Config
|
||||||
|
opts = {
|
||||||
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- 'enter' for enter to accept
|
||||||
|
-- 'none' for no mappings
|
||||||
|
--
|
||||||
|
-- All presets have the following mappings:
|
||||||
|
-- C-space: Open menu or open docs if already open
|
||||||
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
--
|
||||||
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
|
keymap = {
|
||||||
|
preset = "enter",
|
||||||
|
["<C-k>"] = { "select_prev", "fallback" },
|
||||||
|
["<C-j>"] = { "select_next", "fallback" },
|
||||||
|
["<Tab>"] = { "accept", "fallback" },
|
||||||
|
["<C-c>"] = { "cancel", "fallback" },
|
||||||
|
},
|
||||||
|
|
||||||
|
appearance = {
|
||||||
|
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
|
-- Adjusts spacing to ensure icons are aligned
|
||||||
|
nerd_font_variant = "mono",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Only show the documentation popup when manually triggered
|
||||||
|
completion = { documentation = { auto_show = true } },
|
||||||
|
|
||||||
|
-- Default list of enabled providers defined so that you can extend it
|
||||||
|
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
|
sources = {
|
||||||
|
default = { "lsp", "path", "snippets", "buffer" },
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||||
|
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||||
|
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||||
|
--
|
||||||
|
-- See the fuzzy documentation for more information
|
||||||
|
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||||
|
},
|
||||||
|
opts_extend = { "sources.default" },
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
-- Some things are from https://www.josean.com/posts/neovim-linting-and-formatting
|
-- Some things are from https://www.josean.com/posts/neovim-linting-and-formatting
|
||||||
return {
|
return {
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
|
enabled = true,
|
||||||
tag = "stable",
|
tag = "stable",
|
||||||
opts = {},
|
opts = {},
|
||||||
config = function()
|
config = function()
|
||||||
local conform = require("conform")
|
local conform = require("conform")
|
||||||
conform.setup({
|
conform.setup({
|
||||||
-- formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
formatters = {
|
|
||||||
javascript = { "prettier" },
|
javascript = { "prettier" },
|
||||||
typescript = { "prettier" },
|
typescript = { "prettier" },
|
||||||
javascriptreact = { "prettier" },
|
javascriptreact = { "prettier" },
|
||||||
|
|
@ -22,6 +22,8 @@ return {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
python = { "isort", "black" },
|
python = { "isort", "black" },
|
||||||
sh = { "shfmt" },
|
sh = { "shfmt" },
|
||||||
|
terraform = { "tflint" },
|
||||||
|
hcl = { "hclfmt" },
|
||||||
},
|
},
|
||||||
stop_after_first = false,
|
stop_after_first = false,
|
||||||
format_on_save = {
|
format_on_save = {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
-- transforms https://github.com/zbirenbaum/copilot.lua into a cmp source.
|
|
||||||
-- https://github.com/zbirenbaum/copilot-cmp
|
|
||||||
return {
|
|
||||||
"zbirenbaum/copilot-cmp",
|
|
||||||
lazy = false,
|
|
||||||
--event = "InsertEnter",
|
|
||||||
config = function()
|
|
||||||
require("copilot_cmp").setup()
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
"VonHeikemen/lsp-zero.nvim",
|
|
||||||
branch = "v4.x",
|
|
||||||
lazy = true,
|
|
||||||
config = false,
|
|
||||||
init = function()
|
|
||||||
-- Disable automatic setup, we are doing it manually
|
|
||||||
vim.g.lsp_zero_extend_cmp = 0
|
|
||||||
vim.g.lsp_zero_extend_lspconfig = 0
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
tag = "stable",
|
|
||||||
lazy = false,
|
|
||||||
config = true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
event = "InsertEnter",
|
|
||||||
dependencies = {
|
|
||||||
{ "L3MON4D3/LuaSnip" },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- Here is where you configure the autocompletion settings.
|
|
||||||
local lsp_zero = require("lsp-zero")
|
|
||||||
lsp_zero.extend_cmp()
|
|
||||||
|
|
||||||
local cmp = require("cmp")
|
|
||||||
local cmp_action = lsp_zero.cmp_action()
|
|
||||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
formatting = lsp_zero.cmp_format(),
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "path" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
{ name = "copilot" },
|
|
||||||
{ name = "luasnip" },
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
|
||||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
|
||||||
["<C-l>"] = cmp.mapping.confirm({ select = true }), -- accept LSP autocompletion
|
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item(cmp_select),
|
|
||||||
["<C-j>"] = cmp.mapping.select_next_item(cmp_select),
|
|
||||||
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
|
||||||
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
|
||||||
}),
|
|
||||||
window = {
|
|
||||||
documentation = {
|
|
||||||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
|
||||||
},
|
|
||||||
completion = {
|
|
||||||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- LSP
|
|
||||||
{
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
cmd = { "LspInfo", "LspInstall", "LspStart" },
|
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
|
||||||
dependencies = {
|
|
||||||
{ "hrsh7th/cmp-nvim-lsp" },
|
|
||||||
{ "williamboman/mason-lspconfig.nvim", tag = "stable" },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
|
||||||
for type, icon in pairs(signs) do
|
|
||||||
local hl = "DiagnosticSign" .. type
|
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
|
||||||
end
|
|
||||||
vim.diagnostic.config({
|
|
||||||
update_in_insert = true,
|
|
||||||
signs = true,
|
|
||||||
virtual_text = {
|
|
||||||
prefix = "", -- Could be '●', '▎', 'x'
|
|
||||||
source = "if_many",
|
|
||||||
},
|
|
||||||
float = {
|
|
||||||
source = "if_many",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
-- This is where all the LSP shenanigans will live
|
|
||||||
local lsp_zero = require("lsp-zero")
|
|
||||||
|
|
||||||
-- Keybindings only active when a LS is active for the curr. file
|
|
||||||
-- lsp_zero.on_attach(function(client, bufnr)
|
|
||||||
local lsp_attach = function(client, bufnr)
|
|
||||||
-- see :help lsp-zero-keybindings to learn the available actions
|
|
||||||
-- or https://lsp-zero.netlify.app/docs/language-server-configuration.html#default-keymaps
|
|
||||||
-- https://www.reddit.com/r/neovim/comments/1ankiu1/lsp_zero_go_to_definition_stopped_working/
|
|
||||||
lsp_zero.default_keymaps({ buffer = bufnr, preserve_mappings = false })
|
|
||||||
end
|
|
||||||
|
|
||||||
lsp_zero.extend_lspconfig({
|
|
||||||
sign_text = true,
|
|
||||||
lsp_attach = lsp_attach,
|
|
||||||
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
|
||||||
})
|
|
||||||
|
|
||||||
require("mason").setup({
|
|
||||||
ui = {
|
|
||||||
icons = {
|
|
||||||
package_installed = "✓",
|
|
||||||
package_pending = "➜",
|
|
||||||
package_uninstalled = "✗",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("mason-lspconfig").setup({
|
|
||||||
ensure_installed = {
|
|
||||||
"bashls",
|
|
||||||
"jsonls",
|
|
||||||
"lua_ls",
|
|
||||||
"vimls",
|
|
||||||
"yamlls",
|
|
||||||
},
|
|
||||||
handlers = {
|
|
||||||
-- names must align with Mason names
|
|
||||||
lsp_zero.default_setup,
|
|
||||||
lua_ls = function()
|
|
||||||
local lua_opts = lsp_zero.nvim_lua_ls()
|
|
||||||
require("lspconfig").lua_ls.setup(lua_opts)
|
|
||||||
require("lspconfig").gopls.setup({})
|
|
||||||
require("lspconfig").yamlls.setup({
|
|
||||||
settings = {
|
|
||||||
yaml = {
|
|
||||||
-- https://www.arthurkoziel.com/json-schemas-in-neovim/
|
|
||||||
schemaStore = {
|
|
||||||
enable = false,
|
|
||||||
url = "",
|
|
||||||
},
|
|
||||||
schemas = {
|
|
||||||
["https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json"] = "cf-*{yml,yaml}",
|
|
||||||
-- ["https://json.schemastore.org/kustomization.json"] = "kustomization.{yml,yaml}",
|
|
||||||
-- ["https://raw.githubusercontent.com/docker/compose/master/compose/config/compose_spec.json"] = "docker-compose*.{yml,yaml}",
|
|
||||||
-- ["https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json"] = "argocd-application.yaml",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
require("lspconfig").taplo.setup({
|
|
||||||
-- Taplo loads all schemas (not selectively)
|
|
||||||
settings = {
|
|
||||||
evenBetterToml = {
|
|
||||||
-- https://www.arthurkoziel.com/json-schemas-in-neovim/
|
|
||||||
schema = {
|
|
||||||
-- additional schemas
|
|
||||||
-- associations = {
|
|
||||||
-- ["alacritty\\.toml$"] = "https://raw.githubusercontent.com/distinction-dev/alacritty-schema/main/alacritty/reference.json",
|
|
||||||
-- },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
6
lua/weeheavy/plugins/lsp/mason.lua
Normal file
6
lua/weeheavy/plugins/lsp/mason.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
tag = "stable",
|
||||||
|
lazy = false,
|
||||||
|
config = true,
|
||||||
|
}
|
||||||
|
|
@ -1,20 +1,21 @@
|
||||||
-- status line like vim-airline
|
-- status line like vim-airline
|
||||||
|
|
||||||
-- Display attached LSP client
|
-- Display attached LSP client
|
||||||
local function lsp_clients()
|
local function lsp_client_name()
|
||||||
local clients = vim.lsp.get_active_clients()
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
local client_names = {}
|
|
||||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
-- local clients = vim.lsp.buf_get_clients(bufnr)
|
||||||
for _, client in ipairs(clients) do
|
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||||
local filetypes = client.config.filetypes
|
if next(clients) == nil then
|
||||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
return "n/a"
|
||||||
return client.name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if next(client_names) == nil then
|
|
||||||
return "no LS"
|
local c = {}
|
||||||
|
for _, client in pairs(clients) do
|
||||||
|
table.insert(c, client.name)
|
||||||
|
-- table.insert(c, string.sub(client.name, 0, 8) .. "...")
|
||||||
end
|
end
|
||||||
--return "[" .. table.concat(client_names, ", ") .. "]"
|
return "\u{f085} " .. table.concat(c, ",")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hide content on narrow windows
|
-- hide content on narrow windows
|
||||||
|
|
@ -69,8 +70,8 @@ return {
|
||||||
-- specify full list of elements when adding custom things
|
-- specify full list of elements when adding custom things
|
||||||
{ "encoding", cond = hide_in_width },
|
{ "encoding", cond = hide_in_width },
|
||||||
{ "fileformat" },
|
{ "fileformat" },
|
||||||
{ "filetype" },
|
{ "filetype", cond = hide_in_width },
|
||||||
{ lsp_clients, cond = hide_in_width },
|
{ lsp_client_name, cond = hide_in_width },
|
||||||
--{ clock, cond = hide_in_width },
|
--{ clock, cond = hide_in_width },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
return {
|
|
||||||
"sphamba/smear-cursor.nvim",
|
|
||||||
|
|
||||||
opts = {
|
|
||||||
-- Smear cursor when switching buffers or windows.
|
|
||||||
smear_between_buffers = true,
|
|
||||||
|
|
||||||
-- Smear cursor when moving within line or to neighbor lines.
|
|
||||||
-- Use `min_horizontal_distance_smear` and `min_vertical_distance_smear` for finer control
|
|
||||||
smear_between_neighbor_lines = true,
|
|
||||||
|
|
||||||
-- Draw the smear in buffer space instead of screen space when scrolling
|
|
||||||
scroll_buffer_space = true,
|
|
||||||
|
|
||||||
-- Set to `true` if your font supports legacy computing symbols (block unicode symbols).
|
|
||||||
-- Smears will blend better on all backgrounds.
|
|
||||||
legacy_computing_symbols_support = false,
|
|
||||||
|
|
||||||
-- Smear cursor in insert mode.
|
|
||||||
-- See also `vertical_bar_cursor_insert_mode` and `distance_stop_animating_vertical_bar`.
|
|
||||||
smear_insert_mode = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -22,13 +22,18 @@ return {
|
||||||
},
|
},
|
||||||
ui = {
|
ui = {
|
||||||
position = "topright",
|
position = "topright",
|
||||||
|
-- position = "cursor",
|
||||||
|
open_win_override = {
|
||||||
|
-- title = "i can haz file?",
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
preselect_current = true,
|
||||||
},
|
},
|
||||||
navigate = {
|
navigate = {
|
||||||
cancel_snipe = "q",
|
cancel_snipe = "q",
|
||||||
-- Close the buffer under the cursor
|
|
||||||
-- PR not merged yet: https://github.com/leath-dub/snipe.nvim/pull/13
|
|
||||||
-- NOTE: Make sure you don't use the character below on your dictionary
|
|
||||||
close_buffer = "d",
|
close_buffer = "d",
|
||||||
|
open_vsplit = "V",
|
||||||
|
open_split = "X",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,20 @@
|
||||||
return {
|
return {
|
||||||
"rose-pine/neovim",
|
"rose-pine/neovim",
|
||||||
name = "rose-pine",
|
name = "rose-pine",
|
||||||
branch = "main",
|
branch = "main",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
enabled = true,
|
enabled = true,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
opts = {},
|
opts = {
|
||||||
|
styles = {
|
||||||
|
-- transparency = true,
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local rose = require("rose-pine")
|
||||||
|
rose.setup({
|
||||||
|
variant = "auto", -- auto, main, moon, or dawn
|
||||||
|
dark_variant = "moon", -- main, moon, or dawn
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,65 +1,65 @@
|
||||||
return {
|
return {
|
||||||
"folke/tokyonight.nvim",
|
"folke/tokyonight.nvim",
|
||||||
tag = "stable",
|
tag = "stable",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
enabled = true,
|
enabled = false,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
opts = {},
|
opts = {},
|
||||||
config = function()
|
config = function()
|
||||||
local tokyonight = require("tokyonight")
|
local tokyonight = require("tokyonight")
|
||||||
local util = require("tokyonight.util")
|
local util = require("tokyonight.util")
|
||||||
tokyonight.setup({
|
tokyonight.setup({
|
||||||
styles = {
|
styles = {
|
||||||
-- See :help nvim_set_hl
|
-- See :help nvim_set_hl
|
||||||
comments = { italic = true },
|
comments = { italic = true },
|
||||||
--functions = { underdotted = true },
|
--functions = { underdotted = true },
|
||||||
},
|
},
|
||||||
on_colors = function(colors)
|
on_colors = function(colors)
|
||||||
-- Brighten up comments a bit
|
-- Brighten up comments a bit
|
||||||
colors.comment = "#888fac"
|
colors.comment = "#888fac"
|
||||||
-- Better visible visual selection background color
|
-- Better visible visual selection background color
|
||||||
--colors.bg_visual = "#e82a86"
|
--colors.bg_visual = "#e82a86"
|
||||||
--colors.bg_visual = colors.teal
|
--colors.bg_visual = colors.teal
|
||||||
end,
|
end,
|
||||||
on_highlights = function(hl, c)
|
on_highlights = function(hl, c)
|
||||||
-- Brighter line numbers
|
-- Brighter line numbers
|
||||||
hl.LineNr = {
|
hl.LineNr = {
|
||||||
fg = util.darken(c.dark5, 0.6),
|
fg = util.darken(c.dark5, 0.6),
|
||||||
}
|
}
|
||||||
--hl.ColorColumn = {
|
--hl.ColorColumn = {
|
||||||
-- bg = c.purple,
|
-- bg = c.purple,
|
||||||
--}
|
--}
|
||||||
|
|
||||||
-- Remove borders from Telescope windows
|
-- Remove borders from Telescope windows
|
||||||
local prompt = "#2d3149"
|
local prompt = "#2d3149"
|
||||||
hl.TelescopeNormal = {
|
hl.TelescopeNormal = {
|
||||||
bg = c.bg_dark,
|
bg = c.bg_dark,
|
||||||
fg = c.fg_dark,
|
fg = c.fg_dark,
|
||||||
}
|
}
|
||||||
hl.TelescopeBorder = {
|
hl.TelescopeBorder = {
|
||||||
bg = c.bg_dark,
|
bg = c.bg_dark,
|
||||||
fg = c.bg_dark,
|
fg = c.bg_dark,
|
||||||
}
|
}
|
||||||
hl.TelescopePromptNormal = {
|
hl.TelescopePromptNormal = {
|
||||||
bg = prompt,
|
bg = prompt,
|
||||||
}
|
}
|
||||||
hl.TelescopePromptBorder = {
|
hl.TelescopePromptBorder = {
|
||||||
bg = prompt,
|
bg = prompt,
|
||||||
fg = prompt,
|
fg = prompt,
|
||||||
}
|
}
|
||||||
hl.TelescopePromptTitle = {
|
hl.TelescopePromptTitle = {
|
||||||
bg = prompt,
|
bg = prompt,
|
||||||
fg = prompt,
|
fg = prompt,
|
||||||
}
|
}
|
||||||
hl.TelescopePreviewTitle = {
|
hl.TelescopePreviewTitle = {
|
||||||
bg = c.bg_dark,
|
bg = c.bg_dark,
|
||||||
fg = c.bg_dark,
|
fg = c.bg_dark,
|
||||||
}
|
}
|
||||||
hl.TelescopeResultsTitle = {
|
hl.TelescopeResultsTitle = {
|
||||||
bg = c.bg_dark,
|
bg = c.bg_dark,
|
||||||
fg = c.bg_dark,
|
fg = c.bg_dark,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ return {
|
||||||
"editorconfig",
|
"editorconfig",
|
||||||
"http",
|
"http",
|
||||||
"make",
|
"make",
|
||||||
|
"toml",
|
||||||
|
"latex",
|
||||||
|
"sql",
|
||||||
},
|
},
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
|
||||||
|
|
@ -12,5 +12,9 @@ return {
|
||||||
desc = "Diagnostics (Trouble)",
|
desc = "Diagnostics (Trouble)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opts = {},
|
opts = {
|
||||||
|
open_no_results = true,
|
||||||
|
auto_close = true,
|
||||||
|
indent_guides = false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
-- Distraction-free coding when you need it
|
|
||||||
-- https://github.com/folke/zen-mode.nvim
|
|
||||||
return {
|
|
||||||
"folke/zen-mode.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"folke/twilight.nvim",
|
|
||||||
opts = {
|
|
||||||
treesitter = true,
|
|
||||||
context = 2,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
|
||||||
opts = {
|
|
||||||
window = {
|
|
||||||
backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
|
|
||||||
width = 0.75, -- width of the Zen window
|
|
||||||
height = 1, -- height of the Zen window
|
|
||||||
-- by default, no options are changed for the Zen window
|
|
||||||
-- uncomment any of the options below, or add other vim.wo options you want to apply
|
|
||||||
options = {
|
|
||||||
signcolumn = "no", -- disable signcolumn
|
|
||||||
number = false, -- disable number column
|
|
||||||
relativenumber = false, -- disable relative numbers
|
|
||||||
cursorline = false, -- disable cursorline
|
|
||||||
cursorcolumn = false, -- disable cursor column
|
|
||||||
foldcolumn = "0", -- disable fold column
|
|
||||||
list = false, -- disable whitespace characters
|
|
||||||
colorcolumn = "0", -- disable line width indicator
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins = {
|
|
||||||
-- disable some global vim options (vim.o...)
|
|
||||||
-- comment the lines to not apply the options
|
|
||||||
options = {
|
|
||||||
enabled = true,
|
|
||||||
ruler = false, -- disables the ruler text in the cmd line area
|
|
||||||
showcmd = false, -- disables the command in the last line of the screen
|
|
||||||
-- you may turn on/off statusline in zen mode by setting 'laststatus'
|
|
||||||
-- statusline will be shown only if 'laststatus' == 3
|
|
||||||
laststatus = 0, -- turn off the statusline in zen mode
|
|
||||||
},
|
|
||||||
twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
|
|
||||||
gitsigns = { enabled = false }, -- disables git signs
|
|
||||||
-- this will change the font size on alacritty when in zen mode
|
|
||||||
-- requires Alacritty Version 0.10.0 or higher
|
|
||||||
-- uses `alacritty msg` subcommand to change font size
|
|
||||||
alacritty = {
|
|
||||||
enabled = true,
|
|
||||||
font = "20", -- font size
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- callback where you can add custom code when the Zen window opens
|
|
||||||
on_open = function(win) end,
|
|
||||||
-- callback where you can add custom code when the Zen window closes
|
|
||||||
on_close = function() end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +1,14 @@
|
||||||
|
-- LSP activation (references lsp/<filename>
|
||||||
|
vim.lsp.enable({
|
||||||
|
"lua",
|
||||||
|
"go",
|
||||||
|
"terraform",
|
||||||
|
"yaml",
|
||||||
|
"ansible",
|
||||||
|
"marksman",
|
||||||
|
"tailwind",
|
||||||
|
})
|
||||||
|
|
||||||
-- Set highlight on search
|
-- Set highlight on search
|
||||||
vim.opt.hlsearch = true
|
vim.opt.hlsearch = true
|
||||||
|
|
||||||
|
|
@ -48,15 +59,14 @@ vim.opt.cursorline = true
|
||||||
vim.opt.wrap = false
|
vim.opt.wrap = false
|
||||||
|
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
vim.opt.background = "dark" -- light, dark
|
-- vim.opt.background = "dark" -- light, dark
|
||||||
-- Themes:
|
-- Themes:
|
||||||
-- tokyonight-night
|
-- tokyonight-night
|
||||||
-- tokyonight-storm
|
-- tokyonight-storm
|
||||||
-- tokyonight-day
|
-- tokyonight-day
|
||||||
-- tokyonight-moon
|
-- tokyonight-moon
|
||||||
-- vim.cmd.colorscheme("tokyonight-storm")
|
-- vim.cmd.colorscheme("tokyonight-storm")
|
||||||
vim.cmd.colorscheme("rose-pine-dawn")
|
vim.cmd.colorscheme("rose-pine")
|
||||||
-- vim.cmd.colorscheme("newpaper")
|
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.opt.updatetime = 250
|
vim.opt.updatetime = 250
|
||||||
|
|
@ -77,12 +87,38 @@ vim.opt.showmode = false
|
||||||
|
|
||||||
-- Hobo way to to force ansiblels being used for Ansible files
|
-- Hobo way to to force ansiblels being used for Ansible files
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
pattern = {
|
pattern = {
|
||||||
[".*/.*playbook.*.ya?ml"] = "yaml.ansible",
|
[".*/.*playbook.*.ya?ml"] = "yaml.ansible",
|
||||||
[".*/.*tasks.*/.*ya?ml"] = "yaml.ansible",
|
[".*/.*tasks.*/.*ya?ml"] = "yaml.ansible",
|
||||||
[".*/.*group_vars.*/.*ya?ml"] = "yaml.ansible",
|
[".*/.*group_vars.*/.*ya?ml"] = "yaml.ansible",
|
||||||
[".*/.*host_vars.*/.*ya?ml"] = "yaml.ansible",
|
[".*/.*host_vars.*/.*ya?ml"] = "yaml.ansible",
|
||||||
[".*/local.ya?ml"] = "yaml.ansible",
|
[".*/local.ya?ml"] = "yaml.ansible",
|
||||||
[".*-ansible/.*ya?ml"] = "yaml.ansible",
|
[".*-ansible/.*ya?ml"] = "yaml.ansible",
|
||||||
},
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- rounded borders
|
||||||
|
vim.opt.winborder = "rounded"
|
||||||
|
|
||||||
|
-- Inline hints
|
||||||
|
vim.diagnostic.config({
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = "",
|
||||||
|
[vim.diagnostic.severity.WARN] = "",
|
||||||
|
[vim.diagnostic.severity.HINT] = "",
|
||||||
|
[vim.diagnostic.severity.INFO] = "",
|
||||||
|
},
|
||||||
|
-- linehl = {
|
||||||
|
-- [vim.diagnostic.severity.ERROR] = "Error",
|
||||||
|
-- [vim.diagnostic.severity.WARN] = "Warn",
|
||||||
|
-- [vim.diagnostic.severity.INFO] = "Info",
|
||||||
|
-- [vim.diagnostic.severity.HINT] = "Hint",
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
virtual_text = true,
|
||||||
|
virtual_lines = false,
|
||||||
|
-- virtual_lines = {
|
||||||
|
-- current_line = true,
|
||||||
|
-- },
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
-- keyboard shortcuts
|
-- keyboard shortcuts
|
||||||
|
|
||||||
-- Leader key set to space, base for any key combo
|
-- Leader key. Base for any key combo
|
||||||
-- vim.g.mapleader = " "
|
|
||||||
vim.g.mapleader = ";"
|
vim.g.mapleader = ";"
|
||||||
|
|
||||||
--vim.keymap.set("n", "<leader>r", vim.cmd.Ex, { noremap = true, desc = "netrw File Browser" }) -- netrw file explorer
|
|
||||||
--vim.keymap.set("n", "<leader>e", "<cmd>lua require('oil').toggle_float('.')<CR>", { noremap = true, silent = true })
|
|
||||||
vim.keymap.set("n", "<leader>e", ":Oil --float<CR>", { desc = "Oil" })
|
vim.keymap.set("n", "<leader>e", ":Oil --float<CR>", { desc = "Oil" })
|
||||||
|
|
||||||
-- List recently opened files
|
-- List recently opened files
|
||||||
|
|
@ -13,56 +10,45 @@ vim.keymap.set("n", "<leader>fo", ":Telescope oldfiles<CR>", { noremap = true, d
|
||||||
|
|
||||||
-- Find files
|
-- Find files
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader>ff",
|
"<leader>ff",
|
||||||
":Telescope find_files hidden=true no_ignore=false<CR>",
|
":Telescope find_files hidden=true no_ignore=false<CR>",
|
||||||
{ noremap = true, desc = "File search" }
|
{ noremap = true, desc = "File search" }
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Live find string (using ripgrep)
|
-- Live find string (using ripgrep)
|
||||||
vim.keymap.set("n", "<leader>fg", ":Telescope live_grep<CR>", { noremap = true, desc = "Search string" })
|
vim.keymap.set("n", "<leader>fg", ":Telescope live_grep<CR>", { noremap = true, desc = "String search" })
|
||||||
|
|
||||||
-- Find string under cursor (using ripgrep)
|
-- Find string under cursor (using ripgrep)
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader>fs",
|
"<leader>fs",
|
||||||
":Telescope grep_string<CR>",
|
":Telescope grep_string<CR>",
|
||||||
{ noremap = true, desc = "Search text under cursor in cwd/grep search string" }
|
{ noremap = true, desc = "Search text under cursor in cwd/grep search string" }
|
||||||
)
|
)
|
||||||
-- Find string under cursor
|
|
||||||
--vim.keymap.set(
|
|
||||||
-- "n",
|
|
||||||
-- "<leader>fs",
|
|
||||||
-- [[<cmd>lua require('telescope.builtin').grep_string()<cr>]],
|
|
||||||
-- { silent = true, noremap = true }
|
|
||||||
--)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader><leader>", ":Telescope buffers<CR>", { noremap = true, desc = "Show open buffers" })
|
vim.keymap.set("n", "<leader><leader>", ":Telescope buffers<CR>", { noremap = true, desc = "Show open buffers" })
|
||||||
-- todo-comments.nvim
|
-- todo-comments.nvim
|
||||||
vim.keymap.set("n", "<leader>ft", ":TodoTelescope<CR>", { noremap = true, desc = "Find TODOs" })
|
vim.keymap.set("n", "<leader>ft", ":TodoTelescope<CR>", { noremap = true, desc = "Find TODOs" })
|
||||||
--vim.keymap.set("n", "<leader>gs", ":Telescope git_status<CR>", { noremap = true, desc = "Git status" })
|
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader>gla",
|
"<leader>gla",
|
||||||
":Telescope git_commits<CR>",
|
":Telescope git_commits<CR>",
|
||||||
{ noremap = true, desc = "Git log (across all files)" }
|
{ noremap = true, desc = "Git log (across all files)" }
|
||||||
)
|
)
|
||||||
vim.keymap.set("n", "<leader>glf", ":Telescope git_bcommits<CR>", { noremap = true, desc = "Git log (this file)" })
|
vim.keymap.set("n", "<leader>glf", ":Telescope git_bcommits<CR>", { noremap = true, desc = "Git log (this file)" })
|
||||||
--vim.keymap.set("n", "<leader>gdp", ":Gitsigns diffthis<CR>", { noremap = true, desc = "Git diff previous (this file)" })
|
|
||||||
--vim.keymap.set("n", "<leader>gd", ":Gitsigns diffthis<CR>", { noremap = true, desc = "Git diff previous (this file)" })
|
|
||||||
vim.keymap.set("n", "<leader>gd", function()
|
vim.keymap.set("n", "<leader>gd", function()
|
||||||
if next(require("diffview.lib").views) == nil then
|
if next(require("diffview.lib").views) == nil then
|
||||||
vim.cmd("DiffviewOpen")
|
vim.cmd("DiffviewOpen")
|
||||||
else
|
else
|
||||||
vim.cmd("DiffviewClose")
|
vim.cmd("DiffviewClose")
|
||||||
end
|
end
|
||||||
--end, { noremap = true, desc = "Diff this shit" })
|
|
||||||
end, { noremap = true, desc = "Toggle diff/stage UI " })
|
end, { noremap = true, desc = "Toggle diff/stage UI " })
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader>gb",
|
"<leader>gb",
|
||||||
":Gitsigns toggle_current_line_blame<CR>",
|
":Gitsigns toggle_current_line_blame<CR>",
|
||||||
{ noremap = true, desc = "Toggle git blame" }
|
{ noremap = true, desc = "Toggle git blame" }
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Remapping of existing Vim key binds
|
-- Remapping of existing Vim key binds
|
||||||
|
|
@ -72,59 +58,59 @@ vim.keymap.set("n", "b", "B") -- skip punctuation when moving to end of previous
|
||||||
|
|
||||||
--vim.keymap.set("n", "<leader>i", "gg=G``", { noremap = true, desc = "Re-indent whole file" }) -- '``' makes it stay at current line+column position
|
--vim.keymap.set("n", "<leader>i", "gg=G``", { noremap = true, desc = "Re-indent whole file" }) -- '``' makes it stay at current line+column position
|
||||||
|
|
||||||
-- Thank you @ThePrimeagen for those
|
-- Thanks https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua
|
||||||
-- https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua
|
|
||||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -- move whole lines/blocks down in visual mode
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -- move whole lines/blocks down in visual mode
|
||||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") -- move whole lines/blocks up in visual mode
|
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") -- move whole lines/blocks up in visual mode
|
||||||
|
vim.keymap.set("n", "<C-d>", "<C-d>zz") -- eye-friendly down scrolling
|
||||||
vim.keymap.set("n", "<C-d>", "<C-d>zz") -- eye-friendly down scrolling
|
vim.keymap.set("n", "<C-u>", "<C-u>zz") -- eye-friendly up scrolling
|
||||||
vim.keymap.set("n", "<C-u>", "<C-u>zz") -- eye-friendly up scrolling
|
vim.keymap.set("n", "J", "mzJ`z") -- when merging lines, keep cursor at current position
|
||||||
|
|
||||||
vim.keymap.set("n", "J", "mzJ`z") -- when merging lines, keep cursor at current position
|
|
||||||
|
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader>s",
|
"<leader>s",
|
||||||
[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
|
[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
|
||||||
{ noremap = true, desc = "Replace word below cursor" }
|
{ noremap = true, desc = "Replace word below cursor" }
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Apply conform.nvim formatting on keypress (same as on save)
|
-- Apply conform.nvim formatting on keypress (same as on save)
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>o", function()
|
vim.keymap.set({ "n", "v" }, "<leader>o", function()
|
||||||
local conform = require("conform")
|
local conform = require("conform")
|
||||||
conform.format({
|
conform.format({
|
||||||
lsp_fallback = true,
|
lsp_fallback = true,
|
||||||
async = false,
|
async = false,
|
||||||
timeout_ms = 500,
|
timeout_ms = 500,
|
||||||
})
|
})
|
||||||
end, { desc = "Format file or range (in visual mode)" })
|
end, { desc = "Format file or range (in visual mode)" })
|
||||||
|
|
||||||
-- Toggle zen-mode.nvim
|
|
||||||
vim.keymap.set("n", "<leader>z", ":ZenMode<CR>")
|
|
||||||
|
|
||||||
-- Go to next diagnostic item (any severity)
|
-- Go to next diagnostic item (any severity)
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>da", function()
|
vim.keymap.set({ "n", "v" }, "<leader>da", function()
|
||||||
vim.diagnostic.goto_next({})
|
vim.diagnostic.get_next({})
|
||||||
vim.api.nvim_feedkeys("zz", "n", false)
|
vim.api.nvim_feedkeys("zz", "n", false)
|
||||||
end, { desc = "Go to next diagnostic" })
|
end, { desc = "Go to next diagnostic" })
|
||||||
|
|
||||||
-- Go to next diagnostic item (error severity)
|
-- Go to next diagnostic item (error severity)
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>de", function()
|
vim.keymap.set({ "n", "v" }, "<leader>de", function()
|
||||||
vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR })
|
vim.diagnostic.get_next({ severity = vim.diagnostic.severity.ERROR })
|
||||||
vim.api.nvim_feedkeys("zz", "n", false)
|
vim.api.nvim_feedkeys("zz", "n", false)
|
||||||
end, { desc = "Go to next error diagnostic" })
|
end, { desc = "Go to next error diagnostic" })
|
||||||
|
|
||||||
-- Go to next diagnostic item (warning severity)
|
-- Go to next diagnostic item (warning severity)
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>dw", function()
|
vim.keymap.set({ "n", "v" }, "<leader>dw", function()
|
||||||
vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.WARN })
|
vim.diagnostic.get_next({ severity = vim.diagnostic.severity.WARN })
|
||||||
vim.api.nvim_feedkeys("zz", "n", false)
|
vim.api.nvim_feedkeys("zz", "n", false)
|
||||||
end, { desc = "Go to next warning diagnostic" })
|
end, { desc = "Go to next warning diagnostic" })
|
||||||
|
|
||||||
-- Toggle LSP diagnostics
|
-- Toggle LSP diagnostics
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>dd", function()
|
vim.keymap.set({ "n", "v" }, "<leader>dd", function()
|
||||||
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
|
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
|
||||||
end, { desc = "Turn diagnostics on/off" })
|
end, { desc = "Turn diagnostics on/off" })
|
||||||
|
|
||||||
-- Toggle trouble (for document)
|
-- By default, show virtual_text and hide virtual_lines.
|
||||||
--vim.keymap.set("n", "<leader>qq", ":TroubleToggle<CR>")
|
-- This keymap allows to do the opposite. Can be useful when there are multiple
|
||||||
--vim.keymap.set("n", "<leader>qq", "<cmd>Trouble diagnostics toggle<cr>")
|
-- severities on the same line
|
||||||
|
vim.keymap.set("n", "<leader>tdd", function()
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_lines = not vim.diagnostic.config().virtual_lines,
|
||||||
|
virtual_text = not vim.diagnostic.config().virtual_text,
|
||||||
|
})
|
||||||
|
end, { desc = "Toggle diagnostic virtual lines and virtual text" })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue