-- NOTE: If you experience any errors while trying to install kickstart, run `:checkhealth` for more info -- 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` -- Make line numbers default vim.opt.number = true vim.opt.relativenumber = true vim.opt.tabstop = 4 vim.opt.shiftwidth = 4 vim.opt.expandtab = true vim.opt.laststatus = 3 -- 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 status line vim.opt.showmode = false vim.opt.swapfile = false -- Sync clipboard between OS and Neovim. vim.opt.clipboard = 'unnamedplus' -- Enable break indent vim.opt.breakindent = true -- Save undo history vim.opt.undofile = true -- Case-insensitive searching UNLESS \C or capital in search vim.opt.ignorecase = true vim.opt.smartcase = true -- Keep signcolumn on by default vim.opt.signcolumn = 'yes' -- Decrease update time vim.opt.updatetime = 250 vim.opt.timeoutlen = 300 -- Configure how new splits should be opened vim.opt.splitright = true vim.opt.splitbelow = true -- Sets how neovim will display certain whitespace 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 vim.opt.cursorlineopt = { 'number' } --remove cursorline color, required for hl-CursorLineNr with cursorline true. -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 -- [[ 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') vim.keymap.set('n', '', vim.cmd.UndotreeToggle) -- Move line up or down after highlight vim.keymap.set('v', 'J', ":m '>+1gv=gv") vim.keymap.set('v', 'K', ":m '<-2gv=gv") -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) 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' }) vim.keymap.set('i', 'kj', '') -- Open Netrw -- vim.keymap.set('n', 'rw', 'Ex!') -- Open Neotree vim.keymap.set('n', 'nt', ':Neotree') -- LSP and Telescope Shortcut vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) -- NOTE: Remember that lua is a real programming language, and as such it is possible -- to define small helper and utility functions so you don't have to repeat yourself -- many times. -- -- In this case, we create a function that lets us more easily define mappings specific -- for LSP related items. It sets the mode, buffer and description for us each time. local map = function(keys, func, desc) vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end -- Jump to the definition of the word under your cursor. -- This is where a variable was first declared, or where a function is defined, etc. -- To jump back, press . map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') -- Find references for the word under your cursor. map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') -- Jump to the implementation of the word under your cursor. -- Useful when your language has ways of declaring types without an actual implementation. map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') -- Jump to the type of the word under your cursor. -- Useful when you're not sure what type a variable is and you want to see -- the definition of its *type*, not where it was *defined*. map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') -- Fuzzy find all the symbols in your current workspace -- Similar to document symbols, except searches over your whole project. map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') -- Rename the variable under your cursor -- Most Language Servers support renaming across files, etc. map('rn', vim.lsp.buf.rename, '[R]e[n]ame') -- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') -- Opens a popup that displays documentation about the word under your cursor -- See `:help K` for why this keymap map('K', vim.lsp.buf.hover, 'Hover Documentation') -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed -- -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) if client and client.server_capabilities.documentHighlightProvider then vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, callback = vim.lsp.buf.document_highlight, }) vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { buffer = event.buf, callback = vim.lsp.buf.clear_references, }) end end, }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` -- Highlight when yanking (copying) text -- 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 { timeout = 70 } end, }) -- [[ Install `lazy.nvim` plugin manager ]] 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 ]] require('lazy').setup({ 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically 'ThePrimeagen/vim-be-good', 'mbbill/undotree', -- Database 'tpope/vim-dadbod', 'kristijanhusak/vim-dadbod-ui', 'kristijanhusak/vim-dadbod-completion', { 'microsoft/vscode-js-debug', opt = true, run = 'npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out', }, { 'stevearc/oil.nvim', opts = {}, -- Optional dependencies dependencies = { 'nvim-tree/nvim-web-devicons' }, config = function() require('oil').setup { default_file_explorer = true, } end, }, { 'nvim-neo-tree/neo-tree.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim', 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended 'MunifTanjim/nui.nvim', }, -- Enable to autostart at nvim . -- config = function() -- require('neo-tree').setup {} -- end, }, -- 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. -- NOTE plugins -- -- This is equivalent to: -- require('Comment').setup({}) { 'numToStr/Comment.nvim', opts = { opleader = { --[M]ake[C]omment line = 'mc', -- [M]ake [B]lock comment block = 'mb', }, }, }, -- 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 = '~' }, }, }, }, { -- 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' } }, }, }, }, { 'rose-pine/neovim', name = 'rose-pine', priority = 1000, config = function() require('rose-pine').setup { disable_background = true, styles = { bold = true, italic = false, }, } end, }, { 'catppuccin/nvim', name = 'catppuccin', priority = 1000, config = function() require('catppuccin').setup { flavour = 'auto', -- latte, frappe, macchiato, mocha background = { -- :h background light = 'latte', dark = 'mocha', }, transparent_background = true, -- disables setting the background color. show_end_of_buffer = false, -- shows the '~' characters after the end of buffers term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) dim_inactive = { enabled = false, -- dims the background color of inactive window shade = 'dark', percentage = 0.15, -- percentage of the shade to apply to the inactive window }, no_italic = true, -- Force no italic no_bold = false, -- Force no bold no_underline = false, -- Force no underline --[[ styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): -- comments = { 'italic' }, -- Change the style of comments -- conditionals = { 'italic' }, loops = {}, functions = {}, keywords = {}, strings = {}, variables = {}, numbers = {}, booleans = {}, properties = {}, types = {}, operators = {}, -- miscs = {}, -- Uncomment to turn off hard-coded styles }, ]] color_overrides = {}, custom_highlights = {}, default_integrations = true, integrations = { cmp = true, gitsigns = true, nvimtree = true, treesitter = true, notify = false, mini = { enabled = true, indentscope_color = '', }, -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) }, } vim.cmd.colorscheme 'catppuccin' vim.o.background = 'dark' -- You can configure highlights by doing something like vim.cmd.hi 'Comment gui=none' vim.api.nvim_set_hl(0, 'TelescopeNormal', { bg = 'none' }) --Background (inside telescope) vim.api.nvim_set_hl(0, 'TelescopeBorder', { bg = 'none' }) --Weird Borderline vim.api.nvim_set_hl(0, 'NormalNC', { bg = 'none' }) --Background (outside telescope) vim.api.nvim_set_hl(0, 'WinSeparator', { fg = '#ffffff' }) --window separator vim.api.nvim_set_hl(0, 'NotificationInfo', { bg = 'none' }) vim.api.nvim_set_hl(0, 'NotificationWarning', { bg = 'none' }) vim.api.nvim_set_hl(0, 'NotificationError', { bg = 'none' }) vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = '#a6e3a1', bg = 'none' }) -- vim.api.nvim_set_hl(0, 'Normalfloat', { bg = 'none' }) end, }, { 'folke/tokyonight.nvim', priority = 1000, -- make sure to load this before all the other start plugins init = function() require('tokyonight').setup { transparent = false, terminal_colors = true, } end, }, -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, -- 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 -- put them in the right spots if you want. -- 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.autopairs', require 'kickstart.plugins.conform', require 'kickstart.plugins.dap', require 'kickstart.plugins.debug', require 'kickstart.plugins.fzf-telescope', require 'kickstart.plugins.indent_line', require 'kickstart.plugins.lsp-config', require 'kickstart.plugins.mini', require 'kickstart.plugins.nvim-cmp', require 'kickstart.plugins.treesitter', require 'kickstart.plugins.vim-fugitive', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` { import = 'custom.plugins' }, }, { ui = { 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