Skip to content

Commit

Permalink
keymap updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxWolf-01 committed Nov 26, 2024
1 parent 8a75bf7 commit 0d9fcf5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions nvim/lua/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local opts = { -- default options

map("n", "<leader>d", ":Dashboard<CR>", opts) -- show dashboard: https://github.com/nvimdev/dashboard-nvim
map("n", "U", "<NOP>", opts) -- disable U (scary behvaior)
map("n", "<leader>ca", ":%y<CR>", opts) -- copy all
-- Scroling and finding
map("n", "<C-d>", "<C-d>zz", opts) -- centered cursor when scrolling down
map("n", "<C-u>", "<C-u>zz", opts) -- centered cursor when scrolling up
Expand All @@ -20,7 +21,7 @@ map("n", "<C-s>", ":w<CR>", opts) -- ctrl+s saves in normal ...
map("i", "<C-s>", "<Esc>:w<CR>a", opts) -- ... and in insert mode returns to insert
map('n', '<leader>ww', ':w<CR>') -- save with space+ww
map('n', '<leader>wq', ':wq<CR>') -- quit with space+wq
map('n', '<leader>qq', ':qq<CR>') -- save quit with space+qq
map('n', '<leader>qq', ':q<CR>') -- save quit with space+qq
map("x", "<leader>p", "\"_dP", opts) -- preserve paste register when pasting over selection
-- Directory Navigation
map('n', '<leader>cd', ':cd %:p:h<CR>:pwd<CR>') -- cd to dir of current file and show it
Expand Down Expand Up @@ -52,12 +53,12 @@ map('n', '<leader>cdwr', function() -- window-local cd to git root of current fi
end
end)
-- window splits
vim.keymap.set('n', '<leader>vv', ':vsplit<CR>')
vim.keymap.set('n', '<leader>vh', ':split<CR>')
map('n', '<leader>vv', ':vsplit<CR>', opts)
map('n', '<leader>vh', ':split<CR>', opts)
-- window resizing
map('n', '<S-A-h>', ':vertical resize +4<CR>')
map('n', '<S-A-j>', ':resize -4<CR>')
map('n', '<S-A-k>', ':resize +4<CR>')
map('n', '<S-A-h>', ':vertical resize +4<CR>', opts)
map('n', '<S-A-j>', ':resize -4<CR>', opts)
map('n', '<S-A-k>', ':resize +4<CR>', opts)
-- use ALT+{h,j,k,l} to navigate windows from any mode
map("t", "<A-h>", "<C-\\><C-N><C-w>h", opts)
map("t", "<A-j>", "<C-\\><C-N><C-w>j", opts)
Expand All @@ -75,7 +76,7 @@ map('n', '<S-A-l>', ':vertical resize -4<CR>')
-- terminal stuff: http://neovim.io/doc/user/terminal.html#terminal
map('n', '<leader>tt', ':lcd %:p:h<CR>:terminal<CR>', opts) -- open terminal in dir of current file
map('n', '<leader>T', ':terminal<CR>', opts) -- open terminal in working directory
map('t', '<S-Esc>', '<C-\\><C-n>', opts) -- all other mappings didn't work
map('t', '<S-Esc>', [[<C-\><C-n>]], opts) -- all other mappings didn't work
map('n', '<leader>tr', function() -- terminal in git root (if in git repo)
local handle = io.popen('git rev-parse --is-inside-work-tree 2>/dev/null')
if handle then
Expand Down

0 comments on commit 0d9fcf5

Please sign in to comment.