Skip to content

Commit

Permalink
new bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Pistonight committed Aug 7, 2023
1 parent 948e91e commit 62e6a09
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/public/home/.config/nvim/after/plugin/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local function on_attach_nvim_tree(bufnr)
nowait = true
}
end
vim.keymap.set('n', 'K', api.node.show_info_popup, opts('Info'))
vim.keymap.set('n', '<C-k>', api.node.show_info_popup, opts('Info'))
vim.keymap.set('n', 'O', api.node.navigate.parent_close, opts('Close parent'))
vim.keymap.set('n', 'P', api.node.navigate.parent, opts('Go to parent'))
vim.keymap.set('n', 'm', api.fs.rename_sub, opts('Move'))
Expand Down
11 changes: 10 additions & 1 deletion src/public/home/.config/nvim/lua/keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ end)
-- turn off search highlight
noremap('n', '<leader> ', vim.cmd.nohlsearch)

-- git merge
noremap('n', '<leader>mo', '<cmd>NvimTreeClose<cr><cmd>Gvdiffsplit!<cr>')
noremap('n', '<leader>mb', '<cmd>diffget //2<cr>')
noremap('n', '<leader>mn', '<cmd>diffget //3<cr>')
noremap('n', '<leader>mc', '<cmd>bdelete //3<cr><cmd>bdelete //2<cr><cmd>NvimTreeOpen<cr>')

-- cursor movement
-- 15 lines is about where the text moves and I can still see what's going on
noremap('n', '<C-d>', '15j') -- bukl move down
noremap('n', '<C-u>', '15k') -- bulk move up
noremap('n', 'n', 'nzz') -- move to next match and center
noremap('n', 'N', 'nzz') -- move to previous match and center
noremap('n', 'N', 'Nzz') -- move to previous match and center

-- line movement (note: the : cannot be replaced by <cmd>)
noremap('v', '<A-j>', [[:m '>+1<cr>gv=gv]]) -- move selection down
Expand Down Expand Up @@ -64,3 +70,6 @@ noremap('v', '<leader>y', '"+y')

-- swap left and right buffers
noremap('n', '<leader>w', '<cmd>NvimTreeClose<cr><C-w>r<cmd>NvimTreeOpen<cr><C-W>l')
-- duplicate split view to other side
noremap('n', '<leader>dl', '<C-w>l<cmd>q<cr><C-w>v') --left to right
noremap('n', '<leader>dh', '<C-w>h<cmd>q<cr><C-w>v') --right to left
2 changes: 2 additions & 0 deletions src/public/home/.config/nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ return require("packer").startup(function(use)
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-nvim-lsp-signature-help'
use 'hrsh7th/cmp-nvim-lua'
-- git
use 'tpope/vim-fugitive'
end)
2 changes: 2 additions & 0 deletions src/tool/nvim.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Here are some of my key mappings. I use the default leader key.
|`<C-W>+`|Increase window height by 10|N/A|
|`<C-W>-`|Decrease window height by 10|N/A|
|`<leader>w`|Switch left and right (rotate buffer positions)|N/A|
|`<leader>dh`|Clone right panel to left panel|N/A|
|`<leader>dl`|Clone left panel to right panel|N/A|
|`<leader>c`|Comment out line/selection|N/A|
|`<leader>u`|Toggle undotree|undotree|
|`<leader>y`|Yank selection to host clipboard|N/A|
Expand Down

0 comments on commit 62e6a09

Please sign in to comment.