Add descriptions to Harpoon and Cheat Sheet key mappings and include Dressing plugin in custom plugins
This commit is contained in:
		
							parent
							
								
									b366efced2
								
							
						
					
					
						commit
						e7b27047e2
					
				|  | @ -1,8 +1,8 @@ | ||||||
| local mark = require("harpoon.mark") | local mark = require("harpoon.mark") | ||||||
| local ui = require("harpoon.ui") | local ui = require("harpoon.ui") | ||||||
| 
 | 
 | ||||||
| vim.keymap.set("n", "<leader>ha", mark.add_file) | vim.keymap.set("n", "<leader>ha", mark.add_file, { desc = "[H]arpoon [A]dd" }) | ||||||
| vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) | vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) | ||||||
| 
 | 
 | ||||||
| vim.keymap.set("n", "<leader>hn", function() ui.nav_next() end) | vim.keymap.set("n", "<leader>hn", function() ui.nav_next() end, { desc = "[H]arpoon [N]ext" }) | ||||||
| vim.keymap.set("n", "<leader>hp", function() ui.nav_prev() end) | vim.keymap.set("n", "<leader>hp", function() ui.nav_prev() end, { desc = "[H]arpoon [P]revious" }) | ||||||
|  |  | ||||||
|  | @ -50,6 +50,9 @@ keymap('n', '<leader>Y', "\"+Y", { desc = "[Y]ank to clipboard" }) | ||||||
| -- Open folder in workspace in tmux session | -- Open folder in workspace in tmux session | ||||||
| keymap("n", "<leader>op", "<cmd>silent !tmux neww tmux-sessionizer<CR>", { desc = "[O]pen [P]roject" }) | keymap("n", "<leader>op", "<cmd>silent !tmux neww tmux-sessionizer<CR>", { desc = "[O]pen [P]roject" }) | ||||||
| 
 | 
 | ||||||
|  | -- Search cheat sheet | ||||||
|  | keymap("n", "<leader>ch", "<cmd>silent !tmux neww tmux-cht.sh<CR>", { desc = "[C]heat [S]heet" }) | ||||||
|  | 
 | ||||||
| -- replace selected word in the file | -- replace selected word in the file | ||||||
| keymap("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], { desc = "[R]eplace words in the file" }) | keymap("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], { desc = "[R]eplace words in the file" }) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -0,0 +1,36 @@ | ||||||
|  | function! Redir(cmd, rng, start, end) | ||||||
|  | 	for win in range(1, winnr('$')) | ||||||
|  | 		if getwinvar(win, 'scratch') | ||||||
|  | 			execute win . 'windo close' | ||||||
|  | 		endif | ||||||
|  | 	endfor | ||||||
|  | 	if a:cmd =~ '^!' | ||||||
|  | 		let cmd = a:cmd =~' %' | ||||||
|  | 			\ ? matchstr(substitute(a:cmd, ' %', ' ' . shellescape(escape(expand('%:p'), '\')), ''), '^!\zs.*') | ||||||
|  | 			\ : matchstr(a:cmd, '^!\zs.*') | ||||||
|  | 		if a:rng == 0 | ||||||
|  | 			let output = systemlist(cmd) | ||||||
|  | 		else | ||||||
|  | 			let joined_lines = join(getline(a:start, a:end), '\n') | ||||||
|  | 			let cleaned_lines = substitute(shellescape(joined_lines), "'\\\\''", "\\\\'", 'g') | ||||||
|  | 			let output = systemlist(cmd . " <<< $" . cleaned_lines) | ||||||
|  | 		endif | ||||||
|  | 	else | ||||||
|  | 		redir => output | ||||||
|  | 		execute a:cmd | ||||||
|  | 		redir END | ||||||
|  | 		let output = split(output, "\n") | ||||||
|  | 	endif | ||||||
|  | 	vnew | ||||||
|  | 	let w:scratch = 1 | ||||||
|  | 	setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile | ||||||
|  | 	call setline(1, output) | ||||||
|  | endfunction | ||||||
|  | 
 | ||||||
|  | " This command definition includes -bar, so that it is possible to "chain" Vim commands. | ||||||
|  | " Side effect: double quotes can't be used in external commands | ||||||
|  | command! -nargs=1 -complete=command -bar -range Redir silent call Redir(<q-args>, <range>, <line1>, <line2>) | ||||||
|  | 
 | ||||||
|  | " This command definition doesn't include -bar, so that it is possible to use double quotes in external commands. | ||||||
|  | " Side effect: Vim commands can't be "chained". | ||||||
|  | command! -nargs=1 -complete=command -range Redir silent call Redir(<q-args>, <range>, <line1>, <line2>) | ||||||
|  | @ -7,5 +7,6 @@ return { | ||||||
|   'mbbill/undotree', |   'mbbill/undotree', | ||||||
|   'famiu/bufdelete.nvim', |   'famiu/bufdelete.nvim', | ||||||
|   'ThePrimeagen/harpoon', |   'ThePrimeagen/harpoon', | ||||||
|   'ThePrimeagen/vim-be-good' |   'ThePrimeagen/vim-be-good', | ||||||
|  |   'stevearc/dressing.nvim' | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue