dotfiles/conf.d/nvim/keybindings.vim

178 lines
3.3 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
" Last Modified Date: 06.09.2021
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 {{{
" -----
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(
\ <q-args>,
\ fzf#vim#with_preview(
\ {'options': ['--layout=reverse', '--info=inline']}
\ ),
\ <bang>0
\ )
map <C-w> :echom 'Close buffer' <bar> :call BufClose()<cr>
2021-05-05 19:53:58 +00:00
map <C-o> :e<space>
map <C-n> :DashboardNewFile<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>
nnoremap <silent> <Leader>fh :DashboardFindHistory<CR>
2022-07-18 15:36:58 +00:00
nnoremap <silent> <Leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>
nnoremap <silent> <Leader>tc :DashboardChangeColorscheme<CR>
nnoremap <silent> <Leader>fa :DashboardFindWord<CR>
nnoremap <silent> <Leader>fb :DashboardJumpMark<CR>
nnoremap <silent> <Leader>cn :DashboardNewFile<CR>
2021-02-19 12:14:51 +00:00
" -----
" }}}
2022-07-18 15:36:58 +00:00
" Find file {{{
2021-02-19 12:14:51 +00:00
" -----
2022-07-18 15:36:58 +00:00
map <C-f> <cmd>lua require('telescope.builtin').find_files()<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
map <leader>r :call RenameFile()<cr>
" Open file under cursor
map <leader>o :call GotoFile("")<cr>
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