diff options
Diffstat (limited to '.config/nvim/plugin')
| -rw-r--r-- | .config/nvim/plugin/autocmds.lua | 18 | ||||
| -rw-r--r-- | .config/nvim/plugin/keymaps.lua | 44 | ||||
| -rw-r--r-- | .config/nvim/plugin/options.lua | 44 | ||||
| -rw-r--r-- | .config/nvim/plugin/plugin-manager.lua | 0 |
4 files changed, 106 insertions, 0 deletions
diff --git a/.config/nvim/plugin/autocmds.lua b/.config/nvim/plugin/autocmds.lua new file mode 100644 index 0000000..5272029 --- /dev/null +++ b/.config/nvim/plugin/autocmds.lua @@ -0,0 +1,18 @@ +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking text', + group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) + +-- vim.api.nvim_create_autocmd('FileType', { +-- group = vim.api.nvim_create_augroup('disable-auto-comment', { clear = true }), +-- pattern = '*', +-- callback = function() +-- -- c - autowrap using textwidth | r - enter in insert mode | o - o/O in normal mode +-- -- vim.opt.formatoptions:remove({ 'c', 'r', 'o' }) +-- vim.opt.formatoptions:remove('o') +-- -- vim.cmd('set formatoptions-=o') +-- end, +-- }) diff --git a/.config/nvim/plugin/keymaps.lua b/.config/nvim/plugin/keymaps.lua new file mode 100644 index 0000000..ee34aa2 --- /dev/null +++ b/.config/nvim/plugin/keymaps.lua @@ -0,0 +1,44 @@ +local set = vim.keymap.set +local silent = { silent = true } +---@param mode string|table +---@param keymap string +local function unbind(mode, keymap) + set(mode, keymap, function() end) +end + +-- Misc +set({ 'n', 'i' }, '<C-a>', '<Esc>ggVG', { desc = 'Visually Highlight [A]ll' }) +set('n', '<Esc>', '<cmd>nohlsearch<CR>', silent) +set({ 'i', 'c' }, '<C-v>', function() + vim.fn.getreg('+') +end) +set('n', '<leader>z', function() + vim.cmd('Neotree close') + vim.cmd('Trouble todo close') + vim.cmd('UndotreeHide') +end, { desc = '[Z]en Mode', silent = true }) +unbind({ 'i', 'n', 'v' }, '<C-r>') + +set('n', 'U', '<cmd>redo<cr>') +set('i', '<C-z>', '<cmd>undo<cr>') + +-- Window Navigation +set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) +set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the down window' }) +set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the up window' }) +set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) + +-- Window resizing +local resize = 2 +set({ 'n', 't' }, '<C-Left>', string.format('<cmd>vertical resize -%d<CR>', resize), { desc = 'Resize Left' }) +set({ 'n', 't' }, '<C-Up>', string.format('<cmd>resize -%d<CR>', resize), { desc = 'Resize Up' }) +set({ 'n', 't' }, '<C-Down>', string.format('<cmd>resize +%d<CR>', resize), { desc = 'Resize Down' }) +set({ 'n', 't' }, '<C-Right>', string.format('<cmd>vertical resize +%d<CR>', resize), { desc = 'Resize Right' }) + +-- Keep selection after < and > in visual mode +set('v', '<', '<gv') +set('v', '>', '>gv') + +-- Execute lua file or line +set('n', '<leader>x', '<cmd>.lua<CR>', { desc = 'Execute the current line' }) +set('n', '<leader><leader>x', '<cmd>source %<CR>', { desc = 'Execute the current file' }) diff --git a/.config/nvim/plugin/options.lua b/.config/nvim/plugin/options.lua new file mode 100644 index 0000000..ec56b43 --- /dev/null +++ b/.config/nvim/plugin/options.lua @@ -0,0 +1,44 @@ +-- System +vim.g.have_nerd_font = true +vim.opt.mouse = 'a' -- enable mouse +vim.opt.clipboard = 'unnamedplus' -- use system clipboard +vim.opt.undofile = true -- Persist undo history by saving it to a file + +-- Tab +vim.opt.expandtab = true -- convert tabs to spaces +vim.opt.tabstop = 4 -- number of visual spaces per TAB +vim.opt.softtabstop = 4 -- number of idfk tab when editing +vim.opt.shiftwidth = 4 -- number of spaces to insert on tab + +-- UI +vim.opt.signcolumn = 'auto:9' +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.cursorline = true -- highlight current line +vim.opt.splitright = true +vim.opt.splitbelow = true +vim.opt.showmode = false -- don't show mode, because lualine already does +vim.opt.list = true +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } +vim.diagnostic.config({ signs = false }) -- disable signcolumn diagnostics + +-- Searching +vim.opt.hlsearch = true +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Misc +vim.opt.wrap = false +vim.opt.scrolloff = 8 +vim.opt.undofile = true +vim.opt.termguicolors = true +vim.opt.laststatus = 3 -- views can only be fully collapsed with the global statusline +vim.opt.splitkeep = 'screen' -- for edgy.nvim +vim.opt.inccommand = 'split' -- shows preview for commands like :%s/from/to +vim.opt.formatoptions:remove('o') -- don't have `o` add a comment + +-- Disable warnings for missing language providers +vim.g.loaded_node_provider = 0 +vim.g.loaded_perl_provider = 0 +vim.g.loaded_ruby_provider = 0 +vim.g.loaded_python3_provider = 0 diff --git a/.config/nvim/plugin/plugin-manager.lua b/.config/nvim/plugin/plugin-manager.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim/plugin/plugin-manager.lua |
