From 403aa74f8ad7fab227c3dd282ac9143da9b25b7b Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sat, 6 Jul 2024 23:24:35 +0300 Subject: Neovim: refactored a bunch more files into a more organized structure, and changed some configurations --- .config/nvim/lua/custom/plugins/motions.lua | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .config/nvim/lua/custom/plugins/motions.lua (limited to '.config/nvim/lua/custom/plugins/motions.lua') diff --git a/.config/nvim/lua/custom/plugins/motions.lua b/.config/nvim/lua/custom/plugins/motions.lua new file mode 100644 index 0000000..3cfcfcf --- /dev/null +++ b/.config/nvim/lua/custom/plugins/motions.lua @@ -0,0 +1,80 @@ +return { + { + 'christoomey/vim-tmux-navigator', + config = function() + vim.keymap.set('n', 'C-h', ':TmuxNavigatorLeft') + vim.keymap.set('n', 'C-j', ':TmuxNavigatorDown') + vim.keymap.set('n', 'C-k', ':TmuxNavigatorUp') + vim.keymap.set('n', 'C-l', ':TmuxNavigatorRight') + end, + }, + { + 'ggandor/leap.nvim', + dependencies = { 'tpope/vim-repeat' }, + config = function() + vim.keymap.set({ 'n', 'x', 'o' }, 's', '(leap-forward)') + vim.keymap.set({ 'n', 'x', 'o' }, 'S', '(leap-backward)') + vim.keymap.set({ 'n', 'x', 'o' }, 'gs', '(leap-from-window)') + + -- Define equivalence classes for brackets and quotes, in addition to + -- the default whitespace group. + require('leap').opts.equivalence_classes = { ' \t\r\n', '([{', ')]}', '\'"`' } + + -- Set background to gray in searchable area + vim.api.nvim_set_hl(0, 'LeapBackdrop', { fg = '#777777' }) + end, + }, + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, + }, + { + 'numToStr/Comment.nvim', + opts = { + padding = true, + ignore = nil, + + toggler = { line = 'gcc', block = 'gbc' }, + opleader = { line = 'gc', block = 'gb' }, + extra = { above = 'gcO', below = 'gco', eol = 'gcA' }, + + mappings = { + basic = true, -- `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` + extra = false, -- `gco`, `gcO`, `gcA` + }, + }, + config = function() + local api = require('Comment.api') + local esc = vim.api.nvim_replace_termcodes('', true, false, true) + local toggole_linewise_selection = function() + vim.api.nvim_feedkeys(esc, 'nx', false) + api.toggle.linewise(vim.fn.visualmode()) + end + + -- means Ctrl slash, `_` is a `/` + vim.keymap.set('n', '', api.toggle.linewise.current, { noremap = true, silent = true }) + vim.keymap.set('v', '', toggole_linewise_selection, { noremap = true, silent = true }) + end, + }, + { + 'kylechui/nvim-surround', + version = '*', + event = 'VeryLazy', + config = function() + require('nvim-surround').setup({}) + vim.keymap.set('v', '(', '(nvim-surround-visual)(') + vim.keymap.set('v', ')', '(nvim-surround-visual))') + vim.keymap.set('v', '{', '(nvim-surround-visual){') + vim.keymap.set('v', '}', '(nvim-surround-visual)}') + -- I still want to be able to do < and > for indentation + -- vim.keymap.set('v', '<', '(nvim-surround-visual)<', opts) + -- vim.keymap.set('v', '>', '(nvim-surround-visual)>', opts) + vim.keymap.set('v', '[', '(nvim-surround-visual)[') + vim.keymap.set('v', ']', '(nvim-surround-visual)]') + vim.keymap.set('v', "'", "(nvim-surround-visual)'") + vim.keymap.set('v', '"', '(nvim-surround-visual)"') + vim.keymap.set('v', '`', '(nvim-surround-visual)`') + end, + }, +} -- cgit v1.3.1