Created
December 17, 2025 20:37
-
-
Save ljahier/d230be8b149c43c97cc2a10951a06bc9 to your computer and use it in GitHub Desktop.
~/.config/nvim/init.lua - my neovim 0.11+ config
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 = " " | |
| local opt = vim.opt | |
| opt.termguicolors = true | |
| opt.number = true | |
| opt.clipboard = "unnamedplus" | |
| opt.expandtab = true | |
| opt.smartindent = true | |
| opt.splitright = true | |
| opt.splitbelow = true | |
| opt.undofile = true | |
| opt.signcolumn = "yes" | |
| opt.colorcolumn = "100" | |
| opt.scroll = 1 | |
| opt.scrolloff = 0 | |
| opt.wrap = true | |
| opt.linebreak = true | |
| opt.list = true | |
| opt.listchars = { space = "·" } | |
| opt.fillchars = { vert = " " } | |
| vim.diagnostic.config({ | |
| virtual_text = true, | |
| signs = true, | |
| underline = true, | |
| update_in_insert = false, | |
| }) | |
| vim.lsp.config("rust_analyzer", { | |
| settings = { | |
| ["rust-analyzer"] = { | |
| check = { command = "clippy" }, | |
| rustfmt = { extraArgs = { "+nightly" } }, | |
| inlayHints = { enable = true, parameterHints = { enable = true }, typeHints = { enable = true } }, | |
| completion = { | |
| autoimport = { enable = false }, | |
| fullFunctionSignatures = { enable = true }, | |
| privateEditable = { enable = true }, | |
| postfix = { enable = false }, | |
| callable = { snippets = "none" }, | |
| limit = 30, | |
| }, | |
| }, | |
| }, | |
| }) | |
| vim.lsp.enable("rust_analyzer") | |
| vim.api.nvim_create_autocmd("LspAttach", { | |
| callback = function(args) | |
| local client = vim.lsp.get_client_by_id(args.data.client_id) | |
| local bufnr = args.buf | |
| if client.server_capabilities.inlayHintProvider then | |
| vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) | |
| end | |
| vim.api.nvim_create_autocmd("BufWritePre", { | |
| buffer = bufnr, | |
| callback = function() vim.lsp.buf.format({ async = false }) end, | |
| }) | |
| end, | |
| }) | |
| vim.api.nvim_create_autocmd("BufWritePre", { | |
| pattern = "*", | |
| callback = function() | |
| local pos = vim.api.nvim_win_get_cursor(0) | |
| vim.cmd([[%s/\s\+$//e]]) | |
| vim.api.nvim_win_set_cursor(0, pos) | |
| end, | |
| }) | |
| local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | |
| if not vim.uv.fs_stat(lazypath) then | |
| vim.fn.system({ "git", "clone", "--filter=blob:none", | |
| "https://github.com/folke/lazy.nvim.git", lazypath }) | |
| end | |
| vim.opt.rtp:prepend(lazypath) | |
| require("lazy").setup({ | |
| { | |
| "shaunsingh/nord.nvim", | |
| priority = 1000, | |
| config = function() | |
| vim.cmd.colorscheme("nord") | |
| vim.api.nvim_set_hl(0, "LspInlayHint", { link = "Comment" }) | |
| end, | |
| }, | |
| { | |
| "nvim-treesitter/nvim-treesitter", | |
| build = ":TSUpdate", | |
| config = function() | |
| require("nvim-treesitter.configs").setup({ | |
| ensure_installed = { "rust", "lua" }, | |
| highlight = { enable = true }, | |
| indent = { enable = true }, | |
| }) | |
| end, | |
| }, | |
| { "neovim/nvim-lspconfig" }, | |
| { | |
| "hrsh7th/nvim-cmp", | |
| event = "InsertEnter", | |
| dependencies = { "hrsh7th/cmp-nvim-lsp" }, | |
| config = function() | |
| local cmp = require("cmp") | |
| cmp.setup({ | |
| window = { | |
| completion = cmp.config.window.bordered({ border = "rounded" }), | |
| documentation = cmp.config.window.bordered({ border = "rounded" }), | |
| }, | |
| sources = { | |
| { name = "nvim_lsp", priority = 1000 }, | |
| }, | |
| sorting = { | |
| priority_weight = 2, | |
| comparators = { | |
| cmp.config.compare.exact, | |
| cmp.config.compare.score, | |
| cmp.config.compare.locality, | |
| cmp.config.compare.kind, | |
| cmp.config.compare.recently_used, | |
| cmp.config.compare.offset, | |
| cmp.config.compare.order, | |
| }, | |
| }, | |
| }) | |
| end, | |
| }, | |
| { | |
| "nvim-telescope/telescope.nvim", | |
| dependencies = { | |
| "nvim-lua/plenary.nvim", | |
| "nvim-telescope/telescope-file-browser.nvim", | |
| { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, | |
| }, | |
| config = function() | |
| require("telescope").setup({ | |
| defaults = { | |
| sorting_strategy = "ascending", | |
| layout_config = { prompt_position = "top" }, | |
| file_ignore_patterns = { "node_modules", ".git/", "target/" }, | |
| mappings = { | |
| i = { ["<Esc>"] = require("telescope.actions").close }, | |
| }, | |
| }, | |
| pickers = { | |
| find_files = { hidden = true, find_command = { "rg", "--files", "--hidden", "-g", "!.git" } }, | |
| }, | |
| extensions = { | |
| file_browser = { | |
| hidden = true, | |
| respect_gitignore = false, | |
| grouped = true, | |
| dir_icon = "", | |
| }, | |
| fzf = { | |
| fuzzy = true, | |
| override_generic_sorter = true, | |
| override_file_sorter = true, | |
| }, | |
| }, | |
| }) | |
| require("telescope").load_extension("file_browser") | |
| require("telescope").load_extension("fzf") | |
| end, | |
| }, | |
| { "github/copilot.vim" }, | |
| { | |
| "linrongbin16/lsp-progress.nvim", | |
| config = true, | |
| }, | |
| { | |
| "nvim-lualine/lualine.nvim", | |
| dependencies = { "linrongbin16/lsp-progress.nvim" }, | |
| opts = { | |
| options = { | |
| theme = "nord", | |
| section_separators = "", | |
| component_separators = "", | |
| }, | |
| sections = { | |
| lualine_a = { "mode" }, | |
| lualine_b = { "branch" }, | |
| lualine_c = { function() return require("lsp-progress").progress() end }, | |
| lualine_x = { { "filename", path = 1 }, "diagnostics", "filetype" }, | |
| lualine_y = { "progress" }, | |
| lualine_z = { "location" }, | |
| }, | |
| }, | |
| }, | |
| { | |
| "ray-x/lsp_signature.nvim", | |
| event = "LspAttach", | |
| opts = { | |
| bind = true, | |
| hint_enable = false, | |
| floating_window = true, | |
| floating_window_above_cur_line = true, | |
| max_width = 80, | |
| handler_opts = { border = "rounded" }, | |
| toggle_key = "<C-k>", | |
| }, | |
| }, | |
| { | |
| "folke/which-key.nvim", | |
| event = "VeryLazy", | |
| opts = { preset = "helix" }, | |
| }, | |
| { | |
| "smoka7/hop.nvim", | |
| version = "*", | |
| config = function() | |
| require("hop").setup({ | |
| keys = "arstneio", | |
| quit_key = "<Esc>", | |
| multi_windows = false, | |
| }) | |
| vim.api.nvim_set_hl(0, "HopNextKey", { link = "WarningMsg" }) | |
| vim.api.nvim_set_hl(0, "HopNextKey1", { link = "WarningMsg" }) | |
| vim.api.nvim_set_hl(0, "HopNextKey2", { link = "Comment" }) | |
| end, | |
| keys = { | |
| { "gw", mode = { "n", "x", "o" }, function() require("hop").hint_words() end, desc = "Jump to word" }, | |
| }, | |
| }, | |
| }) | |
| local map = vim.keymap.set | |
| map("n", "ff", "<cmd>Telescope find_files<cr>", { desc = "Find files" }) | |
| map("n", "<leader>f", "<cmd>Telescope find_files<cr>", { desc = "Find files" }) | |
| map("n", "fg", "<cmd>Telescope live_grep<cr>", { desc = "Grep" }) | |
| map("n", "fb", "<cmd>Telescope buffers<cr>", { desc = "Buffers" }) | |
| map("n", "<S-e>", function() | |
| require("telescope").extensions.file_browser.file_browser({ | |
| path = vim.fn.expand("%:p:h"), | |
| select_buffer = true, | |
| }) | |
| end, { desc = "File browser" }) | |
| map("n", "gd", vim.lsp.buf.definition, { desc = "Definition" }) | |
| map("n", "gr", vim.lsp.buf.references, { desc = "References" }) | |
| map("n", "K", vim.lsp.buf.hover, { desc = "Hover" }) | |
| map("n", "<leader>rn", vim.lsp.buf.rename, { desc = "Rename" }) | |
| map("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Code action" }) | |
| map("n", "[d", vim.diagnostic.goto_prev, { desc = "Prev diagnostic" }) | |
| map("n", "]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" }) | |
| map("n", "<leader>c", "<cmd>bdelete<cr>", { desc = "Close buffer" }) | |
| map("n", "<leader>t", "<cmd>write<cr>", { desc = "Save" }) | |
| map("n", "<leader>q", "<cmd>quit<cr>", { desc = "Quit" }) | |
| map("n", "<leader><leader>", "<C-^>", { desc = "Last file" }) | |
| map("n", "<leader>w<Left>", "<C-w>h", { desc = "Left pane" }) | |
| map("n", "<leader>w<Right>", "<C-w>l", { desc = "Right pane" }) | |
| map("n", "<leader>w<Up>", "<C-w>k", { desc = "Upper pane" }) | |
| map("n", "<leader>w<Down>", "<C-w>j", { desc = "Lower pane" }) | |
| map("n", "<S-Right>", "e", { desc = "Next word" }) | |
| map("n", "<S-Left>", "b", { desc = "Prev word" }) | |
| map("v", "<S-Right>", "e", { desc = "Extend next word" }) | |
| map("v", "<S-Left>", "b", { desc = "Extend prev word" }) | |
| map("i", "<S-Right>", "<C-o>e<C-o>a", { desc = "Next word" }) | |
| map("i", "<S-Left>", "<C-o>b", { desc = "Prev word" }) | |
| map("n", "gh", "^", { desc = "Line start" }) | |
| map("n", "gl", "$", { desc = "Line end" }) | |
| map("v", "gh", "^", { desc = "Line start" }) | |
| map("v", "gl", "$", { desc = "Line end" }) | |
| map("n", "x", "V", { desc = "Select line" }) | |
| map("n", "<Esc>", "<cmd>nohlsearch<cr>", { desc = "Clear highlights" }) | |
| map("n", "<C-d>", "<C-e>", { desc = "Scroll down" }) | |
| map("n", "<C-u>", "<C-y>", { desc = "Scroll up" }) | |
| map("n", "<ScrollWheelDown>", "<C-e>", { desc = "Scroll down" }) | |
| map("n", "<ScrollWheelUp>", "<C-y>", { desc = "Scroll up" }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment