comparison .chezmoitemplates/init.lua @ 632:ca2687d578d2

Add which-key for lesser used keymaps
author zegervdv <zegervdv@me.com>
date Sat, 06 Aug 2022 11:31:13 +0200
parents 6372f0542bed
children 9f040a50eac8
comparison
equal deleted inserted replaced
631:6372f0542bed 632:ca2687d578d2
94 end, 94 end,
95 } 95 }
96 end, 96 end,
97 } 97 }
98 use { 'tpope/vim-git', ft = { 'gitcommit', 'gitrebase' } } 98 use { 'tpope/vim-git', ft = { 'gitcommit', 'gitrebase' } }
99 use { 'sindrets/diffview.nvim', config = function() require('diffview').setup {} end }
100 99
101 -- Comments 100 -- Comments
102 use { 101 use {
103 'numToStr/Comment.nvim', 102 'numToStr/Comment.nvim',
104 config = function() 103 config = function()
239 local nmap = function(lhs, rhs, opts) return vim.keymap.set('n', lhs, rhs, opts) end 238 local nmap = function(lhs, rhs, opts) return vim.keymap.set('n', lhs, rhs, opts) end
240 nmap('<c-h>', require('Navigator').left, { silent = true }) 239 nmap('<c-h>', require('Navigator').left, { silent = true })
241 nmap('<c-j>', require('Navigator').down, { silent = true }) 240 nmap('<c-j>', require('Navigator').down, { silent = true })
242 nmap('<c-k>', require('Navigator').up, { silent = true }) 241 nmap('<c-k>', require('Navigator').up, { silent = true })
243 nmap('<c-l>', require('Navigator').right, { silent = true }) 242 nmap('<c-l>', require('Navigator').right, { silent = true })
243 end,
244 }
245
246 -- Keymap help
247 use {
248 'folke/which-key.nvim',
249 config = function()
250 require('which-key').setup {
251 triggers = { '<leader>', 'g', '<c-w>', '"', '`' },
252 }
244 end, 253 end,
245 } 254 }
246 255
247 -- Completion/snippets/LSP 256 -- Completion/snippets/LSP
248 use { 'neovim/nvim-lspconfig' } 257 use { 'neovim/nvim-lspconfig' }
884 end 893 end
885 end 894 end
886 map('v', '>', keep_visual_selection '>', { expr = true, silent = true, desc = 'Indent right while keeping selection' }) 895 map('v', '>', keep_visual_selection '>', { expr = true, silent = true, desc = 'Indent right while keeping selection' })
887 map('v', '<', keep_visual_selection '<', { expr = true, silent = true, desc = 'Indent left while keeping selection' }) 896 map('v', '<', keep_visual_selection '<', { expr = true, silent = true, desc = 'Indent left while keeping selection' })
888 897
889 -- Swap backticks and quotes
890 map('n', '`', "'")
891 map('n', "'", '`')
892
893 -- Do not move on * 898 -- Do not move on *
894 map('n', '*', function() 899 map('n', '*', function()
895 local view = vim.fn.winsaveview() 900 local view = vim.fn.winsaveview()
896 vim.cmd.normal { '*', bang = true } 901 vim.cmd.normal { '*', bang = true }
897 vim.fn.winrestview(view) 902 vim.fn.winrestview(view)