dotfiles/conf.d/nvim/keybindings.vim

172 lines
3.2 KiB
VimL
Raw Normal View History

2021-02-19 12:14:51 +00:00
" File : keybindings.vim
" Author : Jeff LANCE <email@jefflance.me>
" Date : 15.04.2015
2022-07-21 23:48:28 +00:00
" Last Modified Date: 22.07.2022
2021-02-19 12:14:51 +00:00
" Last Modified By : Jeff LANCE <email@jefflance.me>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" _ _________ ______ ___ _ _ ____ ___ _ _ ____ ____
" | |/ / ____\ \ / / __ )_ _| \ | | _ \_ _| \ | |/ ___/ ___|
" | ' /| _| \ V /| _ \| || \| | | | | || \| | | _\___ \
2021-03-03 16:40:10 +00:00
" | . \| |___ | | | |_) | || |\ | |_| | || |\ | |_| |___) |
2021-02-19 12:14:51 +00:00
" |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/
2021-03-03 16:40:10 +00:00
"
2021-02-19 12:14:51 +00:00
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Custom {{{
" -----
" Disable highlights when you press <leader><cr>:
map <silent> <leader><cr> :noh<cr>
" Enable folding with the spacebar
nnoremap <space> za
" Source current file
map <leader>s :echom 'Source file' <bar> :so %<cr>
" Two semicolons to escape
2021-05-05 19:53:58 +00:00
map <leader>; <Esc>
map! <leader>; <Esc>
2021-02-19 12:14:51 +00:00
" Open a current file with sudo
" map <silent> <leader>E :e suda://%<cr>
" Save a current file with sudo
" map <silent> <leader>W :w suda://%<cr>
" Comment the target of a motion
map <silent> <leader>/ :Commentary<cr>
" Indent line
map <silent> <C-]> >>
map <silent> <C-[> <<
" (Re|Un)do
map <silent> <C-u> uu
" Save as
2021-05-05 19:53:58 +00:00
map <C-s> :saveas<space>
2021-02-19 12:14:51 +00:00
" -----
" }}}
" Buffers {{{
" -----
2022-07-19 22:58:49 +00:00
" command! -bang -nargs=? -complete=dir Files
" \ call fzf#vim#files(
" \ <q-args>,
" \ fzf#vim#with_preview(
" \ {'options': ['--layout=reverse', '--info=inline']}
" \ ),
" \ <bang>0
" \ )
command -bang CloseBuffer :call CloseBuffer()
2022-07-21 18:15:31 +00:00
map <Leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>
map <Leader>fd <cmd>lua require('telescope.builtin').find_files({ cwd = '/home/jeff/dotfiles' })<cr>
2022-07-21 23:48:28 +00:00
map <Leader>fh <cmd>lua require('telescope.builtin').oldfiles()<cr>
map <Leader>cn :echom 'Nouveau fichier' <bar> :DashboardNewFile<cr>
2021-05-05 19:53:58 +00:00
map <C-o> :e<space>
2022-07-21 23:48:28 +00:00
map <C-w> :echom 'Fermeture fichier' <bar> :CloseBuffer!<cr>
2021-06-25 09:19:22 +00:00
map <A-PageDown> :bn<cr>
map <A-PageUp> :bp<cr>
2021-02-19 12:14:51 +00:00
" -----
" }}}
" Windows {{{
" -----
map <C-h> :call WinMove('h')<cr>
map <C-j> :call WinMove('j')<cr>
map <C-k> :call WinMove('k')<cr>
map <C-l> :call WinMove('l')<cr>
" -----
" }}}
" Dashboard {{{
2021-02-19 12:14:51 +00:00
" -----
nmap <Leader>ss :<C-u>SessionSave<CR>
nmap <Leader>sl :<C-u>SessionLoad<CR>
2021-02-19 12:14:51 +00:00
" -----
" }}}
" -----
" }}}
" Header {{{
" -----
map <f4> :AddHeader<cr>
" -----
" }}}
2022-04-23 14:33:28 +00:00
" Markdown {{{
" -----
map <leader>mp :! pandoc "%" -o "%:r".pdf && zathura "%:r".pdf<cr>
" -----
" }}}
2021-02-19 12:14:51 +00:00
" Vimroom {{{
" -----
nnoremap <silent> <leader>z :Goyo<cr>
" -----
" }}}
" Vimux {{{
" -----
map <Leader>vp :VimuxPromptCommand<cr>
" map <Leader>vr :VimuxRunCommand<cr>
" map <Leader>vo :VimuxOpenRunner<cr>
" -----
" }}}
" Functions {{{
" -----
" Renaming
2022-07-21 23:48:28 +00:00
map <leader>fr :call RenameFile()<cr>
2021-02-19 12:14:51 +00:00
" Open file under cursor
2022-07-21 23:48:28 +00:00
map <leader>foc :call GotoFile("")<cr>
2021-02-19 12:14:51 +00:00
2021-03-08 18:51:42 +00:00
" Surround
map <leader>' S'<cr>
map <leader>" S"<cr>
map <leader>[ S[<cr>
map <leader>{ S{<cr>
2021-10-04 19:04:08 +00:00
map <leader>( S(<cr>
2021-02-19 12:14:51 +00:00
2021-03-08 18:51:42 +00:00
" " Rewrap paragraph using <S-q>
" map <silent> <S-q> {gq}<Bar>:echo "Rewrapped paragraph"<CR>
2021-02-19 12:14:51 +00:00
" Git
2021-03-08 18:51:42 +00:00
map <leader>Gs :Git status<cr>
2021-02-19 12:14:51 +00:00
map <leader>Ga :Git add
map <leader>Gc :Git commit
" -----
" }}}
" vim:ft=vim