home: vim: use 'which-key'
This commit is contained in:
parent
fa836d7df9
commit
19889f4cbf
|
@ -1,10 +0,0 @@
|
||||||
" Visual bindings for merging diffs as in normal mode
|
|
||||||
xnoremap dp :diffput<cr>
|
|
||||||
xnoremap do :diffget<cr>
|
|
||||||
|
|
||||||
" Open status window
|
|
||||||
nnoremap <Leader>gs :Gstatus<CR>
|
|
||||||
" Open diff view of current buffer: the up/left window is the current index
|
|
||||||
nnoremap <Leader>gd :Gdiffsplit!<CR>
|
|
||||||
" Open current file log in new tab, populate its location list with history
|
|
||||||
nnoremap <Leader>gl :sp<CR><C-w>T:Gllog --follow -- %:p<CR>
|
|
|
@ -1,5 +1,13 @@
|
||||||
" Only git-tracked files, Vim needs to be in a Git repository
|
lua << EOF
|
||||||
nnoremap <Leader>ff :GFiles<CR>
|
local wk = require("which-key")
|
||||||
|
|
||||||
" Currently open buffers
|
local keys = {
|
||||||
nnoremap <Leader>fb :Buffers<CR>
|
f = {
|
||||||
|
name = "Fuzzy finder",
|
||||||
|
b = { "<cmd>Buffers<CR>", "Open buffers" },
|
||||||
|
f = { "<cmd>GFiles<CR>", "Git tracked files" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
wk.register(keys, { prefix = "<leader>" })
|
||||||
|
EOF
|
||||||
|
|
20
home/vim/after/plugin/mappings/git.vim
Normal file
20
home/vim/after/plugin/mappings/git.vim
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
lua << EOF
|
||||||
|
local wk = require("which-key")
|
||||||
|
|
||||||
|
local keys = {
|
||||||
|
d = {
|
||||||
|
name = "Merging diff hunks",
|
||||||
|
o = { "<cmd>diffget<CR>", "Use this buffer's change", mode="x" },
|
||||||
|
p = { "<cmd>diffput<CR>", "Accept other buffer change", mode="x" },
|
||||||
|
},
|
||||||
|
["<leader>g"] = {
|
||||||
|
name = "Git",
|
||||||
|
d = { "<cmd>Gdiffsplit<CR>", "Current buffer diff" },
|
||||||
|
l = { "<cmd>:sp<CR><C-w>T:Gllog --follow -- %:p<CR>", "Current buffer log" },
|
||||||
|
m = { "<Plug>(git-messenger)", "Current line blame" },
|
||||||
|
s = { "<cmd>Gstatus<CR>", "Status" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
wk.register(keys)
|
||||||
|
EOF
|
|
@ -1,5 +1,10 @@
|
||||||
" Run make silently, then skip the 'Press ENTER to continue'
|
lua << EOF
|
||||||
noremap <Leader>m :silent! :make! \| :redraw!<CR>
|
local wk = require("which-key")
|
||||||
|
|
||||||
" Remove search-highlighting
|
local keys = {
|
||||||
noremap <Leader><Leader> :nohls<CR>
|
m = { "<cmd>silent! :make! | :redraw!<CR>", "Run make" },
|
||||||
|
["<leader>"] = { "<cmd>nohls<CR>", "Clear search highlight" },
|
||||||
|
}
|
||||||
|
|
||||||
|
wk.register(keys, { prefix = "<leader>" })
|
||||||
|
EOF
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
" Toggle quick-fix and location lists
|
lua << EOF
|
||||||
nmap <Leader>tf <Plug>(qf_qf_toggle)
|
local wk = require("which-key")
|
||||||
nmap <Leader>tl <Plug>(qf_loc_toggle)
|
|
||||||
|
local keys = {
|
||||||
|
["t"] = {
|
||||||
|
name = "Toggle",
|
||||||
|
f = { "<Plug>(qf_qf_toggle)", "Toggle quickfix list" },
|
||||||
|
l = { "<Plug>(qf_loc_toggle)", "Toggle location list" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
wk.register(keys, { prefix = "<leader>" })
|
||||||
|
EOF
|
||||||
|
|
Loading…
Reference in a new issue