-- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` -- NOTE: You can change these options as you wish! -- For more options, you can see `:help option-list` -- Make line numbers default vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.opt.showmode = false -- Sync clipboard between OS and Neovim. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -- vim.opt.clipboard = 'unnamedplus' vim.schedule(function() vim.opt.clipboard = 'unnamedplus' end) -- Enable break indent vim.opt.breakindent = true -- Save undo history vim.opt.undofile = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term vim.opt.ignorecase = true vim.opt.smartcase = true -- Keep signcolumn on by default vim.opt.signcolumn = 'yes' -- Decrease update time vim.opt.updatetime = 250 -- Decrease mapped sequence wait time -- Displays which-key popup sooner vim.opt.timeoutlen = 1500 -- Configure how new splits should be opened vim.opt.splitright = true vim.opt.splitbelow = true -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` vim.opt.list = true vim.opt.listchars = { tab = ' ', trail = '·', nbsp = '␣' } -- Preview substitutions live, as you type! vim.opt.inccommand = 'split' -- Show which line your cursor is on vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 -- [[ Eric's Custom Keymaps]] vim.keymap.set('n', '', 'Neotree toggle') -- vim.keymap.set('n', 'g', 'Neotree float git_status') vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle, { desc = 'Toggle [U]ndoTree' }) -- vim.keymap.set('n', ';', 'A;', { desc = 'Append [;] to line' }) -- vim.keymap.set('n', ',', 'A,', { desc = 'Append [,] to line' }) vim.keymap.set('n', '', ':bnext', { desc = 'Next buffer' }) vim.keymap.set('n', '', ':bprev', { desc = 'Previous buffer' }) vim.opt.winborder = 'rounded' -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -- Set highlight on search, but clear on pressing in normal mode vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which -- is not what someone will guess without a bit more experience. -- -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping -- or just use to exit terminal mode vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode -- vim.keymap.set('n', '', 'echo "Use h to move!!"') -- vim.keymap.set('n', '', 'echo "Use l to move!!"') -- vim.keymap.set('n', '', 'echo "Use k to move!!"') -- vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode -- See `:help vim.highlight.on_yank()` vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = function() vim.highlight.on_yank() end, }) -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) -- [[ Configure and install plugins ]] -- -- To check the current status of your plugins, run -- :Lazy -- -- You can press `?` in this menu for help. Use `:q` to close the window -- -- To update plugins you can run -- :Lazy update -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following -- keys can be used to configure plugin behavior/loading/etc. -- -- Use `opts = {}` to force a plugin to be loaded. -- -- This is equivalent to: -- require('Comment').setup({}) -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. This is equivalent to the following Lua: -- require('gitsigns').setup({ ... }) -- -- See `:help gitsigns` to understand what the configuration keys do { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { signs = { add = { text = '+' }, change = { text = '~' }, delete = { text = '_' }, topdelete = { text = '‾' }, changedelete = { text = '~' }, }, }, }, -- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- -- This is often very useful to both group configuration, as well as handle -- lazy loading plugins that don't need to be loaded immediately at startup. -- -- For example, in the following configuration, we use: -- event = 'VimEnter' -- -- which loads which-key before all the UI elements are loaded. Events can be -- normal autocommands events (`:help autocmd-events`). -- -- Then, because we use the `config` key, the configuration only runs -- after the plugin has been loaded: -- config = function() ... end { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { icons = { -- set icon mappings to true if you have a Nerd Font mappings = vim.g.have_nerd_font, -- If you are using a Nerd Font: set icons.keys to an empty table which will use the -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table keys = vim.g.have_nerd_font and {} or { Up = ' ', Down = ' ', Left = ' ', Right = ' ', C = ' ', M = ' ', D = ' ', S = ' ', CR = ' ', Esc = ' ', ScrollWheelDown = ' ', ScrollWheelUp = ' ', NL = ' ', BS = ' ', Space = ' ', Tab = ' ', F1 = '', F2 = '', F3 = '', F4 = '', F5 = '', F6 = '', F7 = '', F8 = '', F9 = '', F10 = '', F11 = '', F12 = '', }, }, -- Document existing key chains spec = { { 'c', group = '[C]ode', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, }, }, -- NOTE: Plugins can specify dependencies. -- -- The dependencies are proper plugin specifications as well - anything -- you do for a plugin at the top level, you can do for a dependency. -- -- Use the `dependencies` key to specify the dependencies of a particular plugin { -- blink autocompletion 'saghen/blink.cmp', dependencies = { 'rafamadriz/friendly-snippets' }, version = '*', ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { completion = { list = { selection = { preselect = false, }, }, }, keymap = { preset = 'enter', [''] = { 'select_next', 'fallback' }, [''] = { 'select_prev', 'fallback' }, }, appearance = { nerd_font_variant = 'normal', }, completion = { documentation = { auto_show = true }, }, sources = { -- add lazydev to your completion providers default = { 'lazydev', 'lsp', 'path', 'snippets', 'buffer' }, providers = { lazydev = { name = 'LazyDev', module = 'lazydev.integrations.blink', -- make lazydev completions top priority (see `:h blink.cmp`) score_offset = 100, }, }, }, }, opts_extend = { 'sources.default' }, }, { -- FZF (Telescope replacement) 'ibhagwan/fzf-lua', -- optional for icon support dependencies = { 'nvim-tree/nvim-web-devicons' }, -- or if using mini.icons/mini.nvim -- dependencies = { 'echasnovski/mini.icons' }, opts = {}, -- [[ fzf keybinds]] config = function() local fzf = require 'fzf-lua' vim.keymap.set('n', 'sw', fzf.grep_cword, { desc = '[S]earch [W]ord' }) vim.keymap.set('n', 'sf', fzf.files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sg', fzf.live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sg', fzf.live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sr', fzf.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', '/', fzf.blines, { desc = '[/] Fuzzily search in current buffer' }) end, }, { -- DAP for Godot - https://docs.godotengine.org/en/stable/tutorials/editor/external_editor.html#lsp-dap-support 'mfussenegger/nvim-dap', config = function() local dap = require 'dap' dap.adapters.godot = { type = 'server', host = '127.0.0.1', port = 6006, } dap.configurations.gdscript = { { launch_game_instance = false, launch_scene = false, name = 'Launch scene', project = '${workspaceFolder}', request = 'launch', type = 'godot', }, } end, }, { -- Autoformat 'stevearc/conform.nvim', lazy = false, keys = { { 'f', function() require('conform').format { async = true, lsp_fallback = true } end, mode = '', desc = '[F]ormat buffer', }, }, opts = { notify_on_error = false, format_on_save = function(bufnr) -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. local disable_filetypes = { c = true, cpp = true } return { timeout_ms = 500, lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], } end, formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- -- You can use a sub-list to tell conform to run *until* a formatter -- is found. -- javascript = { { "prettierd", "prettier" } }, }, }, }, { -- Install cutpuccin colorscheme 'catppuccin/nvim', name = 'cutppuccin', priority = 1000, }, { -- You can easily change to a different colorscheme. -- Change the name of the colorscheme plugin below, and then -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. 'folke/tokyonight.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. init = function() -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. vim.cmd.colorscheme 'catppuccin-mocha' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' end, }, -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, { -- Collection of various small independent plugins/modules 'echasnovski/mini.nvim', config = function() -- Better Around/Inside textobjects -- -- Examples: -- - va) - [V]isually select [A]round [)]paren -- - yinq - [Y]ank [I]nside [N]ext [']quote -- - ci' - [C]hange [I]nside [']quote require('mini.ai').setup { n_lines = 500 } -- Add/delete/replace surroundings (brackets, quotes, etc.) -- -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - sd' - [S]urround [D]elete [']quotes -- - sr)' - [S]urround [R]eplace [)] ['] require('mini.surround').setup() -- Simple and easy statusline. -- You could remove this setup call if you don't like it, -- and try some other statusline plugin local statusline = require 'mini.statusline' -- set use_icons to true if you have a Nerd Font statusline.setup { use_icons = vim.g.have_nerd_font } -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we set the section for -- cursor location to LINE:COLUMN ---@diagnostic disable-next-line: duplicate-set-field statusline.section_location = function() return '%2l:%-2v' end -- ... and there is more! -- Check out: https://github.com/echasnovski/mini.nvim end, }, { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'vim', 'vimdoc', 'toml', 'css' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { enable = true, -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. -- If you are experiencing weird indenting issues, add the language to -- the list of additional_vim_regex_highlighting and disabled languages for indent. additional_vim_regex_highlighting = { 'ruby' }, }, indent = { enable = true, disable = { 'ruby' } }, }, config = function(_, opts) -- [[ Configure Treesitter ]] See `:help nvim-treesitter` ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup(opts) -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: -- -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects end, }, -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart -- -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` { import = 'custom.plugins' }, { import = 'misc' }, { import = 'lsp' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table icons = vim.g.have_nerd_font and {} or { cmd = '⌘', config = '🛠', event = '📅', ft = '📂', init = '⚙', keys = '🗝', plugin = '🔌', runtime = '💻', require = '🌙', source = '📄', start = '🚀', task = '📌', lazy = '💤 ', }, }, }) -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et