" File : keybindings.vim " Author : Jeff LANCE " Date : 15.04.2015 " Last Modified Date: 06.09.2021 " Last Modified By : Jeff LANCE """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " _ _________ ______ ___ _ _ ____ ___ _ _ ____ ____ " | |/ / ____\ \ / / __ )_ _| \ | | _ \_ _| \ | |/ ___/ ___| " | ' /| _| \ V /| _ \| || \| | | | | || \| | | _\___ \ " | . \| |___ | | | |_) | || |\ | |_| | || |\ | |_| |___) | " |_|\_\_____| |_| |____/___|_| \_|____/___|_| \_|\____|____/ " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Custom {{{ " ----- " Disable highlights when you press : map :noh " Enable folding with the spacebar nnoremap za " Source current file map s :echom 'Source file' :so % " Two semicolons to escape map ; map! ; " Open a current file with sudo " map E :e suda://% " Save a current file with sudo " map W :w suda://% " Comment the target of a motion map / :Commentary " Indent line map >> map << " (Re|Un)do map uu " Save as map :saveas " ----- " }}} " Buffers {{{ " ----- command! -bang -nargs=? -complete=dir Files \ call fzf#vim#files( \ , \ fzf#vim#with_preview( \ {'options': ['--layout=reverse', '--info=inline']} \ ), \ 0 \ ) map :echom 'Close buffer' :call BufClose() map :e map :DashboardNewFile map :bn map :bp " ----- " }}} " Windows {{{ " ----- map :call WinMove('h') map :call WinMove('j') map :call WinMove('k') map :call WinMove('l') " ----- " }}} " Dashboard {{{ " ----- nmap ss :SessionSave nmap sl :SessionLoad nnoremap fh :DashboardFindHistory nnoremap ff :DashboardFindFile nnoremap tc :DashboardChangeColorscheme nnoremap fa :DashboardFindWord nnoremap fb :DashboardJumpMark nnoremap cn :DashboardNewFile " ----- " }}} " Defx {{{ " ----- map :Defx function! s:defx_toggle_tree() abort " Open current file, or toggle directory expand/collapse if defx#is_directory() return defx#do_action('open_or_close_tree') endif return defx#do_action('drop') endfunction autocmd FileType defx call s:defx_my_settings() function! s:defx_my_settings() abort " Define mappings " nnoremap defx#do_action('drop') nnoremap \ defx#is_directory() ? \ defx#do_action('open_directory') : \ defx#do_action('multi', ['drop', 'quit']) nnoremap c \ defx#do_action('copy') nnoremap m \ defx#do_action('move') nnoremap p \ defx#do_action('paste') nnoremap l \ defx#do_action('open') nnoremap E \ defx#do_action('open', 'vsplit') nnoremap P \ defx#do_action('open', 'pedit') nnoremap o \ defx#do_action('open_or_close_tree') nnoremap K \ defx#do_action('new_directory') nnoremap N \ defx#do_action('new_file') nnoremap M \ defx#do_action('new_multiple_files') nnoremap C \ defx#do_action('toggle_columns', \ 'mark:indent:icon:filename:type:size:time') nnoremap S \ defx#do_action('toggle_sort', 'time') nnoremap d \ defx#do_action('remove') nnoremap r \ defx#do_action('rename') nnoremap ! \ defx#do_action('execute_command') nnoremap x \ defx#do_action('execute_system') nnoremap yy \ defx#do_action('yank_path') nnoremap . \ defx#do_action('toggle_ignored_files') nnoremap ; \ defx#do_action('repeat') nnoremap h \ defx#do_action('cd', ['..']) nnoremap ~ \ defx#do_action('cd') nnoremap q \ defx#do_action('quit') nnoremap \ defx#do_action('toggle_select') . 'j' nnoremap * \ defx#do_action('toggle_select_all') nnoremap j \ line('.') == line('$') ? 'gg' : 'j' nnoremap k \ line('.') == 1 ? 'G' : 'k' nnoremap \ defx#do_action('redraw') nnoremap \ defx#do_action('print') nnoremap cd \ defx#do_action('change_vim_cwd') endfunction " ----- " }}} " FZF {{{ " ----- map :DashboardFindFile " ----- " }}} " Header {{{ " ----- map :AddHeader " ----- " }}} " Vimroom {{{ " ----- nnoremap z :Goyo " ----- " }}} " Vimux {{{ " ----- map vp :VimuxPromptCommand " map vr :VimuxRunCommand " map vo :VimuxOpenRunner " ----- " }}} " Functions {{{ " ----- " Renaming map r :call RenameFile() " Open file under cursor map o :call GotoFile("") " Surround map ' S' map " S" map [ S[ map { S{ map ( S( " " Rewrap paragraph using " map {gq}:echo "Rewrapped paragraph" " Git map Gs :Git status map Ga :Git add map Gc :Git commit " ----- " }}} " vim:ft=vim