Created
November 1, 2025 22:52
-
-
Save gpiancastelli/daf385eb88613826abc4d3310513d2b2 to your computer and use it in GitHub Desktop.
Neovim configuration work-in-progress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "runtime.version": "LuaJIT", | |
| "runtime.path": [ | |
| "lua/?.lua", | |
| "lua/?/init.lua" | |
| ], | |
| "diagnostics.globals": ["vim"], | |
| "workspace.checkThirdParty": false, | |
| "workspace.library": [ | |
| "$VIMRUNTIME" | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vim.g.mapleader = ' ' | |
| vim.g.maplocalleader = ' ' | |
| vim.o.number = true | |
| vim.o.relativenumber = true | |
| vim.o.signcolumn = "yes" | |
| vim.o.cursorline = true | |
| vim.o.tabstop = 4 | |
| vim.o.softtabstop = 4 | |
| vim.o.shiftwidth = 4 | |
| vim.o.expandtab = true | |
| -- Case-insensitive searching unless \C or one or more capital letters in the search term | |
| vim.o.ignorecase = true | |
| vim.o.smartcase = true | |
| -- Clear highlights on search when pressing <Esc> in normal mode | |
| vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') | |
| -- Shortcuts to interact with the system clipboard | |
| vim.keymap.set('n', '<leader>p', '"+p') | |
| vim.keymap.set('v', '<leader>y', '"+y') | |
| -- Prettify/Minify JSON using jq | |
| vim.keymap.set('n', '<leader>jp', '<cmd>%!jq<CR>') | |
| vim.keymap.set('n', '<leader>jm', '<cmd>%!jq -c<CR>') | |
| -- Prettify/Minify XML using xmllint | |
| vim.keymap.set('n', '<leader>xp', '<cmd>%!xmllint --format -<CR>') | |
| vim.keymap.set('n', '<leader>xm', '<cmd>%!xmllint --noblanks -<CR>') | |
| vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") | |
| vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") | |
| -- LSP configurations | |
| vim.lsp.enable('lua_ls') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ---@brief | |
| --- | |
| --- https://github.com/luals/lua-language-server | |
| --- | |
| --- Lua language server. | |
| --- | |
| --- `lua-language-server` can be installed by following the instructions [here](https://luals.github.io/#neovim-install). | |
| --- | |
| --- The default `cmd` assumes that the `lua-language-server` binary can be found in `$PATH`. | |
| --- | |
| --- If you primarily use `lua-language-server` for Neovim, and want to provide completions, | |
| --- analysis, and location handling for plugins on runtime path, you can use the following | |
| --- settings. | |
| --- | |
| --- ```lua | |
| --- vim.lsp.config('lua_ls', { | |
| --- on_init = function(client) | |
| --- if client.workspace_folders then | |
| --- local path = client.workspace_folders[1].name | |
| --- if | |
| --- path ~= vim.fn.stdpath('config') | |
| --- and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) | |
| --- then | |
| --- return | |
| --- end | |
| --- end | |
| --- | |
| --- client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { | |
| --- runtime = { | |
| --- -- Tell the language server which version of Lua you're using (most | |
| --- -- likely LuaJIT in the case of Neovim) | |
| --- version = 'LuaJIT', | |
| --- -- Tell the language server how to find Lua modules same way as Neovim | |
| --- -- (see `:h lua-module-load`) | |
| --- path = { | |
| --- 'lua/?.lua', | |
| --- 'lua/?/init.lua', | |
| --- }, | |
| --- }, | |
| --- -- Make the server aware of Neovim runtime files | |
| --- workspace = { | |
| --- checkThirdParty = false, | |
| --- library = { | |
| --- vim.env.VIMRUNTIME | |
| --- -- Depending on the usage, you might want to add additional paths | |
| --- -- here. | |
| --- -- '${3rd}/luv/library' | |
| --- -- '${3rd}/busted/library' | |
| --- } | |
| --- -- Or pull in all of 'runtimepath'. | |
| --- -- NOTE: this is a lot slower and will cause issues when working on | |
| --- -- your own configuration. | |
| --- -- See https://github.com/neovim/nvim-lspconfig/issues/3189 | |
| --- -- library = { | |
| --- -- vim.api.nvim_get_runtime_file('', true), | |
| --- -- } | |
| --- } | |
| --- }) | |
| --- end, | |
| --- settings = { | |
| --- Lua = {} | |
| --- } | |
| --- }) | |
| --- ``` | |
| --- | |
| --- See `lua-language-server`'s [documentation](https://luals.github.io/wiki/settings/) for an explanation of the above fields: | |
| --- * [Lua.runtime.path](https://luals.github.io/wiki/settings/#runtimepath) | |
| --- * [Lua.workspace.library](https://luals.github.io/wiki/settings/#workspacelibrary) | |
| --- | |
| ---@type vim.lsp.Config | |
| return { | |
| cmd = { 'lua-language-server' }, | |
| filetypes = { 'lua' }, | |
| root_markers = { | |
| '.luarc.json', | |
| '.luarc.jsonc', | |
| '.luacheckrc', | |
| '.stylua.toml', | |
| 'stylua.toml', | |
| 'selene.toml', | |
| 'selene.yml', | |
| '.git', | |
| }, | |
| } |
monlay6375-code
commented
Nov 1, 2025
<script src="https://gist.github.com/gpiancastelli/daf385eb88613826abc4d3310513d2b2.js"></script>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment