more mappings, change leader to space

This commit is contained in:
mokou 2021-06-01 15:03:36 +02:00
parent eb3f9b7286
commit d9337614ae
3 changed files with 52 additions and 2 deletions

View file

@ -3,6 +3,55 @@ local set_keymap = require('common').set_keymap
-- reload vimrc
set_keymap('n', '<leader>sv', '<cmd>Reload<cr>')
-- basic
set_keymap('n', '<leader>q', '<cmd>q!<cr>')
set_keymap('n', '<leader>x', '<cmd>x<cr>')
-- moving
set_keymap('n', '<c-a>', '<Esc>I')
set_keymap('n', 'j', 'gj')
set_keymap('n', 'k', 'gk')
-- editing
set_keymap('n', 'Y', 'y$')
set_keymap('n', '<a-Up>', '<cmd>m .-2<cr>')
set_keymap('n', '<a-Down>', '<cmd>m .+1<cr>')
set_keymap('i', '<c-d>', '<Esc>ddi')
-- splits
set_keymap('n', '<leader>s', '<c-w>v')
set_keymap('n', '<leader>j', '<c-w>j')
set_keymap('n', '<leader>k', '<c-w>k')
set_keymap('n', '<leader>h', '<c-w>h')
set_keymap('n', '<leader>l', '<c-w>l')
-- tabs
set_keymap('n', '<a-Tab>', 'gT')
set_keymap('n', '<Tab>', 'gt')
set_keymap('n', '<leader>t[', '<cmd>tabmove -1<cr>')
set_keymap('n', '<leader>t]', '<cmd>tabmove +1<cr>')
set_keymap('n', '<leader>1', '1gt')
set_keymap('n', '<leader>2', '2gt')
set_keymap('n', '<leader>3', '3gt')
set_keymap('n', '<leader>4', '4gt')
set_keymap('n', '<leader>5', '5gt')
set_keymap('n', '<leader>6', '6gt')
set_keymap('n', '<leader>7', '7gt')
set_keymap('n', '<leader>8', '8gt')
set_keymap('n', '<leader>9', '9gt')
set_keymap('n', '<leader>0', '<cmd>tablast<cr>')
-- LSP
set_keymap('n', '<leader>ld', '<cmd>lua vim.lsp.buf.definition()<cr>')
set_keymap('n', '<leader>lD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
set_keymap('n', '<leader>lt', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
set_keymap('n', '<leader>li', '<cmd>lua vim.lsp.buf.implementation()<cr>')
set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
set_keymap('n', 'U', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
set_keymap('n', '<leader>lr', '<cmd>lua vim.lsp.buf.references()<cr>')
set_keymap('n', '<leader>ls', '<cmd>lua vim.lsp.buf.document_symbol()<cr>')
set_keymap('n', '<leader>lS', '<cmd>lua vim.lsp.buf.workspace_symbol()<cr>')
set_keymap('n', '<leader>lR', '<cmd>lua vim.lsp.buf.rename()<cr>')
set_keymap('n', '<leader>lf', '<cmd>lua vim.lsp.buf.formatting()<cr>')
-- plug manager
set_keymap('n', '<leader>pi', '<cmd>PaqInstall<cr>')
set_keymap('n', '<leader>pu', '<cmd>PaqUpdate<cr>')
set_keymap('n', '<leader>pc', '<cmd>PaqClean<cr>')
-- hop
set_keymap('n', '<leader>hw', '<cmd>HopWord<cr>')
set_keymap('n', '<leader>hl', '<cmd>HopLine<cr>')

View file

@ -22,8 +22,8 @@ opt.shiftwidth = 2
-- window
opt.number = true
-- editing
vim.g.mapleader = ','
vim.g.maplocalleader = ','
vim.g.mapleader = ' ' --space
vim.g.maplocalleader = ' '
opt.whichwrap = 'b,s,<,>,[,]'
opt.backspace = {'indent', 'eol', 'start'}
opt.list = true

View file

@ -3,6 +3,7 @@ require('telescope').load_extension('heading')
local set_keymap = require('../common').set_keymap
set_keymap('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
set_keymap('n', '<leader>p', '<cmd>Telescope find_files<cr>') -- alternative cuz im used to it from vscode
set_keymap('n', '<leader>fd', '<cmd>Telescope git_files<cr>')
set_keymap('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
set_keymap('n', '<leader>fb', '<cmd>Telescope buffers')