Created
January 28, 2026 18:27
-
-
Save toruticas/4a8e8136df7ca52435b36e754dca8b7f to your computer and use it in GitHub Desktop.
Neo vim 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
| -- ~/.config/nvim/init.lua | |
| require("config.lazy") | |
| -- Basic settings | |
| vim.opt.hlsearch = true | |
| vim.opt.number = true | |
| vim.opt.mouse = "a" | |
| vim.opt.showmode = false | |
| vim.opt.spelllang = "en_US" | |
| vim.opt.list = true | |
| vim.opt.listchars:append("eol:⏎,tab:>-,trail:·,extends:>,precedes:<") | |
| --" Define the list of invisible characters | |
| --set listchars=eol:⏎,tab:>-,trail:·,extends:>,precedes:< | |
| -- Use system clipboard | |
| vim.opt.clipboard:append({ "unnamed", "unnamedplus" }) | |
| -- Display settings | |
| vim.opt.termguicolors = true | |
| vim.o.background = "dark" -- set to "dark" for dark theme | |
| -- Scrolling and UI settings | |
| vim.opt.cursorline = true | |
| vim.opt.cursorcolumn = true | |
| vim.opt.signcolumn = 'yes' | |
| vim.opt.wrap = false | |
| vim.opt.sidescrolloff = 8 | |
| vim.opt.scrolloff = 8 | |
| -- Title | |
| vim.opt.title = true | |
| vim.opt.titlestring = "nvim" | |
| -- Persist undo (persists your undo history between sessions) | |
| vim.opt.undodir = vim.fn.stdpath("cache") .. "/undo" | |
| vim.opt.undofile = true | |
| -- Tab stuff | |
| vim.opt.tabstop = 2 | |
| vim.opt.shiftwidth = 2 | |
| vim.opt.expandtab = true | |
| vim.opt.autoindent = true | |
| -- Search configuration | |
| vim.opt.ignorecase = true | |
| vim.opt.smartcase = true | |
| vim.opt.gdefault = true | |
| -- open new split panes to right and below (as you probably expect) | |
| vim.opt.splitright = true | |
| vim.opt.splitbelow = true | |
| -- LSP | |
| vim.lsp.inlay_hint.enable(true) | |
| vim.cmd('colorscheme gruvbox') | |
| -- FZF key mappings | |
| vim.keymap.set('n', '<C-p>', ':FZF<CR>') | |
| vim.keymap.set('n', '<C-o>', ':Files %:p:h/<CR>') | |
| vim.keymap.set('n', '<C-i>', ':Buffers<CR>') | |
| vim.keymap.set('n', '<C-f>', ':Rg!') | |
| -- Better navigation in insert mode | |
| vim.keymap.set('i', '<C-k>', '<C-o>gk') | |
| vim.keymap.set('i', '<C-h>', '<Left>') | |
| vim.keymap.set('i', '<C-l>', '<Right>') | |
| vim.keymap.set('i', '<C-j>', '<C-o>gj') | |
| -- Better window navigation in normal and visual modes | |
| vim.keymap.set({ 'n', 'v' }, '<C-h>', '<C-w>h') | |
| vim.keymap.set({ 'n', 'v' }, '<C-j>', '<C-w>j') | |
| vim.keymap.set({ 'n', 'v' }, '<C-k>', '<C-w>k') | |
| vim.keymap.set({ 'n', 'v' }, '<C-l>', '<C-w>l') | |
| -- Stay in indent mode when indenting in visual mode | |
| vim.keymap.set('n', 'o', 'o<Esc>') | |
| vim.keymap.set('n', 'O', 'O<Esc>') | |
| -- [FZF] Define the fuzzy finder command | |
| vim.g.FZF_DEFAULT_COMMAND = "fd --hidden --type f" | |
| vim.g.FZF_CTRL_T_COMMAND = vim.g.FZF_DEFAULT_COMMAND | |
| -- " Copies just the filename to the clipboard | |
| vim.keymap.set('n', '<leader>fs', ':let @*=expand("%")<CR>', { desc = "Copy filename to clipboard" }) | |
| vim.keymap.set('n', '<leader>fl', ':let @*=expand("%:p")<CR>', { desc = "Copy full file path to clipboard" }) | |
| vim.keymap.set('n', '<leader>fh', ':let @*=expand("%:h")<CR>', { desc = "Copy file directory to clipboard" }) | |
| -- " Split and go to definition | |
| vim.keymap.set('n', '<C-W><C-F>', '<C-W>vgf') | |
| require("mason").setup() | |
| require("mason-lspconfig").setup({ | |
| ensure_installed = { | |
| "basedpyright", | |
| "pylsp", | |
| "eslint", | |
| "ruff", | |
| "rust_analyzer", | |
| -- "typescript-language-server", | |
| }, | |
| }) | |
| vim.lsp.config('pylsp', { | |
| settings = { | |
| pylsp = { | |
| plugins = {}, | |
| configurationSources = { "pycodestyle" }, | |
| -- Dynamically set pythonPath | |
| python = { | |
| pythonPath = (function() | |
| local venv = os.getenv("VIRTUAL_ENV") | |
| if venv then | |
| return venv .. "/bin/python" | |
| else | |
| -- fallback: look for .venv or venv in workspace | |
| local cwd = vim.fn.getcwd() | |
| if vim.fn.isdirectory(cwd .. "/.venv") == 1 then | |
| return cwd .. "/.venv/bin/python" | |
| elseif vim.fn.isdirectory(cwd .. "/venv") == 1 then | |
| return cwd .. "/venv/bin/python" | |
| else | |
| return "python3" | |
| end | |
| end | |
| end)() | |
| } | |
| } | |
| } | |
| }) | |
| require("conform").setup({ | |
| formatters_by_ft = { | |
| lua = { "stylua" }, | |
| -- Conform will run multiple formatters sequentially | |
| python = { "isort", "black" }, | |
| -- You can customize some of the format options for the filetype (:help conform.format) | |
| rust = { "rustfmt", lsp_format = "fallback" }, | |
| -- Conform will run the first available formatter | |
| javascript = { "prettierd", "prettier", stop_after_first = true }, | |
| }, | |
| format_on_save = { | |
| -- These options will be passed to conform.format() | |
| timeout_ms = 500, | |
| lsp_format = "fallback", | |
| }, | |
| }) | |
| require("CopilotChat").setup({}) | |
| vim.keymap.set("i", "<C-c>", "<Esc>", { noremap = true }) | |
| -- window management | |
| vim.keymap.set("n", "<leader>wv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically | |
| vim.keymap.set("n", "<leader>wh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally | |
| vim.keymap.set("n", "<leader>we", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height | |
| vim.keymap.set("n", "<leader>wx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window | |
| local severity = vim.diagnostic.severity | |
| vim.diagnostic.config({ | |
| signs = { | |
| text = { | |
| [severity.ERROR] = "✘ ", | |
| [severity.WARN] = "▲ ", | |
| [severity.HINT] = "⚑ ", | |
| [severity.INFO] = " ", | |
| }, | |
| }, | |
| }) |
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
| -- -- ~/.config/nvim/lua/config/lazy.lua | |
| -- Bootstrap lazy.nvim | |
| local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | |
| if not (vim.uv or vim.loop).fs_stat(lazypath) then | |
| local lazyrepo = "https://github.com/folke/lazy.nvim.git" | |
| local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) | |
| if vim.v.shell_error ~= 0 then | |
| vim.api.nvim_echo({ | |
| { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, | |
| { out, "WarningMsg" }, | |
| { "\nPress any key to exit..." }, | |
| }, true, {}) | |
| vim.fn.getchar() | |
| os.exit(1) | |
| end | |
| end | |
| vim.opt.rtp:prepend(lazypath) | |
| -- Make sure to setup `mapleader` and `maplocalleader` before | |
| -- loading lazy.nvim so that mappings are correct. | |
| -- This is also a good place to setup other settings (vim.opt) | |
| vim.g.mapleader = "," | |
| vim.g.maplocalleader = "\\" | |
| -- Setup lazy.nvim | |
| require("lazy").setup({ | |
| spec = { | |
| -- import your plugins | |
| { import = "plugins" }, | |
| }, | |
| -- Configure any other settings here. See the documentation for more details. | |
| -- colorscheme that will be used when installing plugins. | |
| install = { colorscheme = { "habamax" } }, | |
| -- automatically check for plugin updates | |
| checker = { enabled = true }, | |
| }) | |
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
| -- -- ~/.config/nvim/lua/plugins.lua | |
| return { | |
| -- LSP stuff | |
| { 'mason-org/mason.nvim' }, -- installs LSP servers | |
| { 'neovim/nvim-lspconfig' }, -- configures LSPs | |
| { 'mason-org/mason-lspconfig.nvim' }, -- links the two above | |
| -- Vim motions on speed | |
| { 'easymotion/vim-easymotion' }, | |
| -- Use RipGrep in Vim and display results in a quickfix list | |
| { 'jremmen/vim-ripgrep' }, | |
| -- Things you can do with fzf and Vim. | |
| { 'junegunn/fzf', { ['dir'] = '~/.fzf', ['do'] = './install --all' } }, | |
| { 'junegunn/fzf.vim' }, | |
| -- " Intensely nerdy commenting powers | |
| { 'scrooloose/nerdcommenter' }, | |
| -- " Clean, vibrant and pleasing color schemes for Vim, Sublime Text, iTerm, gnome-terminal and more. | |
| { 'morhetz/gruvbox' }, | |
| -- " A Git wrapper so awesome, it should be illegal | |
| { 'tpope/vim-fugitive' }, | |
| { 'idanarye/vim-merginal' }, | |
| -- " Surround.vim is all about "surroundings": parentheses, brackets, quotes, XML tags, and more | |
| { 'tpope/vim-surround' }, | |
| -- " Lean & mean status/tabline for vim that's light as air | |
| -- { 'vim-airline/vim-airline' }, | |
| -- { 'vim-airline/vim-airline-themes' }, | |
| -- " A Vim wrapper for running tests on different granularities. | |
| { 'vim-test/vim-test' }, | |
| -- " Interactive Repls Over Neovim | |
| { 'hkupty/iron.nvim' }, | |
| -- " Syntaxes highlight | |
| { 'sheerun/vim-polyglot' }, | |
| -- """"""""""""""""""""" | |
| -- " AUTO FORMATTER & AUTOCOMPLETER | |
| -- """"""""""""""""""""" | |
| { 'stevearc/conform.nvim' }, | |
| { 'editorconfig/editorconfig-vim' }, | |
| -- { 'godlygeek/tabular' }, | |
| -- { 'folke/todo-comments.nvim' }, | |
| -- { 'jparise/vim-graphql' }, | |
| { 'github/copilot.vim' }, | |
| { 'nvim-lua/plenary.nvim' }, | |
| { "nvim-tree/nvim-web-devicons", opts = {} }, | |
| { 'nvim-mini/mini.nvim', version = false }, | |
| -- { 'CopilotC-Nvim/CopilotChat.nvim' }, | |
| -- { 'folke/which-key.nvim' }, | |
| { | |
| "folke/which-key.nvim", | |
| event = "VeryLazy", | |
| opts = { | |
| -- your configuration comes here | |
| -- or leave it empty to use the default settings | |
| -- refer to the configuration section below | |
| }, | |
| keys = { | |
| { | |
| "<leader>?", | |
| function() | |
| require("which-key").show({ global = false }) | |
| end, | |
| desc = "Buffer Local Keymaps (which-key)", | |
| }, | |
| }, | |
| }, | |
| { | |
| "CopilotC-Nvim/CopilotChat.nvim", | |
| dependencies = { | |
| { "github/copilot.vim" }, -- or zbirenbaum/copilot.lua | |
| { "nvim-lua/plenary.nvim", branch = "master" }, -- for curl, log and async functions | |
| }, | |
| build = "make tiktoken", -- Only on MacOS or Linux | |
| opts = { | |
| -- See Configuration section for options | |
| }, | |
| keys = { | |
| { "<leader>zc", ":CopilotChat<CR>", mode = "n", desc = "Chat with Copilot" }, | |
| { "<leader>ze", ":CopilotChatExplain<CR>", mode = "v", desc = "Explain Code" }, | |
| { "<leader>zr", ":CopilotChatReview<CR>", mode = "v", desc = "Review Code" }, | |
| { "<leader>zf", ":CopilotChatFix<CR>", mode = "v", desc = "Fix Code Issues" }, | |
| { "<leader>zo", ":CopilotChatOptimize<CR>", mode = "v", desc = "Optimize Code" }, | |
| { "<leader>zd", ":CopilotChatDocs<CR>", mode = "v", desc = "Generate Docs" }, | |
| { "<leader>zt", ":CopilotChatTests<CR>", mode = "v", desc = "Generate Tests" }, | |
| { "<leader>zm", ":CopilotChatCommit<CR>", mode = "n", desc = "Generate Commit Message" }, | |
| { "<leader>zs", ":CopilotChatCommit<CR>", mode = "v", desc = "Generate Commit for Selection" }, | |
| { "<leader>zv", ":'<,'>CopilotChat<CR>", mode = "v", desc = "Copilot Chat (selection)" }, | |
| }, | |
| }, | |
| { | |
| '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 = 'default' }, | |
| 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 = false } }, | |
| -- 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" } | |
| }, | |
| { | |
| 's1n7ax/nvim-window-picker', | |
| name = 'window-picker', | |
| event = 'VeryLazy', | |
| version = '2.*', | |
| config = function() | |
| require 'window-picker'.setup({ | |
| hint = 'floating-big-letter' | |
| }) | |
| end, | |
| keys = { | |
| { | |
| "<leader>sp", | |
| function() | |
| local win = require("window-picker").pick_window() | |
| if win then | |
| vim.api.nvim_set_current_win(win) | |
| end | |
| end, | |
| desc = "Pick window", | |
| }, | |
| }, | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment