From 2ae591cb0a56746bb6c5023b96234d46b946d32c Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sun, 4 Jun 2023 17:02:43 -0600 Subject: final changes from kickstart.nvim, moved sets and remaps to separatefiles, removed unnecessary stuff --- lua/config/keymap.lua | 12 ++++++++++++ lua/config/set.lua | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 lua/config/keymap.lua create mode 100644 lua/config/set.lua (limited to 'lua/config') diff --git a/lua/config/keymap.lua b/lua/config/keymap.lua new file mode 100644 index 0000000..2280d15 --- /dev/null +++ b/lua/config/keymap.lua @@ -0,0 +1,12 @@ +-- Better default experience +vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) + +-- Dealing with word wrap +vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +-- Diagnostic +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) diff --git a/lua/config/set.lua b/lua/config/set.lua new file mode 100644 index 0000000..866eba4 --- /dev/null +++ b/lua/config/set.lua @@ -0,0 +1,43 @@ +-- :h vim. (dict: g, w, b, t, v, etc) for global variable help +-- and :h (vim..) for the option help (without the "()" part) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +vim.o.hlsearch = true + +vim.wo.number = true +vim.wo.relativenumber = true + +vim.o.mouse = 'a' +vim.o.clipboard = 'unnamedplus' + +vim.o.breakindent = true + +-- Basically a persistent undo file, useful for undotree plugin +vim.o.undofile = true + +-- Case insensitive searching UNLESS /C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +vim.wo.signcolumn = 'yes' + +-- vim.o.updatetime = 250 +vim.o.timeout = true +vim.o.timeoutlen = 300 + +-- Not sure if these affect some plugins, or if the plugins set their own options +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' + +vim.o.termguicolors = true + +-- Highlight on yank +local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = '*', +}) -- cgit v1.2.3-54-g00ecf