-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
1984 lines (1800 loc) · 81.1 KB
/
.vimrc
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Readme
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" {{{
"
" Full Operators
" --------------
"
" y : Yank
" d : Delete
" x : cut
" r : Replace
" c : Change
" e : Exchange (eq to quit, . to apply to same textobj type)
" q : Qomment
"
" > : Align (C-x for generic separator) (EasyAlign)
" < <Left>/<Right> : Indent left / right
"
" Pseudo Operators
" ----------------
"
" ys<obj><brç> : Add open/close <brç> surrounding <obj>
" ds<brç> : Delete open/close surrounding <brç>
" cs<brç1><brç2> : Change open/close surrounding <brç1> by <brç2>
"
" C(u,s,c,m) : Change-Case style of current word to (U)PPER_STYLE, (s)nake_style,
" (C)amelStyle, (m)ixedStyle (Abolish)
" d<Space> : Delete trailing whitespaces on current line or the visual selected
" lines (:StripWhitespace)
" yp / YP : open Yanked list and paste the selected one
" <p / >P : Rotate last Pasted
" <y / >Y : Rotate Yanked list
" ñp / <F2> : Toggle autoformat of last pasted
" [Vis Sel Col]+ : Increment selected column
" [Vis Sel Col]- : Decrement selected column
"
" Text Objects
" ------------
"
" av/iv : in/a Variable-Segment on UPPER_STYLE, snake_style, CamelStyle or mixedStyle
" af/if : in/a Function (doesn't work in functions inside a class?)
" aa/ia : in/a Argument of a function, also w/o separator (auto-seek and count)
" at/it : in/a <Tag>obj</Tag> (auto-seek and count)
" a,/i, : in/a elements between , or separators (auto-seek and count)
" aq/iq : in/a Qomment segment
" au/iu : in/a URIs as textobj
" an/in : in/a Next search match (gn) (works as motion in visual mode)
" aN/iN : in/a prev search match (gN) (works as motion in visual mode)
" al/il : in/a Line, with or without trailing and leading white spaces
" ae/ie : in/a Entire file, with or without trailing and leading empty lines
" ip : in the last Pasted
"
" Pseudo Text Objects
" -------------------
"
" x : single Xaracter
" b<Up/Down> : Between 2 lines (easymotions) (only y, c, d)
" b<Left/Right><char1><char2> : Between 2 chars at any line (easymotions) (only y, c, d)
" <Arrow><target char> : easymotions
" m<char> : from current position to Mark<char>
" <S-Arrows> : direct visual-block selection, and then command
"
" Nav/See (s), Search (ss) and Quickfix (z)
" -----------------------------------------
"
" s<Up> : See prev jump (<C-o>)
" s<Down> : See next jump (<C-i>)
" s<Left> : See prev change (g;)
" s<Right> : See next change (g,)
" s<S-Up/Left> : See begin last changed or pasted (`[)
" s<S-Down/Right> : See end last changed or pasted (`])
"
" ç : see matching braÇet and others (matchit.zip)
" M<char> : Mark current position as <char>
" m<char> : Move to position Marked as <char>
" MM / mm : quick Mark and see
" dM<char><CR> : Delete Mark <char>
"
" se : See Explorer window (NerdTree)
" so : See Outline (ctag)
" sm : See Marks
" swm : See Window marks
" sc : See Changes
" sj : See Jumps
" su : See Undo-tree
" sy : See Yanks
" sr : See Registers (unused because of yanks list / easyclip)
"
" sb : See Buffers
" sab : See (and open) All Buffers
" bb : open last Buffer
"
" sf : See File under cursor
" svf : See File under cursor in a Vertical split
" stf : See File under cursor in a Tab split
"
" svim : See ~/.vimrc
" sprj : See $PWD/.vimprj
"
" In general search results go to quickfix:
"
" ss<Left> : Search symbol occurrences (cscope)
" ss<S-Left> : Search symbol occurrences (easygrep)
" ss<Right> : Search symbol definition (cscope)
" ss<S-Right> : Search symbol declaration (YCM)
" ss<Up> : Search function callers (cscope)
" ss<S-Up> : Search functions called (cscope)
" ss<Down> : Search text occurrences (cscope)
" ss<PageUp> : Search files including this (cscope)
" ssh : Search Header
" sst : Search Test
" ssl : Search Link (normal vim jump)
"
" zz : show / hide current quickfix
" z<Up> : open prev line in the quickfix
" z<Down> : open next line in the quickfix
" z<PageUp> : open prev 10 line in the quickfix
" z<PageDown> : open next 10 line in the quickfix
" z<Left> : open prev quickfix
" z<Right> : open next quickfix
" ze : show error only in quickfix (remove warnings)
"
" Edit, Autocomplete and Snippets (<Insert>)
" ------------------------------------------
"
" In Normal Mode:
"
" a<Arrows> : add a line above or below, or go to begin and end of line insert mode
" ax<Arrow> : add a single line up or down, or space before or after cursor
" ax<char> : add single 'char' on/before cursor
" ;; : add ending ;
"
" <Insert><Insert> : list and inserts snippet (Ultisnips)
" <Insert>{ : Add pairs {} at the of end of the line above and on the line below
" d<Insert>{ : Delete pairs {} at the of end of the line above and on the line below
"
" In Insert Mode:
"
" <C-v> : paste (also works on command mode)
" <C-u> : next key will be inserted as raw (with escape characters)
" <Insert> : launch/list snippets in insert/normal modes (Ultisnips)
" if<Insert> : if
" el<Insert> : else
" ife<Insert> : if/else
" for<Insert> : for
" wh<Insert> : while
" fun<Insert> : function
" fund<Insert>: function declaration
"
" ñycm / <F4> : toggle autocomplete (SwitchYCM)
"
" Windows (w) and Buffers (b)
" ---------------------------
"
" <S-PageUp> : Move Up to the begin of file
" <S-PageDown>: Move Down to the end of file
" <C-PageUp> : Scroll Up
" <C-PageDown>: Scroll Down
"
" w<Arrow> : Select neighbor window (also <M-Arrow> if tmux on correct tmux)
" w<PageUp> : Select prev tab (also <M-PageUp>)
" w<PageDown> : Select next tab (also <M-PageDown>)
" w<Tab><Tab> : :vsplit (also w|)
" w<Tab><L/R> : :vsplit current to (existing) Left/Right window
" w<S-L/R> : Swap current window with the one in Left/Right
" w<Tab><Up> : Open new tab with current buffer (keeping prev tab untouched) (also wt)
" w<Tab><Down>: Quit current tab (WQ)
" wb : Break in a new tab
" wq : Quit current window
" WQ : Quit current tab
"
" ww : Maximize / Restore window
" w= : Resize all windows to the same size
" wm : Mark Window
" ws : Swap with marked window
" wj : Join with marked window
" wn : toggle line Numbers on window
" ñw / <F3> : toggle window decorations
"
" tt : Select last Tab
" bb : Select last Buffer
" b<Up> : See next Buffer in buffers list
" b<Down> : See prev Buffer in buffers list
" sb : See Buffers
" sab : See (and open) All Buffers
"
" Folding (fd)
" ------------
"
" fd<CR> / fdfd : Toggle current fold
" fd<Down> : Open all folds
" fd<Up> : Close all folds
" fd<Right> : Open just one level of folding
" fd<Left> : Close one level of folding
"
" Grep: Find or Replace (gf,gr)
" --------------------------
"
" gf : grep and find iw in current file
" gr : grep and replace iw in current file (:s or :S)
" GF : grep and find iw in project (:Replace)
" GR : grep and replace iw in project (:Replace)
"
" Version Control (wd)
" --------------------
"
" wd / wdd : WimDiff current file in a new tab (:Gdiff)
" wda : WimDiff All files in the repo in a new vim with a tab per file
" wdr / wdu : WimDff refresh (:diffupdate)
" wds : :GStatus in new tab - D: diff, -: add/reset, X: checkout/clean,
" cc/ca: commit/amend, r: reload
" wdc : git Commit in new tab (:Gstatus and cc)
" wdb : git Blame in new tab (:Gblame)
" wdp : git Push (:Gpush)
" wdo : git One (:Git log --oneline --graph)
" wde : Edit last repo version (:Gedit)
" wd<Up> : WimDiff prev change
" wd<Down> : WimDiff next change
" wd<Right> : Diff get (assuming being in right-pane of vimdiff)
" wd<Right> : Diff put (assuming being in right-pane of vimdiff)
"
" See Merge Conflicts section for more info.
"
" Project
" -------
"
" sprj : set project options in project_path/.vimprj
" <C-b> : builds the project async (:Make)
" :OpenSession<tab> : list and open sessions
" vim --servername session : to open a saved session (vim-session)
"
" Spell (f)ix
" -----------
"
" f<CR> / f : Toggle spell fix
" f<Right> : See suggestions
" f<Left> : Add word to the dictionary
" f<Down> : Mark word as wrong
"
" Options/Toggles and <F>Keys
" ----------------------------
" / ñg : EasyGrep options
" F1 : paste mode for new pastes (pastetoggle)
" F2 / ñp : paste mode for just pasted (EasyClipToggleFormattedPaste)
" F12 / ÑP : toggle paste autoformat (g:EasyClipAutoFormat)
" F3 / ñw : toggle window decorations (SwitchDecorations)
" / ñ| : toggle textwidth decoration
" F4 / ñycm : toggle autocomplete (SwitchYCM)
" F5 : reload file (:e)
" F6 : reload vimrc
" F7 / ñs : toggle autosave (AutoSaveToggle)
" F11 : list snippets (ListSnippets)
"
" More
" ----
"
" º : Mapleader
" ap : <Space> and paste
" :PluginInstall : regenerates tags
" <C-s> : saves the file
" :W!! : sudo write
" <C-S-t> : restore just closed window by accident
" <C-k> : normal mode in command line (cedit)
" J : :join lines (not https://github.com/sk1418/Join)
" <Tab><Arrows> : EasyMotions
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" EasyAlign Details
" -----------------
" - <Enter> to switch right/left/center alignment *before* the operator
" - <Right>/<Left> to add/remove spaces before the delimiter
" - <Down> /<Up> to remove/add spaces after the delimiter
" - ** to alternate left-right alignment
" - 1,2... or * to specify which delimiters we want to align
" - <C-x> to use regular expression as delimiter instead of single character
" (<C-x> again to save the align)
"
" Merge Conflicts
" ---------------
" Config git:
" - git config merge.tool vimdiff
" - git config merge.conflictstyle diff3
" - git config mergetool.prompt false
"
" Run git to open vim:
" $ git mergetool [filename]
"
" LOCAL – this is file from the current branch
" BASE – common ancestor, how file looked before both changes
" REMOTE – file you are merging into your branch
" MERGED – merge result, this is what gets saved in the repo
"
" In MERGED:
" :diffg RE " get from REMOTE
" :diffg BA " get from BASE
" :diffg LO " get from LOCAL
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TODO: Term and Debug
" TODO: :Glog
" TODO: :Git rebase
"
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General options (set)
"
" See SetMainDefaults for more default options
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" {{{
set nocompatible " use Vim settings, rather than Vi settings
" this must be first, because it changes other options
set encoding=utf-8 " to avoid problems with listchars
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set history=100 " keep 100 lines of command line history
set ruler " show the cursor position all the time
set showcmd " show still incomplete cmdline, eg. commands in visual
set incsearch " show first match while typing the pattern
set mouse=a " use mouse
set ttymouse=sgr " to use mouse on vim borders when vim is run over tmux
set nowrap " avoid wrapping
set diffopt+=vertical " to force vertical diffs by default
set virtualedit=onemore " really go to EOL. See CursorColumnI
set splitright " vsplit on right
set splitbelow " split below
set autowrite " automatically save changes (build without save)
set laststatus=2 " always see status bar. See Coloring highlight mode
set showtabline=2 " always see tab bar. See Coloring highlight mode
set colorcolumn=0 " not see textwidth line. See SwitchDecorations
set nocursorline nocursorcolumn " cursor column and line non visible by default
set autoindent " autoindent
set foldmethod=syntax " use the syntax to decide folding
set nofoldenable " disable folding. Use tagbar and clean code
set pastetoggle=<F1> " remove all auto* features when pasting from X
set scrolloff=10 " to scroll before first/last line
set sidescrolloff=0 " no scroll before first/last char in a line, to vsplit
set sidescroll=10 " to scroll 10 chars when reaching limit (hard limit)
set wildmode=longest:list " to cmdline completion (tab) as in bash
set complete+=kspell " to use spell dict on autocomplete
set spelllang=en_us " spell language
set spellfile=~/.vim/spell/en.utf-8.add " own dictionary in dotfiles
set autoread " file is reloaded if changed on fs
set undofile " for persistent undo
set ignorecase " to search case insensitive
set smartcase " to search case insensitive, unless using an Uppercase
set listchars=tab:>·,eol:· " special characters (see vim-better-whitespace)
set nolist " no special chars (see listchars & SwitchDecorations)
set whichwrap=b,s,<,>,[,] " line up/down with left/right at begin/end of line
set nobackup " no backup files, use git/svn (and persistent undo)
set noswapfile " no swap files, use git/svn (and persistent undo)
set undodir=~/.vim/tmp/ " location of the undo directory
set completeopt=menuone,longest " preview discarded, menuone to read params
set clipboard^=unnamedplus " unamedplus is more keyboard-centric (forces <C-c>)
" unamed could be more practical with mouse from other
" apps, BUT breaks r in visual mode because the
" visual selection is copied to primary
" also, in seems that middle paste magiacally works
" the important part is that we should match tmux:
" unnamed -> xclip -selection primary (VS EasyClip)
" unnamedplus -> xclip -selection clipboard
set termwinkey=º " should be the <Leader> (for term and termdebug)
set timeoutlen=1000 ttimeoutlen=0 " to reduce the return of normal mode faster
set cedit=<C-k> " edit mode in cmode, see other <C-k> maps
set nrformats=bin,octal,hex,alpha " for column incrementing
set wmh=0 " to fully maximize in height
set wmw=0 " to fully maximize in width
set cscopetag " use both cscope and ctag as tags
set csto=0 " use cscope before ctags
set cscopequickfix=s-,g-,c-,d-,i-,t-,e-
" All cscope results are placed in quickfix
set sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize,terminal
" save everything on a session
set grepprg=grep\ -n\ --exclude-dir=.svn\ --exclude-dir=.git\ --exclude-dir=build\ --exclude=.vimprj.cscope\ --exclude=*.orig\ --exclude=compile_commands.json\ $*\ /dev/null
" to exclude svn/git results from search results
" set keywordprg= " used by 'K' (man -s),
set statusline=
set statusline+=%y%h%q%w " file and buffer type
set statusline+=%m%r " status flags
set statusline+=\[%f\:%l\:%c%V\] " filename:line:column
set statusline+=\ %{tagbar#currenttag('[%s]','')} " tag/function (tagbar plugin)
set statusline+=%= " right align remainder
set statusline+=\[char\=0x%B\] " character value
set statusline+=\ \[%p%%\ of\ %L\] " file position
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" More General Options (non-set)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" {{{
let g:netrw_dirhistmax=0 " to avoid .netrwhist creation
let mapleader='º' " i like this one, but I barely use it
runtime ftplugin/man.vim " to be able to render man pages
runtime ftplugin/vim.vim " to use the vim help
packadd termdebug " enable TerminalDebug
" source $VIMRUNTIME/menu.vim " fancy / useless menus with (:emenu<space><tab>)
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins list (vundle)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" {{{
filetype off " required by vundle
set rtp+=~/.vim/bundle/Vundle.vim " required by vundle
call vundle#begin()
" Plugin Manager
Plugin 'VundleVim/Vundle.vim' " let Vundle manage Vundle, required
" Core features
Plugin 'tpope/vim-dispatch.git' " background/async builds
Plugin '907th/vim-auto-save' " auto save
Plugin 'tpope/vim-repeat' " dependency: surround, abolish, easyclip
Plugin 'vim-scripts/visualrepeat' " dependency: easy-align
Plugin 'inkarkat/vim-ingo-library' " dependency: visualrepeat
" Browsing
Plugin 'szw/vim-maximizer' " :MaximizerToggle window
Plugin 'scrooloose/nerdtree.git' " file browser
Plugin 'majutsushi/tagbar' " outline browser
Plugin 'mbbill/undotree' " undotree browser
Plugin 'bufexplorer.zip' " buffer browser
Plugin 'christoomey/vim-tmux-navigator' " <M-Arrows> from/to vim/tmux (local)
Plugin 'kopischke/vim-fetch' " to open files with :line:col suffix
" Version Control and Project Management
Plugin 'vim-scripts/DfrankUtil' " dependency: vimprj
Plugin 'vim-scripts/vimprj' " project option in .vimprj files
Plugin 'dkprice/vim-easygrep' " search and replace for the whole project
Plugin 'romainl/vim-qf' " improve qf: Toggle, :Keep, :Reject
Plugin 'yssl/QFEnter' " improve qf: select where results are open
Plugin 'mhinz/vim-signify' " decorations for git+svn together
Plugin 'xolox/vim-misc' " dependency: vim-session
Plugin 'xolox/vim-session' " save / restore sessions
Plugin 'tpope/vim-fugitive' " git
Plugin 'vimwiki/vimwiki' " markdown and task management
" Auto completion
Plugin 'Valloric/YouCompleteMe' " autocomplete using compilation databases
Plugin 'SirVer/ultisnips' " autoinsert snippets
Plugin 'honza/vim-snippets' " standard snippets (mine on .vim/snippets)
Plugin 'matchit.zip' " improve braçet detection
" use 'runtime macros/matchit.vim' instead?
" Easy motions
Plugin 'easymotion/vim-easymotion' " no count lines or chars, point to them
Plugin 'haya14busa/vim-easyoperator-line' " define a range of lines (only y,d,v)
Plugin 'haya14busa/vim-easyoperator-phrase' " define a range between chars (only y,d,v)
Plugin 'haya14busa/incsearch.vim' " dependency
Plugin 'haya14busa/incsearch-easymotion.vim' " dependency
Plugin 'haya14busa/incsearch-fuzzy.vim' " fuzzy motion
" Window decorations
Plugin 'kshenoy/vim-signature' " see marks (sm)
Plugin 'Yggdroot/indentLine' " see indentation lines (|)
Plugin 'ntpeters/vim-better-whitespace' " see/remove trailing whitespaces
Plugin 'tmux-plugins/vim-tmux-focus-events' " FocusLost & FocusGained events
" tmux.conf: set-g focus-event on
Plugin 'chrisbra/Colorizer' " read terminal colors :ColorToggle
" Text objects
Plugin 'kana/vim-textobj-user' " to create custom text objects
Plugin 'kana/vim-textobj-line' " a (l)ine
Plugin 'kana/vim-textobj-entire' " a (e)ntire file
Plugin 'kana/vim-textobj-function' " a (f)unction
Plugin 'kana/vim-textobj-indent' " a group of similar (i)ndented lines
Plugin 'wellle/targets.vim' " a lot of text objects! and autoseek
Plugin 'Julian/vim-textobj-variable-segment' " a (v)ariable segment in snake_case,
" CamelCase, mixedCase, UPPER_CASE
Plugin 'glts/vim-textobj-comment' " a (q)omment block
Plugin 'saaguero/vim-textobj-pastedtext' " a last (p)asted
Plugin 'jceb/vim-textobj-uri' " a (u)RIs
" Operators
Plugin 'agilmor/vim-easyclip' " basic y, x, d with yanked list (fork to improve end of paste)
Plugin 'tpope/vim-surround' " surroundings braçets
Plugin 'tpope/vim-abolish' " change (C)ase style snake/camel/mixed/upper
Plugin 'tommcdo/vim-exchange' " (e)xchange
Plugin 'tomtom/tcomment_vim' " un/(q)omment
Plugin 'junegunn/vim-easy-align' " easy alisgn (>)
" File plugins
Plugin 'ekalinin/Dockerfile.vim' " dockerfile syntax
Plugin 'martinda/Jenkinsfile-vim-syntax' " jenkinsfile syntax
Plugin 'fedorenchik/qt-support.vim' " Qt files: qml, qmake/pro, qrc, ui..
"
" Deprecated
"
" Plugin 'agilmor/smarttab.vim' " tabs for indent and spaces for align
" (forked to avoid map conflicts)
" (still conflicts some times, discarded)
" (use copyindent, vim should support it)
" Plugin 'vcscommand.vim' " version control git+svn together
" Plugin 'itchyny/calendar.vim' " calendar integrated with google
" Plugin 'vitra' " trac integration
" Plugin 'Align' " used by vitra
" Plugin 'tracwiki' " used by vitra
" Plugin 'agilmor/delimitMate' " autoclose of pairs
" (fork due conflicts leaving insert mode)
" (conflicts with YCM)
" Plugin 'jiangmiao/auto-pairs' " autoclos of pairs
" (annoying, better snippets and surroundings)
" Plugin 'bling/vim-airline' " too fancy for me?
" Plugin 'm42e/vim-gcov-marker' " test coverage
" Plugin 'vim-scripts/gcov.vim' " test coverage
" Plugin 'kana/vim-textobj-lastpat' " last pattern searched (n/N)
" Plugin 'deathlyfrantic/vim-textobj-blanklines' " a group of blank lines
call vundle#end() " required
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Basic FileType Configs
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" {{{
filetype plugin indent on " Enable file type detection.
" Use the default filetype settings
"
" Known extensions
"
au BufRead,BufNewFile .vimprj set filetype=vim
au BufRead,BufNewFile *.build set filetype=python
au BufRead,BufNewFile *.scons set filetype=python
au BufRead,BufNewFile *onstruct set filetype=python
au BufRead,BufNewFile *.hpp set filetype=cpp.doxygen
au BufRead,BufNewFile *.test set filetype=cpp.doxygen
au BufRead,BufNewFile *.launch set filetype=xml
"
" FileType Configs
"
" au FileType help wincmd L " forcing help to be vertical splitted
" au FileType man wincmd L " forcing man to be vertical splitted
au FileType qf wincmd J " forcing quickfix to be full width
au FileType vim set foldmethod=marker " using markers in vim files
"
" Matchit is not working properly on my setup for C/C++?
" (should be in share/.../ftplugin/c.vim)
"
au FileType c,cpp let b:match_words='\%(\<else\s\+\)\@<!\<if\>:\<else\s\+if\>:\<else\%(\s\+if\)\@!\>,\<switch\>:\<case\>:\<default\>'
"
" Reload .vimprj just after writing it
"
autocmd BufWritePost .vimprj source .vimprj
"
" Switching header / source / test
"
au BufRead,BufNewFile,WinEnter *.h nmap ssh :call SeeHeader( g:source_ext, 'l')<CR>
au BufRead,BufNewFile,WinEnter *.hpp nmap ssh :call SeeHeader( g:source_ext, 'l')<CR>
au BufRead,BufNewFile,WinEnter *.c nmap ssh :call SeeHeader( g:header_ext, 'l')<CR>
au BufRead,BufNewFile,WinEnter *.cpp nmap ssh :call SeeHeader( g:header_ext, 'l')<CR>
au BufRead,BufNewFile,WinEnter *.test nmap ssh :call SeeHeader( g:header_ext, 'l')<CR>
au BufRead,BufNewFile,WinEnter *.h nmap sst :call SeeHeader( g:test_ext , 'l')<CR>
au BufRead,BufNewFile,WinEnter *.hpp nmap sst :call SeeHeader( g:test_ext , 'l')<CR>
au BufRead,BufNewFile,WinEnter *.c nmap sst :call SeeHeader( g:test_ext , 'l')<CR>
au BufRead,BufNewFile,WinEnter *.cpp nmap sst :call SeeHeader( g:test_ext , 'l')<CR>
au BufRead,BufNewFile,WinEnter *.test nmap sst :call SeeHeader( g:header_ext, 'l')<CR>
"
" Deprecated
"
" Fixing integration between YCM and smarttab.vim (align+indent) (unnecessary?)
" let ft_smart_indent = ['c', 'cpp', 'py']
" autocmd FileType * if index(ft_smart_indent, &ft) < 0 | autocmd BufEnter <buffer> inoremap <CR> <CR>
" autocmd FileType c,cpp inoremap <buffer> <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-R>=CSmartIndent()<CR>"
" autocmd FileType python inoremap <buffer> <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-R>=PySmartIndent()<CR>"
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins Configuration
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" {{{
"
" ntpeters/vim-better-whitespace
"
let g:better_whitespace_enabled = 1
let g:better_whitespace_verbosity=1
"
" tomtom/tcomment_vim
"
let g:tcommentMapLeaderOp1 = 'q' " use 'q' for the comment action
let g:tcommentOptions = {'col': 1} " line comments on the first column
"
" scrooloose/nerdtree.git
"
let g:NERDTreeCaseSensitiveSort = 0 " don't use case to sort
let g:NERDTreeChDirMode = 0 " never change CWD
let g:NERDTreeHighlightCursorline = 1 " to highlight the current cursor line
let g:NERDTreeHijackNetrw = 0 " to avoid conflicts with VCSStatus
let g:NERDTreeQuitOnOpen = 1 " quit after open a file
let g:NERDTreeShowHidden = 1 " show hidden files by default
let g:NERDTreeShowLineNumbers = 0 " don't show lines
let g:NERDTreeWinPos = "left" " show files explorer at the left
let g:NERDTreeWinSize = 31 " window size
"
" kshenoy/vim-signature
"
let g:SignatureEnabledAtStartup = 0 " not showing marks by default
"
" Auto Save (:AutoSaveToggle)
"
let g:auto_save = 1 " enable AutoSave on Vim startup
let g:auto_save_silent = 0 " display the auto-save notification
let g:auto_save_write_all_buffers = 1 " write all open buffers (like :wa)
let g:auto_save_events = ["CursorHold"] " other possible events:
" InsertLeave, TextChanged, TextChangedI,
" CursorHold, CursorHoldI, CompleteDone
" let g:auto_save_postsave_hook = 'TagsGenerate'
" " :TagsGenerate on save
" let g:auto_save_presave_hook = 'call AbortIfNotGitDirectory()'
" " :AbortIfNotGitDirectory on save
"
" Vimwiki
"
" See ~/.vim/after/ftplugin/vimwiki.vim for autocommands to auto pull/push vimwiki pages
"
" See https://github.com/vimwiki/vimwiki/issues/843#issuecomment-608601395 to register
" vimwikis updating the vimwiki_list:
"
" > You should be able to directly call vimwiki#vars#add_temporary_wiki() similar to
" > what is done for some of the Vader tests. You can also take a look at how temporary
" > wikis are registered in plugin/vimwiki.vim.
"
let g:vimwiki_list = [{'path': '~/workspace/wiki/',
\ 'syntax': 'markdown',
\ 'ext': '.md',
\ 'index': 'Home',
\ 'auto_toc': 1,
\ 'auto_tags': 1}]
let g:vimwiki_list += [{'path': '$PWD/doc/wiki/',
\ 'syntax': 'markdown',
\ 'ext': '.md',
\ 'index': 'Home',
\ 'auto_toc': 1,
\ 'auto_tags': 1}]
let g:vimwiki_global_ext = 0 " avoid messing with registered wikis
let g:vimwiki_hl_headers = 1 " highlight headers
let g:vimwiki_hl_cb_checked = 2 " highlight done/todo items
let g:vimwiki_use_mouse = 1 " enable mouse control
let g:vimwiki_list_ignore_newline = 0 " multiline list items converted to <br />
let g:vimwiki_text_ignore_newline = 0 " multiline text paragraph converted to <br />
let g:vimwiki_use_calendar = 0 " disable calendar
let g:vimwiki_url_maxsave = 30 " size of URL before being reduced
let g:vimwiki_key_mappings =
\ {
\ 'table_format': 0,
\ 'links' : 0,
\ } " to keep <M-Left/Right> and <BS>
"
" YouCompleteMe
"
" let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
" " to avoid waring message
let g:ycm_always_populate_location_list = 1
let g:ycm_max_num_candidates = 50 " 0 no limit, >100 bad performance
let g:ycm_min_num_of_chars_for_completion = 3 " complete soon
" big to disable non-semantic
let g:ycm_auto_trigger = 1 " no need to press a key
let g:ycm_filetype_whitelist = { '*': 1 } " always enabled
let g:ycm_error_symbol = '>'
let g:ycm_warning_symbol = '>'
let g:ycm_enable_diagnostic_signs = 0 " not gutter
let g:ycm_enable_diagnostic_highlighting = 0 " diagnostic not in gutter
let g:ycm_echo_current_diagnostic = 1 " diagnostic in the menu
let g:ycm_open_loclist_on_ycm_diags = 1 " open loclist :YcmDiags
let g:ycm_complete_in_comments = 1 " complete also in comments
let g:ycm_complete_in_strings = 1 " filenames on strings
let g:ycm_use_ultisnips_completer = 1 " ultisnips integration
let g:ycm_goto_buffer_command = 'same-buffer' " 'same-buffer', 'horizontal-split',
" 'vertical-split', 'new-tab',
" 'new-or-existing-tab'
let g:ycm_key_list_select_completion = ['<Down>' ] " no <Tab> bc not works as
let g:ycm_key_list_previous_completion = ['<Up>' ] " a normal bash complete
let g:ycm_key_list_stop_completion = ['<Return>' ] " should use <Esc>, but...
let g:ycm_collect_identifiers_from_tags_files = 0 " not working with ctags
let g:ycm_add_preview_to_completeopt = 0 " preview is too annoying
let g:ycm_collect_identifiers_from_comments_and_strings = 0 " too crazy to enable it
let g:ycm_autoclose_preview_window_after_insertion = 1 " unused?
let g:ycm_autoclose_preview_window_after_completion = 0 " unused?
"
" UltiSnips
"
set rtp^=~/.vim/snippets/ " own snippets preented
let g:UltiSnipsSnippetDirectories = ['UltiSnips'] " just the default, use standard
let g:UltiSnipsEnableSnipMate = 1 " too many...
let g:UltiSnipsExpandTrigger = "<Insert>" " <Insert> is the snips leader
let g:UltiSnipsListSnippets = "<F11>"
let g:UltiSnipsJumpForwardTrigger = "<Tab>"
let g:UltiSnipsJumpBackwardTrigger = "<S-Tab>"
let g:UltiSnipsEditSplit = "vertical" " vsplit to edit snips
" TODO: map snip like sprj
let g:UltiSnipsRemoveSelectModeMappings = 1 " printable chars not mapped in
" select mode
let g:UltiSnipsSnippetsDir = '~/.vim/snippets/UltiSnips' " my own snippets
" TODO: using these two?
let g:rs = '< ' " arguments separators
let g:re = ' >'
"
" svermeulen/vim-easyclip
"
let g:EasyClipUseGlobalPasteToggle = 0 " to use my maps (<F1>)
let g:EasyClipUsePasteToggleDefaults = 0 " to use my maps (,y and -y)
let g:EasyClipUseCutDefaults = 0 " to use my maps (x)
let g:EasyClipUseSubstituteDefaults = 0 " to use my maps (r)
let g:EasyClipUseYankDefaults = 1 " default yanks are ok (y)
let g:EasyClipUsePasteDefaults = 1 " default paste are ok (p)
let g:EasyClipAlwaysMoveCursorToEndOfPaste = 1 " move to end of paste (,j to go back)
let g:EasyClipAutoFormat = 1 " enable autoformat, see <F2>, <F12>
let g:EasyClipShareYanks = 0 " disabled to improve performance
let g:EasyClipCopyExplicitRegisterToDefault = 1 " paste last yanked, even if registered
let g:EasyClipPreserveCursorPositionAfterYank = 1 " not move my cursor!
let g:EasyClipShowYanksWidth = 100 " we have bigger screens
let g:EasyOperator_phrase_do_mapping = 0 " to be able to have fuzzysearch
"
" tommcdo/vim-exchange
"
let g:exchange_no_mappings = 1 " to avoid cx auto mappings
" let g:exchange_indent = '==' " to exchange indentation?
"
" EasyMotion - Options
"
let g:EasyMotion_enter_jump_first = 1 " quick selection
let g:EasyMotion_space_jump_first = 0 " use space as target key
let g:EasyMotion_use_upper = 1 " better readability
let g:EasyMotion_keys = 'asdfqwertzxcvbglokijmnp ' " 1st left hand keys
let g:EasyMotion_startofline = 0 " to move to EOL and SOL
" let g:EasyMotion_smartcase = 1 " case insensitive
" " (use ignorecase+smartcase)
"
" junegunn/vim-easy-align
"
let g:easy_align_ignore_groups = [] " 'Comments' and 'Strings' can be aligned...
"
" mhinz/vim-signify
"
let g:signify_disable_by_default = 1 " Use :SignifyToggle
let g:signify_sign_change = 'M'
"
" vim-scripts/vimprj
"
let g:vimprj_changeCurDirIfVimprjFound = 1 " change PWD to where the .vimprj file is
let g:header_ext='hpp' " each project defines extension (.h or .hpp)
let g:source_ext='cpp' " each project defines extension (.c or .cpp)
let g:test_ext='test' " each project defines extension (eg .test)
"
" xolox/vim-session
"
let g:session_directory = '~/.vim-sessions' " save sessions out of dotfiles (.vim)
let g:session_lock_enabled = 0 " avoid annoying locked sessions
let g:session_autoload = 'prompt' " no default session to load
let g:session_autosave = 'yes' " save sassion when closing vim
let g:session_autosave_periodic = 1 " save the session every minute
let g:session_autosave_silent = 0 " still want to see saving session
let g:session_command_aliases = 1 " Session* command to autocomplete
"
" dkprice/vim-easygrep
"
let g:EasyGrepMode = 0 " 0 all files / 2 - based on files extension
let g:EasyGrepCommand = 1 " 0 vimgrep / 1 grep
let g:EasyGrepRoot = "cwd" " use current dir
let g:EasyGrepRecursive = 1 " recursive files search
let g:EasyGrepIgnoreCase = 0 " use case
let g:EasyGrepHidden = 0 " not hidden
let g:EasyGrepFilesToExclude = "*bkp*" " files to exclude (not working with vimgrep)
let g:EasyGrepAllOptionsInExplorer = 1 " to show all options in the menu
let g:EasyGrepOpenWindowOnMatch = 1 " automatically opens the quickfix window
let g:EasyGrepWindow = 0 " Use Quickfix (not Location)
let g:EasyGrepEveryMatch = 1 " disable multiple matches in same line
let g:EasyGrepJumpToMatch = 0 " not autojumping
let g:EasyGrepReplaceAllPerFile = 1 " less global replace
let g:EasyGrepReplaceWindowMode = 2 " no open tab or splits (use autowrite)
"
" wellle/targets.vim
"
let g:targets_aiAI = 'aIAi' " to ignore whitespaces with 'i' and add them with 'I'
let g:targets_nl = 'Ññ' " to be able to use i/al for lines, and i/an/N for serch match
"
" saaguero/vim-textobj-pastedtext
"
let g:pastedtext_select_key = 'ip' " using ip instead of gb as last pasted text-obj
"
" glts/vim-textobj-comment
"
let g:textobj_comment_no_default_key_mappings = 1 " textobj-comment: (aq) (iq) (aQ)
"
" christoomey/vim-tmux-navigator
"
let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_disable_when_zoomed = 1 " avoid vim to be unzoom
"
" szw/vim-maximizer
"
let g:maximizer_restore_on_winleave = 1 " to restore when leaving maximized, like tmux
let g:maximizer_set_default_mapping = 0 " to use <F3> for other usage
"
" bufexplorer.zip
"
let g:bufExplorerDefaultHelp = 1 " show default help
let g:bufExplorerDetailedHelp = 0 " don't show detailed help
let g:bufExplorerDisableDefaultKeyMapping = 0 " don't disable mapping
let g:bufExplorerFindActive = 1 " go to active window
let g:bufExplorerReverseSort = 0 " don't sort in reverse order
let g:bufExplorerShowDirectories = 1 " show directories
let g:bufExplorerShowNoName = 0 " don't 'No Name' buffers
let g:bufExplorerShowRelativePath = 1 " show relative paths
let g:bufExplorerShowTabBuffer = 0 " no tabs
let g:bufExplorerShowUnlisted = 0 " do not show unlisted buffers
let g:bufExplorerSortBy = 'mru' " sort by most recently used
let g:bufExplorerVertSize = 0 " new split windows size set by Vim
"
" Yggdroot/indentLine
"
let g:indentLine_enabled = 0 " disabled by default, see SwitchDecorations
let g:indentLine_leadingSpaceEnabled = 0
let g:indentLine_char = "|"
let g:indentLine_first_char = "|"
let g:indentLine_indentLevel = 10
let g:indentLine_showFirstIndentLevel = 1
"
" majutsushi/tagbar
"
let g:tagbar_autoclose = 0 " no autoclose tagbar when selection done (so)
"
" romainl/vim-qf
"
let g:qf_auto_open_quickfix = 1
let g:qf_window_bottom = 1 " quickfix at the bottom
let g:qf_auto_quit = 1 " when qf is the last window
let g:qf_save_win_view = 1 " save view of current window when toggling qf window
let g:qf_nowrap = 1 " no wrapping in qf
let g:qf_auto_resize = 0 " no resizing less than qf size
let g:qf_mapping_ack_style = 1 " s - open entry in a new horizontal window
" v - open entry in a new vertical window
" t - open entry in a new tab
" o - open entry and come back
" O - open entry and close the location/quickfix window
" p - open entry in a preview window
" let g:qf_statusline = {}
" let g:qf_statusline.before = '%<\ '
" let g:qf_statusline.after = '\ %f%=%l\/%-6L\ \ \ \ \ '
"
" QFEnter
"
let g:qfenter_keymap = {}
let g:qfenter_keymap.open = ['<CR>', '<2-LeftMouse>']
let g:qfenter_keymap.vopen = ['<Space>']
let g:qfenter_keymap.hopen = ['<Leader><CR>']
let g:qfenter_keymap.topen = ['<Leader><Tab>']
"
" chrisbra/Colorizer
"
let g:colorizer_disable_bufleave = 1 " keep terminal coloring when leaving the buffer
let g:colorizer_auto_map = 0 " no automapping for :ColorToogle and :ColorHighlight
"
" Deprecated
"
" OmniCpp Options
" let OmniCpp_NamespaceSearch = 1
" let OmniCpp_GlobalScopeSearch = 1
" let OmniCpp_ShowAccess = 1
" let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
" let OmniCpp_MayCompleteDot = 0 " autocomplete after .
" let OmniCpp_MayCompleteArrow = 0 " autocomplete after ->
" let OmniCpp_MayCompleteScope = 0 " autocomplete after ::
" let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" CodeComplete
" let g:completekey = '<C-q>' " avoid conflicts with normal omnicomplete
" let g:completekey = '<S-Tab>' " avoid conflicts with normal omnicomplete
" AutoPairs in insert mode
" let g:AutoPairsShortcutToggle = '<F4>' " Enable/Disable AutoPairs
" let g:AutoPairsFlyMode = 0 " fly several brackets when closing bracket
" let g:AutoPairsShortcutBackInsert = '<C-l>' " disable just pressed fly bracket
" let g:AutoPairsShortcutJump = '<C-j>' " jump to next closed pair (annoying)
" let g:AutoPairsMapBS = 1 " map <Backspace> to remove in pairs
" let g:AutoPairsMapCh = 1 " to remove brackets in pairs
" let g:AutoPairsMapCR = 1 " to map <Return>
" let g:AutoPairsCenterLine = 1 " center current line after <Return>
" let g:AutoPairsMapSpace = 1 " to map <Space>
" let g:AutoPairsMultilineClose = 1 " to change line after closing bracket
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Normal, Visual and Insert Mappings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" {{{
nmap ap <Space><Esc>p
nnoremap a<Up> O
nnoremap a<Down> o
nnoremap a<Left> I
nnoremap a<Right> A
nnoremap ax :<C-u>call MyRepeatChar("i")<CR>
nnoremap ax<Return> :<C-u>call MyRepeatChar("i")<CR><CR>^
nnoremap AX :<C-u>call MyRepeatChar("a")<CR>
nnoremap AX<Return> :<C-u>call MyRepeatChar("a")<CR><CR>^
nnoremap ax<Up> O<Esc>
nnoremap ax<Down> o<Esc>
nnoremap ax<Left> i<Space><Esc>
nnoremap ax<Right> a<Space><Esc>
nnoremap bb :b#<CR>
nmap bd <Plug>Kwbd
nnoremap b<Up> :bnext<CR>
nnoremap b<Down> :bprevious<CR>
" map b <Plug>(easymotion-bd-w)
" map bb <Plug>(easymotion-bd-w)
" map b<Right> <Plug>(easymotion-w)
" map b<Left> <Plug>(easymotion-b)
nnoremap cx s
nnoremap Cx ~
nnoremap CX ~
nmap Cs crs
nmap Cc crm
nmap Cm crc
nmap Cu cru
xnoremap C ~
nmap d<Insert>{ }dd{<Left>d<End>
nmap d<Space> :.StripWhitespace<CR>
nmap db<Up> <Plug>(easyoperator-line-delete)
nmap db<Down> <Plug>(easyoperator-line-delete)
nmap db<Left> <Plug>(easyoperator-phrase-delete)
nmap db<Right> <Plug>(easyoperator-phrase-delete)
nmap DD dd<Up>
nnoremap dM :delmarks
nnoremap dm d`
nnoremap dmm d`M
nnoremap dx x
nmap e <Plug>(Exchange)
xmap e <Plug>(Exchange)
nmap ee <Plug>(ExchangeLine)
nmap ec <Plug>(ExchangeClear)
nmap eq <Plug>(ExchangeClear)
nmap ex v<Plug>(Exchange)
" map e <Plug>(easymotion-bd-e)
" map ee <Plug>(easymotion-bd-e)
" map e<Right> <Plug>(easymotion-e)
" map e<Left> <Plug>(easymotion-ge)
nmap E :e $SLURM_BUG_PATH/
nnoremap ff :set spell!<CR>
nnoremap f<Return> :set spell!<CR>
nnoremap f<Left> zg
nnoremap f<Right> z=
nnoremap f<Down> zw
nnoremap fdfd za
nnoremap fd<Return> za
nnoremap fd<Down> zR
nnoremap fd<Up> zM
nnoremap fd<Right> zr
nnoremap fd<Left> zm
nmap gf yiw:grep <C-v> %
nmap GF yiw:grep -R <C-v> ./
vmap gf y:grep <C-v> %