summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/mappings.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/mappings.lua')
-rw-r--r--.config/nvim/lua/mappings.lua25
1 files changed, 16 insertions, 9 deletions
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua
index 1402d14..bc7f380 100644
--- a/.config/nvim/lua/mappings.lua
+++ b/.config/nvim/lua/mappings.lua
@@ -22,21 +22,19 @@ vim.cmd([[
-- TODO fix this
-- resize with arrows
-vim.cmd([[
- nnoremap <silent> <C-Up> :resize -2<CR>
- nnoremap <silent> <C-Down> :resize +2<CR>
- nnoremap <silent> <C-Left> :vertical resize -2<CR>
- nnoremap <silent> <C-Right> :vertical resize +2<CR>
-]])
+vim.api.nvim_set_keymap('n', '<C-Up>', ':resize -2<CR>', {silent = true})
+vim.api.nvim_set_keymap('n', '<C-Down>', ':resize +2<CR>', {silent = true})
+vim.api.nvim_set_keymap('n', '<C-Left>', ':vertical resize -2<CR>', {silent = true})
+vim.api.nvim_set_keymap('n', '<C-Right>', ':vertical resize +2<CR>', {silent = true})
-- better indenting
vim.api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true})
vim.api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true})
-- I hate escape
--- vim.api.nvim_set_keymap('i', 'jk', '<ESC>', {noremap = true, silent = true})
--- vim.api.nvim_set_keymap('i', 'kj', '<ESC>', {noremap = true, silent = true})
--- vim.api.nvim_set_keymap('i', 'jj', '<ESC>', {noremap = true, silent = true})
+vim.api.nvim_set_keymap('i', 'jk', '<ESC>', {noremap = true, silent = true})
+vim.api.nvim_set_keymap('i', 'kj', '<ESC>', {noremap = true, silent = true})
+vim.api.nvim_set_keymap('i', 'jj', '<ESC>', {noremap = true, silent = true})
-- Tab switch buffer
vim.api.nvim_set_keymap('n', '<TAB>', ':bnext<CR>', {noremap = true, silent = true})
@@ -49,3 +47,12 @@ vim.api.nvim_set_keymap('x', 'J', ':move \'>+1<CR>gv-gv', {noremap = true, silen
-- Better nav for omnicomplete
vim.cmd('inoremap <expr> <c-j> (\"\\<C-n>\")')
vim.cmd('inoremap <expr> <c-k> (\"\\<C-p>\")')
+
+-- fix to get netrw's gx command to work correctly
+vim.api.nvim_set_keymap('n', 'gx', ":call netrw#BrowseX(expand((exists('g:netrw_gx')? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr>", {noremap = true, silent = true})
+
+vim.cmd('vnoremap p "0p')
+vim.cmd('vnoremap P "0P')
+
+-- Toggle the QuickFix window
+vim.api.nvim_set_keymap('', '<C-q>', ':call QuickFixToggle()<CR>', {noremap = true, silent = true})