-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeybindings.vim
More file actions
93 lines (69 loc) · 2.28 KB
/
keybindings.vim
File metadata and controls
93 lines (69 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
" Remap leader to ','
let mapleader = ","
" Show nerdtree with line numbers for easier navigation
map <leader>n :NERDTreeToggle<CR>
map <leader>N :NERDTreeFind<CR>
" Leader-Leader toggles between last open buffers
map <Leader><Leader> <C-^>
" Quickly open/source (.vimrc/.gvimrc)
nmap <Leader>vv :e $HOME/.vimrc<CR>
nmap <Leader>gg :e $HOME/.gvimrc<CR>
nmap <Leader>ss :source $HOME/.vimrc<Bar>:source $HOME/.gvimrc<CR>
nmap <leader>sv :source $HOME/.vimrc<CR>
" Toggle show invisibles
noremap <leader>i :set list!<CR>
" Trim and save
map <Leader>sd :FixWhitespace<CR>:w<CR>
" Movement & wrapped long lines -- solves soft-wrap movement confusion
nnoremap j gj
nnoremap k gk
" Reselect visual block after in/outdent
vnoremap < <gv
vnoremap > >gv
" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Remove annoying F1 help
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" Highlight word at cursor without changing position
nnoremap <Leader>h *<C-O>
" Convert between spaces and tabs
map <Leader>I :set list<CR>:FixWhitespace<CR>
" Clear search
map <silent><Leader>/ :nohls<CR>
" Toggle word wrap
map <Leader>W :set wrap!<CR>
" Toggle spell checking
map <Leader>S :set spell!<CR>
" Cycle between windows with Tab and Shift-Tab
map <silent><Tab> :wincmd w<CR>
map <silent><S-Tab> :wincmd W<CR>
" Quick-quit quickfix window
nmap <silent><Leader>q :cclose<CR>
" Copy relative path to the system pasteboard
nnoremap <silent><Leader>cf :let @*=expand('%')<CR>
" Copy relative path and line number to the system pasteboard
nnoremap <silent><Leader>cF :let @*=expand('%').':'.line('.')<CR>
" TComment bindings
let g:tcommentMapLeaderOp1 = '<Leader>c'
" CtrlP bindings
let g:ctrlp_map = '<Leader>t'
map <Leader>l :CtrlPBuffer<CR>
map <Leader>m :CtrlPMRUFiles<CR>
map <Leader>T :CtrlPClearAllCaches<CR>:CtrlP<CR>
" Markdown bindings
map <Leader>md :set textwidth=80 cc+=80<CR>
" vim-rspec bindings
map <Leader>rt :call RunCurrentSpecFile()<CR>
map <Leader>rs :call RunNearestSpec()<CR>
map <Leader>rl :call RunLastSpec()<CR>
map <Leader>ra :call RunAllSpecs()<CR>
" Toggle comments as invisible
nmap <Leader>Ci :hi! link Comment Ignore<CR>
nmap <Leader>Cc :hi! link Comment Comment<CR>
" Run Syntastic check on current file
nmap <silent><Leader>sc :SyntasticCheck<CR>