1
0
forked from extern/nix-config
donovanglover-nix-config/dots/common/.vim/keybindings.vim

52 lines
2.3 KiB
VimL
Raw Normal View History

2018-02-28 02:31:44 +01:00
" New Start: A modern Arch workflow built with an emphasis on functionality.
" Copyright (C) 2017-2018 Donovan Glover
" Change the global leader to the space bar
let mapleader = ' '
" ================== Top row
nnoremap <silent> <leader>e :set nu!<CR>
nnoremap <silent> <leader>r :call matchadd('OverLength', '\%101v', 100)<CR>
nnoremap <silent> <leader>t :OverCommandLine<CR>%s/
2017-12-27 05:59:11 +01:00
nnoremap <silent> <leader>y :bn<CR>
nnoremap <silent> <leader>u <C-w>w
nnoremap <silent> <leader>i <C-w><C-p>
nnoremap <silent> <leader>o <C-d>
nnoremap <silent> <leader>p <C-u>
" ================== Middle row
2018-01-18 05:38:14 +01:00
"nnoremap <silent> <leader>a :NERDTreeToggle<CR>
nnoremap <silent> <leader>a :Files<CR>
"nnoremap <silent> <leader>d :TagbarToggle<CR>
2018-01-18 05:38:14 +01:00
nnoremap <silent> <leader>f :Files<CR>
nnoremap <silent> <leader>g :set hlsearch!<CR>
" Easily jump between lines in all open files
2018-01-18 05:38:14 +01:00
nnoremap <silent> <leader>j :Buffers<CR>
nnoremap <silent> <leader>k :Lines<CR>
" This is the same as f, but I haven't figured out which
" letter I like using better yet
nnoremap <silent> <leader>l :Files<CR>
" Easily open new files in horizontal and vertical splits
nnoremap <silent> <leader>; :split<CR> <C-w>w :Files<CR>
nnoremap <silent> <leader>' :vsplit<CR> <C-w>w :Files<CR>
" ================== Bottom row
nnoremap <silent> <leader>v :Ack! "\b<cword>\b"<CR>
nnoremap <silent> <leader>n o<Esc>
nnoremap <silent> <leader>m O<Esc>
" Bind the right beautify function based on what file is open
2017-12-28 05:56:27 +01:00
autocmd FileType javascript nnoremap <silent> <leader>b :call JsBeautify()<CR>
autocmd FileType json nnoremap <silent> <leader>b :call JsonBeautify()<CR>
autocmd FileType jsx nnoremap <silent> <leader>b :call JsxBeautify()<CR>
autocmd FileType html nnoremap <silent> <leader>b :call HtmlBeautify()<CR>
autocmd FileType css nnoremap <silent> <leader>b :call CSSBeautify()<CR>
" Easily enter 'zen mode' with Goyo and Pencil
" We have to explicitly set vertsplit again since Goyo resets it for some reason
nnoremap <silent> <leader>2 :PencilSoft<CR>:Goyo<CR>:hi vertsplit ctermfg=8 ctermbg=none<CR>
nnoremap <silent> <leader>3 :mksession! ~/.vim_session<CR>
nnoremap <silent> <leader>4 :source ~/.vim_session<CR>
2018-08-31 19:43:14 +02:00
" Close the current buffer without closing the window
" Useful for when you want to close a buffer with VimFiler open
nnoremap <silent> <leader>5 :bp<bar>sp<bar>bn<bar>bd<CR>