diff options
| author | Josh <joshott16@gmail.com> | 2025-07-22 13:17:53 -0400 |
|---|---|---|
| committer | Josh <joshott16@gmail.com> | 2025-07-22 13:17:53 -0400 |
| commit | abd69f6af67ab55bee2a2fe02c75efc3b956c224 (patch) | |
| tree | 1c70e1096a2062667c0a45989054363233fc9c4a /nvim/lua | |
| parent | 795287e3ec351def221f9b44d358a182062e203a (diff) | |
| download | dotfiles-abd69f6af67ab55bee2a2fe02c75efc3b956c224.tar.gz dotfiles-abd69f6af67ab55bee2a2fe02c75efc3b956c224.zip | |
reworked nvim keymaps and options
Diffstat (limited to 'nvim/lua')
| -rw-r--r-- | nvim/lua/keymaps.lua | 114 | ||||
| -rw-r--r-- | nvim/lua/options.lua | 47 |
2 files changed, 88 insertions, 73 deletions
diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua index 1bef617..81674c3 100644 --- a/nvim/lua/keymaps.lua +++ b/nvim/lua/keymaps.lua @@ -1,25 +1,20 @@ -local map = vim.keymap.set; +local function map(m, k, v) + vim.keymap.set(m, k, v, { noremap = true, silent = true }) +end local builtin = require('telescope.builtin') -local opts = { noremap = true, silent = true} -map('', '<Up>', 'gk', opts) -map('', '<Down>', 'gj', opts) -map('n', 'J', 'mzJ`z', opts) +map('', '<Up>', 'gk') +map('', '<Down>', 'gj') +map('n', 'J', 'mzJ`z') -map('', 'o', 'o<Esc>', opts) -map('', 'O', 'O<Esc>', opts) +map('', 'o', 'o<Esc>') +map('', 'O', 'O<Esc>') -map('i', '<C-Space>', '<Esc>', opts) -map('v', '<C-Space>', '<Esc>', opts) -map('t', '<C-Space>', '<C-\\><C-n>', opts) -map('v', '<PageDown>', ":m '>+1<CR>gv=gv", opts) -map('v', '<PageUp>', ":m '<-2<CR>gv=gv", opts) +map('t', '<C-Space>', '<C-\\><C-n>') +map('v', '<PageDown>', "<cmd>m '>+1<CR>gv=gv") +map('v', '<PageUp>', "<cmd>m '<-2<CR>gv=gv") -map('n', 'Q', '<nop>') - --- -- telescope --- map('n', '<leader>pf', builtin.find_files, {}) map('n', '<leader>pg', function() -- If the directory is not a git repository, fallback to regular find_files. @@ -31,24 +26,55 @@ end, {}) map('n', '<leader>fs', function() builtin.grep_string({ search = vim.fn.input("Grep > ") }) end, {}) --- -map("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" }) +-- mini +map('n', '-', '<cmd>lua MiniFiles.open()<CR>') +map('n', '<leader>wt', '<cmd>lua MiniTrailspace.trim()<CR>') + +-- toggleterm +map('n', '<leader>g', '<cmd>lua _lazygit_toggle()<CR>') + +-- misc plugin keymaps map('n', '<leader>u', vim.cmd.UndotreeToggle) -map('n', '<PageUp>', vim.cmd.BufferLineCycleNext) -map('n', '<PageDown>', vim.cmd.BufferLineCyclePrev) -map('n', '<leader>br', vim.cmd.BufDel) --- --- window resizing --- --- map('n', '<S-Left>', ':vertical resize -2<CR>', { silent = true }) --- map('n', '<S-Right>', ':vertical resize +2<CR>', { silent = true }) --- map('n', '<S-Up>', ':resize +2<CR>', { silent = true }) --- map('n', '<S-Down>', ':resize -2<CR>', { silent = true }) +map('n', '<C-h>', vim.cmd.HopWord) -map('n', '<C-p>', ':MarkdownPreview<CR>', { silent = true }) +map('n', '<leader>vv', vim.cmd.VimtexCompile) +map('n', '<leader>vc', '<cmd>VimtexClean!<CR>') + +map('n', '<leader>tw', '<cmd>Twilight<CR>') + +-- buffers +map('n', '<PageUp>', '<cmd>bnext<CR>') +map('n', '<PageDown>', '<cmd>bprevious<CR>') +map('n', '<leader>br', '<cmd>BufferClose<CR>') +map('n', '<leader>Q', '<cmd>BufferClose!<CR>') +map('n', '<leader>bn', '<cmd>BufferOrderByBufferNumber<CR>') +map('n', '<leader>U', '<cmd>bufdo bd<CR>') --close all +map('n', '<leader>vs', '<cmd>vsplit<CR><cmd>bnext<CR>') --ver split + open next buffer +-- buffer position nav + reorder +map('n', '<A-Left>', '<cmd>BufferMovePrevious<CR>') +map('n', '<A-Right>', '<cmd>BufferMoveNext<CR>') +map('n', '<A-1>', '<cmd>BufferGoto 1<CR>') +map('n', '<A-2>', '<cmd>BufferGoto 2<CR>') +map('n', '<A-3>', '<cmd>BufferGoto 3<CR>') +map('n', '<A-4>', '<cmd>BufferGoto 4<CR>') +map('n', '<A-5>', '<cmd>BufferGoto 5<CR>') +map('n', '<A-6>', '<cmd>BufferGoto 6<CR>') +map('n', '<A-7>', '<cmd>BufferGoto 7<CR>') +map('n', '<A-8>', '<cmd>BufferGoto 8<CR>') +map('n', '<A-9>', '<cmd>BufferGoto 9<CR>') +map('n', '<A-0>', '<cmd>BufferLast<CR>') +map('n', '<A-p>', '<cmd>BufferPin<CR>') + +-- window resizing +map('n', '<S-Left>', ':vertical resize -2<CR>') +map('n', '<S-Right>', ':vertical resize +2<CR>') +map('n', '<S-Up>', ':resize +2<CR>') +map('n', '<S-Down>', ':resize -2<CR>') + +-- clipboard management map('x', 'p', '\"_dP') map('n', '<leader>y', '\"+y') @@ -58,31 +84,11 @@ map('n', '<leader>Y', '\"+Y') map('n', '<leader>d', '\"+d') map('v', '<leader>d', '\"+d') -map('n', '<leader>js', ':vertical botright Repl julia<CR>') -map('n', '<leader>jr', function() - vim.cmd.ReplSend(string.format('include("%s")', vim.fn.expand('%:p'))) -end) -map('n', '<leader>j;', function() - vim.cmd.ReplSend(string.format('include("%s");', vim.fn.expand('%:p'))) -end) - -map('n', '<C-h>', vim.cmd.HopWord) - -map('n', '<leader>vv', vim.cmd.VimtexCompile) -map('n', '<leader>vc', ':VimtexClean!<CR>') - -map('i', '<C-f>', [[<Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"'<CR><CR>:w<CR>]], opts) -map('n', '<C-f>', [[: silent exec '!inkscape-figures edit "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &'<CR><CR>:redraw!<CR>]], opts) - -map('i', '<C-x>', [[<Esc>: silent exec '.!xoppdog shake "'.getline('.').'" "'.b:vimtex.root.'/figures/"'<CR><CR>:w<CR>]], opts) -map('n', '<C-x>', [[: silent exec '!xoppdog fetch "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &'<CR><CR>:redraw!<CR>]], opts) - +-- luasnip vim.cmd([[ -imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>' -inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<Cr> +imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>' +inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<CR> -snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<Cr> -snoremap <silent> <S-Tab> <cmd>lua require('luasnip').jump(-1)<Cr> +snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<CR> +snoremap <silent> <S-Tab> <cmd>lua require('luasnip').jump(-1)<CR> ]]) - -map('n', '<leader>xx', function() require('trouble').toggle() end) diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua index 2a81dc2..5974579 100644 --- a/nvim/lua/options.lua +++ b/nvim/lua/options.lua @@ -1,27 +1,36 @@ -vim.opt.nu = true -vim.opt.relativenumber = true +vim.cmd "set undofile" +-- vim.opt.isfname:append("@-@") +vim.g.mapleader = ' ' -vim.opt.tabstop = 4 -vim.opt.softtabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.expandtab = true +local options = { + nu = true, + relativenumber = true, -vim.opt.smartindent = false -vim.opt.autoindent = true + tabstop = 4, + softtabstop = 4, + shiftwidth = 4, + expandtab = true, -vim.opt.wrap = false + smartindent = false, + autoindent = true, -vim.opt.hlsearch = false -vim.opt.incsearch = true + wrap = false, -vim.opt.scrolloff = 8 -vim.opt.signcolumn = "no" -vim.opt.cursorline = true -vim.opt.cursorlineopt = "number" -vim.opt.isfname:append("@-@") + hlsearch = false, + incsearch = true, -vim.cmd "set undofile" + scrolloff = 8, + signcolumn = "no", + cursorline = true, + cursorlineopt = "number", -vim.g.mapleader = ' ' + ignorecase = true, + smartcase = true, + + guifont = "FiraCode:h10", + showmode = false, +} -vim.opt.guifont = "FiraCode:h10" +for k, v in pairs(options) do + vim.opt[k] = v +end |