feat: switch to native 0.11 LSP, remove obsolete things

This commit is contained in:
Oliver Ladner 2025-04-01 10:53:48 +02:00
commit e2d27c98c1
24 changed files with 311 additions and 475 deletions

7
.luarc.json Normal file
View file

@ -0,0 +1,7 @@
{
"runtime.version": "LuaJIT",
"runtime.path": ["lua/?.lua", "lua/?/init.lua"],
"diagnostics.globals": ["vim"],
"workspace.checkThirdParty": false,
"workspace.library": ["$VIMRUNTIME"]
}

View file

@ -4,6 +4,7 @@
- `;` leader key
- `: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
- `:Lazy` show package manager UI
- `:Mason` show Mason UI
@ -49,6 +50,7 @@
- `Ctrl`+`l` accept selected suggestion
- `gd` go to definition
- `gr` show references of function
- `grn` renames all refs of the symbol under cursor
- `leader`+`q` toggle `trouble.nvim` quickfix list
- `leader`+`da` go to next diagnostic (any severity)
- `leader`+`dw` go to next diagnostic (_warning_ severity)

View file

@ -29,34 +29,26 @@ It's not too important. Still, I try to balance increasing startup time with
the usefullness of a plugin.
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
Around 10% of the plugins are lazy-loaded.
Around 15% of the plugins are lazy-loaded.
```bash
Startuptime: 96.76ms
Based on the actual CPU time of the Neovim process till UIEnter.
This is more accurate than `nvim --startuptime`.
LazyStart 13.3ms
LazyDone 41.06ms (+27.76ms)
UIEnter 96.76ms (+55.71ms)
LazyStart 14.64ms
LazyDone 59.11ms (+44.48ms)
UIEnter 119.52ms (+60.41ms)
```
### Starting with an empty file
Around 50% of the plugins are lazy-loaded.
Around 40% of the plugins are lazy-loaded.
```bash
Startuptime: 49.82ms
Based on the actual CPU time of the Neovim process till UIEnter.
This is more accurate than `nvim --startuptime`.
LazyStart 13.75ms
LazyDone 40.39ms (+26.64ms)
UIEnter 49.82ms (+9.43ms)
LazyStart 14.37ms
LazyDone 60.18ms (+45.81ms)
UIEnter 74.45ms (+14.27ms)
```
## 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-textobjects** | ? | <https://github.com/nvim-treesitter/nvim-treesitter-textobjects> |
| **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> |
| **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> |
| **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> |
| **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> |
| **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> |
| **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> |
| **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

View file

@ -1,6 +1,8 @@
--[[
My simple(TM) Neovim configuration. Made from scratch, inspired by
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
- ripgrep (https://github.com/BurntSushi/ripgrep, used by telescope)
@ -24,5 +26,5 @@ Then run "make" in your users telescope-fzf-native plugin directory:
C:\Users\foobar\AppData\Local\nvim-data\lazy\telescope-fzf-native.nvim
--]]
-- Include customized configuration
-- Include my custom configuration
require("weeheavy")

View file

@ -1,39 +1,30 @@
{
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
"auto-dark-mode.nvim": { "branch": "master", "commit": "c31de126963ffe9403901b4b0990dde0e6999cc6" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" },
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
"copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" },
"copilot.lua": { "branch": "master", "commit": "886ee73b6d464b2b3e3e6a7ff55ce87feac423a9" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
"gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"gitsigns.nvim": { "branch": "main", "commit": "3c76f7fabac723aa682365ef782f88a83ccdb4ac" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lsp-zero.nvim": { "branch": "v4.x", "commit": "baff1ca10ecad7efe04f02f06d2647dd2ae90074" },
"lualine.nvim": { "branch": "master", "commit": "b8b60c7f1d0d95ad74ee215b2291280b30482476" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" },
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
"mini.nvim": { "branch": "main", "commit": "88f18a7d018d8bb4d32f6be4c712134a10e826d3" },
"mini.nvim": { "branch": "main", "commit": "d0464ced00abfd9bbed196fa36ccf3b1691c6b2c" },
"newpaper.nvim": { "branch": "main", "commit": "d8f2a29001f795a59e4f28713427c200c15449ea" },
"nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" },
"nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" },
"nvim-lspconfig": { "branch": "master", "commit": "2574ad38c6ee4f0bef3a1ca305cd5df627a52bb3" },
"nvim-treesitter": { "branch": "master", "commit": "d76a8b6e1b67fd3bcffec4a5d45fd9dee4dbbee8" },
"nvim-treesitter-context": { "branch": "master", "commit": "572e534c9f881bb9bf9f388e4c87f360446c72d4" },
"nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" },
"nvim-treesitter": { "branch": "master", "commit": "9be6836ebeb88a536055bf1ce0961eef68da4bc6" },
"nvim-treesitter-context": { "branch": "master", "commit": "93b29a32d5f4be10e39226c6b796f28d68a8b483" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" },
"nvim-web-devicons": { "branch": "master", "commit": "d0cafff5c4347a604a07edf7bb9a91fda7eb577e" },
"oil.nvim": { "branch": "master", "commit": "548587d68b55e632d8a69c92cefd981f360634fa" },
"nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" },
"oil.nvim": { "branch": "master", "commit": "302bbaceeafc690e6419e0c8296e804d60cb9446" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rose-pine": { "branch": "main", "commit": "7d1b5c7dcd274921f0f58e90a8bf935f6a95fbf3" },
"smear-cursor.nvim": { "branch": "main", "commit": "81638007bf7bbe79a78a3bfcbe8c640ec83344c0" },
"rose-pine": { "branch": "main", "commit": "96ff3993a67356ee85d1cdab9be652cdc1c5d1ac" },
"snipe.nvim": { "branch": "main", "commit": "f43a1f0090de03d48ce5c55df630c1aa4d0b4291" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"tokyonight.nvim": { "branch": "main", "commit": "b262293ef481b0d1f7a14c708ea7ca649672e200" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
"vim-illuminate": { "branch": "master", "commit": "19cb21f513fc2b02f0c66be70107741e837516a1" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

28
lsp/ansible.lua Normal file
View 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
View 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
View 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
View file

@ -0,0 +1,6 @@
---@type vim.lsp.Config
return {
cmd = { "marksman" },
root_markers = { ".md" },
filetypes = { "markdown" },
}

6
lsp/terraform.lua Normal file
View file

@ -0,0 +1,6 @@
---@type vim.lsp.Config
return {
cmd = { "terraform-ls", "serve" },
root_markers = { "go.work", "go.mod", ".git" },
filetypes = { "terraform" },
}

5
lsp/yaml.lua Normal file
View file

@ -0,0 +1,5 @@
---@type vim.lsp.Config
return {
filetypes = { "yaml" },
cmd = { "yaml-language-server", "--stdio" },
}

View file

@ -1,23 +1,60 @@
-- Highlight yanked text on e.g. yy,yap etc.
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("weeheavy-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
-- Native autocompletion
-- vim.api.nvim_create_autocmd("LspAttach", {
-- callback = function(ev)
-- local client = vim.lsp.get_client_by_id(ev.data.client_id)
-- if client:supports_method("textDocument/completion") then
-- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
-- end
-- end,
-- })
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", {
pattern = "trouble",
callback = function()
vim.opt.colorcolumn = ""
end,
-- Highlight yanked text on e.g. yy,yap etc.
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("weeheavy-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- https://github.com/LazyVim/LazyVim/discussions/654
vim.api.nvim_create_autocmd("FileType", {
pattern = "terraform",
callback = function()
vim.bo.commentstring = "# %s"
end,
pattern = "terraform",
callback = function()
vim.bo.commentstring = "# %s"
end,
})

View file

@ -1,23 +0,0 @@
-- https://github.com/f-person/auto-dark-mode.nvim
return {
"f-person/auto-dark-mode.nvim",
enabled = false,
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,
}

View file

@ -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,
}

View file

@ -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,
}

View file

@ -0,0 +1,59 @@
return {
"saghen/blink.cmp",
-- 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" },
}

View file

@ -1,35 +1,36 @@
-- Some things are from https://www.josean.com/posts/neovim-linting-and-formatting
return {
"stevearc/conform.nvim",
tag = "stable",
opts = {},
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
svelte = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
sh = { "shfmt" },
terraform = { "tflint" },
hcl = { "hclfmt" },
},
stop_after_first = false,
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000, -- default: 1000
},
})
end,
"stevearc/conform.nvim",
enabled = true,
tag = "stable",
opts = {},
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
svelte = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
sh = { "shfmt" },
terraform = { "tflint" },
hcl = { "hclfmt" },
},
stop_after_first = false,
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000, -- default: 1000
},
})
end,
}

View file

@ -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,
}

View file

@ -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,
},
}

View file

@ -0,0 +1,6 @@
return {
"williamboman/mason.nvim",
tag = "stable",
lazy = false,
config = true,
}

View file

@ -1,24 +0,0 @@
return {
"sphamba/smear-cursor.nvim",
enabled = false,
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,
},
}

View file

@ -1,13 +1,20 @@
return {
"rose-pine/neovim",
name = "rose-pine",
branch = "main",
lazy = false,
enabled = true,
priority = 1000,
opts = {
styles = {
transparency = true,
},
},
"rose-pine/neovim",
name = "rose-pine",
branch = "main",
lazy = false,
enabled = true,
priority = 1000,
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,
},
}

View file

@ -1,58 +0,0 @@
-- Distraction-free coding when you need it
-- https://github.com/folke/zen-mode.nvim
return {
"folke/zen-mode.nvim",
enabled = false,
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,
},
}

View file

@ -1,3 +1,13 @@
-- LSP activation (references lsp/<filename>
vim.lsp.enable({
"lua",
"go",
"terraform",
"yaml",
"ansible",
"marksman",
})
-- Set highlight on search
vim.opt.hlsearch = true
@ -48,15 +58,14 @@ vim.opt.cursorline = true
vim.opt.wrap = false
vim.opt.termguicolors = true
vim.opt.background = "dark" -- light, dark
-- vim.opt.background = "dark" -- light, dark
-- Themes:
-- tokyonight-night
-- tokyonight-storm
-- tokyonight-day
-- tokyonight-moon
-- vim.cmd.colorscheme("tokyonight-storm")
vim.cmd.colorscheme("rose-pine-dawn")
-- vim.cmd.colorscheme("newpaper")
vim.cmd.colorscheme("rose-pine")
-- Decrease update time
vim.opt.updatetime = 250
@ -77,12 +86,33 @@ vim.opt.showmode = false
-- Hobo way to to force ansiblels being used for Ansible files
vim.filetype.add({
pattern = {
[".*/.*playbook.*.ya?ml"] = "yaml.ansible",
[".*/.*tasks.*/.*ya?ml"] = "yaml.ansible",
[".*/.*group_vars.*/.*ya?ml"] = "yaml.ansible",
[".*/.*host_vars.*/.*ya?ml"] = "yaml.ansible",
[".*/local.ya?ml"] = "yaml.ansible",
[".*-ansible/.*ya?ml"] = "yaml.ansible",
},
pattern = {
[".*/.*playbook.*.ya?ml"] = "yaml.ansible",
[".*/.*tasks.*/.*ya?ml"] = "yaml.ansible",
[".*/.*group_vars.*/.*ya?ml"] = "yaml.ansible",
[".*/.*host_vars.*/.*ya?ml"] = "yaml.ansible",
[".*/local.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] = "",
},
},
-- virtual_text = { current_line = true },
-- virtual_lines = true,
-- virtual_text = true,
virtual_lines = {
current_line = true,
},
})