----------------------------- -- General Settings ----------------------------- vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' vim.g.have_nerd_font = true -- Visual Things vim.opt.cmdheight = 0 -- Currently looking for a solution for searching with / and ? vim.opt.number = true vim.opt.relativenumber = true vim.opt.mouse = 'a' vim.opt.showmode = false -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -- It does get added to the @ register I believe? vim.schedule(function() vim.opt.clipboard = 'unnamedplus' end) -- Enable break indent vim.opt.breakindent = true -- Enable word break instead of character break vim.opt.linebreak = 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 = 200 -- 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' -- Hides special characters in markdown vim.opt.conceallevel = 2 -- Show which line your cursor is on vim.opt.cursorline = true -- Spelling Correction vim.opt.spell = true -- vim.opt.spelllang = 'en' -- Tabulation Stuffs vim.opt.shiftwidth = 4 vim.opt.expandtab = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 7 ----------------------------- -- Quality of Life Keybinds: ----------------------------- vim.keymap.set('n', '', 'w', { silent = true }) vim.keymap.set('i', '', 'w', { silent = true }) -------------------- -- Quit Vim vim.keymap.set('n', 'qa', 'qa!', { desc = 'Force quit without saving'}) vim.keymap.set('n', 'qx', 'xa!', { desc = 'Write to all then force quit'}) -------------------- -- Text Oriented vim.keymap.set('n', '', 'nohlsearch') vim.keymap.set('v', 'R', 's') -------------------- -- Movement -- Faster Window Navigation vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the left window' }) vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the right window' }) vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { silent=true, desc = 'Move focus to the upper window' }) -- Terminal -- or just use to exit terminal mode vim.keymap.set('t', '', '', { silent=true, desc = 'Exit terminal mode' }) -- Skipping Sections vim.keymap.set('n', '', 'zz20kzz', { silent=true, desc = 'Skip Large Sections' }) vim.keymap.set('n', '', 'zz20jzz', { silent=true, desc = 'Skip Large Sections' }) vim.keymap.set('i', '', '2ka', { silent=true, desc = 'Skip Large Sections' }) vim.keymap.set('i', '', '2ja', { silent=true, desc = 'Skip Large Sections' }) -------------------- -- Window Manipulation vim.keymap.set('n', '', 'q', { silent=true, desc='Close Window' }) -------------------- -- Weird Sh*t Fixes vim.keymap.set('n', 's', '', {desc="[S]urround"}) -- Dunno but this is needed to stop some weird substitution thing vim.keymap.set('n', 'm', 'q', {desc="Macro"}) vim.keymap.set('n', 'q', '') -- Record fights me so often -- [[ 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, }) 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 error('Error cloning lazy.nvim:\n' .. out) end end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- Was constantly fighting this. It get's it wrong istg ;-; -- 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically -- 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 = '~' }, }, }, }, { -- Shows Keybinds 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { icons = { mappings = vim.g.have_nerd_font, 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]iagnostic' }, { 'r', group = '[R]ename' }, { 'f', group = '[F]ind' }, { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, { 'q', group = 'Open quick [Q]uit menu' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, { 's', group = '[S]urround' } }, }, }, { -- Fuzzy Finder (files, lsp, etc) 'nvim-telescope/telescope.nvim', event = 'VimEnter', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', { -- If encountering errors, see telescope-fzf-native README for installation instructions 'nvim-telescope/telescope-fzf-native.nvim', -- `build` is used to run some command when the plugin is installed/updated. -- This is only run then, not every time Neovim starts up. build = 'make', -- `cond` is a condition used to determine whether this plugin should be -- installed and loaded. cond = function() return vim.fn.executable 'make' == 1 end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- The easiest way to use Telescope, is to start by doing something like: -- :Telescope help_tags -- -- Two important keymaps to use while in Telescope are: -- - Insert mode: -- - Normal mode: ? -- -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` local actions = require('telescope.actions') require('telescope').setup { defaults = { mappings = { i = { -- [''] = 'to_fuzzy_refine' [''] = actions.close }, }, find_command = { 'rg', '--files', '--follow' }, -- or 'fd' with '--follow' if you use fd as the search tool }, -- pickers = {} extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), }, }, } -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[F]ind [F]iles' }) vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) vim.keymap.set('n', 'fg', function() require('telescope.builtin').live_grep { additional_args = function() return { "--follow" } end, } end, { desc = '[F]ind by [G]rep' }) vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) vim.keymap.set('n', 'df', builtin.diagnostics, { desc = '[D]iagnostic [F]ind Via Telescope' }) vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) vim.keymap.set('n', '', 'fg', { desc = '[ ] Find Grep' }) vim.keymap.set('n', '', function() builtin.current_buffer_fuzzy_find({ winblend = 10, previewer = false, }) end, { desc = '' }) vim.keymap.set('n', 'fb', function() builtin.live_grep { grep_open_files = true, prompt_title = 'Live Grep in Open Files', } end, { desc = '[F]ind in [B]uffers' }) -- Shortcut for searching your Neovim configuration files vim.keymap.set('n', 'fn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[F]ind [N]eovim files' }) end, }, { -- 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 'tokyonight-night' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' end, }, require 'plugins.lsp', require 'plugins.autopairs', require 'plugins.neo-tree', require 'plugins.gitsigns', require 'plugins.barbar', require 'plugins.terminal', require 'plugins.venn', require 'plugins.blinkcmp', -- require 'plugins.debug', -- Highlight todo, notes, etc in comments { "OXY2DEV/markview.nvim", lazy = false, -- Recommended -- ft = "markdown" -- If you decide to lazy-load anyway dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" } }, { '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 [Q]uote -- - 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 -- https://github.com/echasnovski/mini.nvim end, }, { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', main = 'nvim-treesitter.configs', opts = { ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'query', 'vim', 'vimdoc' }, -- 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' }, disable = { 'latex' } }, indent = { enable = true, disable = { 'ruby' } }, }, -- - 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 }, { 'VonHeikemen/fine-cmdline.nvim', dependencies = { {'MunifTanjim/nui.nvim'} }, cmdline = { smart_history = true }, config = function() vim.api.nvim_set_keymap('n', ':', 'FineCmdline', {noremap = true}) end }, }, { ui = { icons = vim.g.have_nerd_font and {} or { cmd = '⌘', config = '🛠', event = '📅', ft = '📂', init = '⚙', keys = '🗝', plugin = '🔌', runtime = '💻', require = '🌙', source = '📄', start = '🚀', task = '📌', lazy = '💤 ', }, }, }) require('config.lsp')