vim.g.mapleader = ' ' vim.g.maplocalleader = ',' vim.o.number = true vim.o.mouse = 'a' vim.o.showmode = false vim.schedule(function() vim.o.clipboard = 'unnamedplus' end) vim.o.breakindent = true vim.o.undofile = true vim.o.ignorecase = true vim.o.smartcase = true -- Adds extra space for git diff symbols and stuff vim.o.signcolumn = 'yes' -- Decrease update time vim.o.updatetime = 250 -- Decrease mapped sequence wait time vim.o.timeoutlen = 300 -- Configure how new splits should be opened vim.o.splitright = true vim.o.splitbelow = true vim.o.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -- Preview substitutions live, as you type! vim.o.inccommand = 'split' -- Show which line your cursor is on vim.o.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.o.scrolloff = 3 -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), -- instead raise a dialog asking if you wish to save the current file(s) -- See `:help 'confirm'` vim.o.confirm = true 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.hl.on_yank() end, }) -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic Config & Keymaps -- See :help vim.diagnostic.Opts vim.diagnostic.config { update_in_insert = false, severity_sort = true, float = { border = 'rounded', source = 'if_many' }, underline = { severity = { min = vim.diagnostic.severity.WARN } }, -- Can switch between these as you prefer virtual_text = false, -- Text shows up at the end of the line virtual_lines = true, -- Text shows up underneath the line, with virtual lines -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d` jump = { float = true }, } vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) vim.keymap.set('n', 'K', function() vim.lsp.buf.hover({border = 'rounded'}) end) vim.lsp.enable({'lua_ls'}) local github = 'https://github.com/' vim.pack.add({ github .. 'nvim-lua/plenary.nvim', github .. 'nvim-telescope/telescope-fzf-native.nvim', github .. 'nvim-telescope/telescope.nvim', github .. 'stevearc/oil.nvim', github .. 'neovim/nvim-lspconfig', github .. 'nvim-mini/mini.nvim', github .. 'lewis6991/gitsigns.nvim', github .. 'neogitorg/neogit', }) -- Telescope local builtin = require('telescope.builtin') vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) vim.keymap.set('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) -- Oil require('oil').setup({ default_file_explorer = true, columns = { "icon", } }) vim.keymap.set('n', 'rw', 'Oil', { desc = 'Open file explorer' }) -- Mini require('mini.move').setup() require('mini.surround').setup() -- Neogit vim.keymap.set('n', 'gg', 'Neogit')