mirror of
				https://github.com/WarrenHood/dotfiles.git
				synced 2025-11-04 01:38:41 +00:00 
			
		
		
		
	Setup pane/window nav and ToggleTerm, and allow passing opts in map function
This commit is contained in:
		
							parent
							
								
									cf4ebea204
								
							
						
					
					
						commit
						36bea988a7
					
				| 
						 | 
				
			
			@ -1,5 +1,9 @@
 | 
			
		|||
local function map(m, k, v)
 | 
			
		||||
	vim.keymap.set(m, k, v, {silent = true})
 | 
			
		||||
local function map(m, k, v, opts)
 | 
			
		||||
    opts = opts or {}
 | 
			
		||||
    if not opts['silent'] then
 | 
			
		||||
        opts['silent'] = true
 | 
			
		||||
    end
 | 
			
		||||
	vim.keymap.set(m, k, v, opts)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -13,10 +17,25 @@ map('i', '<C-S>', '<ESC>:w<CR>')
 | 
			
		|||
 | 
			
		||||
-- Telescope
 | 
			
		||||
local telescope_builtin = require('telescope.builtin')
 | 
			
		||||
map('n', '<leader>ff', telescope_builtin.find_files)
 | 
			
		||||
map('n', '<leader>fg', telescope_builtin.live_grep)
 | 
			
		||||
map('n', '<leader>fb', telescope_builtin.buffers)
 | 
			
		||||
map('n', '<leader>fh', telescope_builtin.help_tags)
 | 
			
		||||
map('n', '<leader>ff', telescope_builtin.find_files, { desc = 'Find Files' })
 | 
			
		||||
map('n', '<leader>fg', telescope_builtin.live_grep, { desc =  'Live Grep'})
 | 
			
		||||
map('n', '<leader>fb', telescope_builtin.buffers, { desc = 'Find Buffers'})
 | 
			
		||||
map('n', '<leader>fh', telescope_builtin.help_tags, { desc = 'Help Tags' })
 | 
			
		||||
 | 
			
		||||
-- NvimTree Toggle (File Explorer)
 | 
			
		||||
map('n', '<C-B>', ':NvimTreeToggle<CR>')
 | 
			
		||||
 | 
			
		||||
-- ToggleTerm
 | 
			
		||||
map('n', '<C-t>', ':ToggleTerm<CR>')
 | 
			
		||||
map('t', '<C-t>', '<C-\\><C-n>:ToggleTerm<CR>')
 | 
			
		||||
 | 
			
		||||
-- Pane navigation
 | 
			
		||||
map('n', '<C-h>', ':wincmd h<CR>')
 | 
			
		||||
map('n', '<C-j>', ':wincmd j<CR>')
 | 
			
		||||
map('n', '<C-k>', ':wincmd k<CR>')
 | 
			
		||||
map('n', '<C-l>', ':wincmd l<CR>')
 | 
			
		||||
 | 
			
		||||
map('t', '<C-h>', '<C-\\><C-n>:wincmd h<CR>')
 | 
			
		||||
map('t', '<C-j>', '<C-\\><C-n>:wincmd j<CR>')
 | 
			
		||||
map('t', '<C-k>', '<C-\\><C-n>:wincmd k<CR>')
 | 
			
		||||
map('t', '<C-l>', '<C-\\><C-n>:wincmd l<CR>')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,3 +22,6 @@ require'nvim-treesitter.configs'.setup {
 | 
			
		|||
    additional_vim_regex_highlighting = false,
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue