-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit.vim
More file actions
1481 lines (1300 loc) · 50.3 KB
/
init.vim
File metadata and controls
1481 lines (1300 loc) · 50.3 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
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
"*****************************************************************************
"" Plugins
"*****************************************************************************
" https://github.com/sheerun/vim-polyglot#troubleshooting
let g:polyglot_disabled = ['markdown']
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
" https://github.com/glacambre/firenvim/issues/1285#issuecomment-1004578943
set laststatus=0
if exists('g:started_by_firenvim')
let g:firenvim_config = {
\ 'globalSettings': {
\ "alt": "all",
\ "cmdlineTimeout": 0
\ }
\ }
endif
let g:vim_bootstrap_langs = "python"
let g:vim_bootstrap_editor = "nvim" " nvim or vim
if !filereadable(vimplug_exists)
if !executable("curl")
echoerr "You have to install curl or first install vim-plug yourself!"
execute "q!"
endif
echo "Installing Vim-Plug..."
echo ""
silent exec "!\curl -fLo " . vimplug_exists . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
let g:not_finish_vimplug = "yes"
autocmd VimEnter * PlugInstall
endif
" Required:
call plug#begin(expand('~/.config/nvim/plugged'))
"*****************************************************************************
"" Plug install packages
"*****************************************************************************
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'preservim/nerdtree' |
\ Plug 'Xuyuanp/nerdtree-git-plugin' |
\ Plug 'ryanoasis/vim-devicons'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-speeddating'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-obsession'
Plug 'tpope/vim-rhubarb' " required by fugitive to :Gbrowse
Plug 'tommcdo/vim-exchange'
Plug 'justinmk/vim-sneak'
Plug 'mbbill/undotree'
Plug 'simnalamburt/vim-mundo'
Plug 'jiangmiao/auto-pairs'
Plug 'SirVer/ultisnips'
Plug 'rkitover/vimpager'
Plug 'szw/vim-maximizer'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
if isdirectory('/opt/homebrew/opt/fzf')
Plug '/opt/homebrew/opt/fzf' | Plug 'junegunn/fzf.vim'
else
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
endif
"" Snippets
Plug 'honza/vim-snippets'
"" Color
Plug 'LunarVim/onedarker.nvim'
"" REPL
Plug 'jpalardy/vim-slime', { 'branch': 'main' }
"" Python
Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
" https://cirw.in/blog/bracketed-paste
Plug 'ConradIrwin/vim-bracketed-paste'
" The main R plugin providing RStudio-esque features
" Nvim-R handles citation of its own: https://github.com/jalvesaq/Nvim-R/issues/346
Plug 'jalvesaq/Nvim-R'
" https://github.com/quarto-dev/quarto-nvim
" Plug 'quarto-dev/quarto-nvim'
" Plug 'neovim/nvim-lspconfig'
" Plug 'jmbuhr/otter.nvim'
" https://github.com/neovim/neovim/issues/1822#issuecomment-233152833
Plug 'bfredl/nvim-miniyank'
" R setup: https://kadekillary.work/post/nvim-r/
" R setup: https://github.com/beigebrucewayne/vim-ide-4-all/blob/master/R-neovim.md
" For Rmarkdown syntax
Plug 'vim-pandoc/vim-rmarkdown'
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
" From Vimcast 73: http://vimcasts.org/episodes/neovim-eyecandy/
" Plug 'machakann/vim-highlightedyank'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
Plug 'bronson/vim-trailing-whitespace'
Plug 'godlygeek/tabular'
call plug#end()
"*****************************************************************************
"" Basic Setup
"*****************************************************************************"
" Required:
filetype plugin indent on
" Firenvim settings
if !has('gui_vimr')
set guifont=Ewka\ Nerd\ Font:h28
endif
" enable omni-completion
set omnifunc=syntaxcomplete#Complete
"" Encoding
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8
set ttyfast
"" Fix backspace indent
set backspace=indent,eol,start
"" Tabs. May be overridden by autocmd rules
set tabstop=4
set softtabstop=0
set shiftwidth=4
set expandtab
"" Map leader to ,
let mapleader=' '
let maplocalleader='\'
" https://stackoverflow.com/questions/16622566/how-to-solve-the-collision-of-tab-key-mapping-of-ultisnips-plugin-in-the-vim
" This seems to be necessary for coc tab completion to work
let g:UltiSnipsExpandTrigger = "<f5>"
" https://github.com/jiangmiao/auto-pairs#shortcuts
let g:AutoPairsShortcutBackInsert = "<M-i>"
let g:AutoPairsShortcutFastWrap = "<M-w>"
let g:AutoPairsMapCR = 0
"" Enable hidden buffers
set hidden
"" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
set fileformats=unix,dos,mac
set nrformats=alpha
set formatoptions=croqj
if exists('$SHELL')
set shell=$SHELL
else
set shell=/bin/sh
endif
"*****************************************************************************
"" Visual Settings
"*****************************************************************************
syntax on
set ruler
" Use vim-unimpaired's yon and yor to toggle set number and relativenumber
let no_buffers_menu=1
let g:pandoc#syntax#conceal#use=0
silent! colorscheme onedarker
set mousemodel=popup
set t_Co=256
set guioptions=egmrti
set title
set titleold="Terminal"
set titlestring=%F
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
if exists("*fugitive#statusline")
set statusline+=%{fugitive#statusline()}
endif
"*****************************************************************************
"" Custom configs
"*****************************************************************************
" https://github.com/jpalardy/vim-slime#tmux
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": "default", "target_pane": "{last}"}
let g:slime_dont_ask_default = 1
let g:slime_cell_delimiter = "# %%"
" Remove all vim slime mappings (remapped below)
let g:slime_no_mappings = 1
" Syntax highlight
" Default highlight is better than polyglot
let g:polyglot_disabled = ['python']
let python_highlight_all = 1
" Remove all vim surround mappings (remapped below)
let g:surround_no_mappings = 1
" vim-pandoc inserts citations with <C-x><C-o>
" disable automatic folding by vim-pandoc
let g:pandoc#modules#disabled = ["folding"]
let g:pandoc#syntax#conceal#blacklist = ["codeblock_start", "codeblock_delim"]
" In addition to vim-pandoc, zotcite and nvim-r can insert citations
" https://github.com/jalvesaq/Nvim-R/blob/master/doc/Nvim-R.txt#L1940"
set completeopt=longest,menuone
" https://neovim.io/doc/user/options.html#'autowrite'
set autowrite
" https://jovicailic.org/2017/04/vim-persistent-undo/
set undofile
set undodir=~/.local/share/nvim/undo
" https://www.johnhawthorn.com/2012/09/vi-escape-delays/
set timeoutlen=1000 ttimeoutlen=10
"" Directories for swp files
set nobackup
set noswapfile
set nowritebackup
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
" https://vim.fandom.com/wiki/Avoiding_the_%22Hit_ENTER_to_continue%22_prompts
set shortmess=a
" (In times of great desperation) allow use of the mouse
set mouse=a
" https://github.com/neovim/neovim/wiki/FAQ#how-to-change-cursor-shape-in-the-terminal
set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,a:blinkon100
" Share system clipboard ("+) and unnamed ("") registers
" http://vimcasts.org/episodes/accessing-the-system-clipboard-from-vim/
" http://vimcasts.org/blog/2013/11/getting-vim-with-clipboard-support/
set clipboard=unnamed
if has('unnamedplus')
set clipboard=unnamed,unnamedplus
endif
set go+=a
" Neovim defaults https://neovim.io/doc/user/vim_diff.html
" 'autoindent' is enabled
" 'background' defaults to "dark" (unless set automatically by the terminal/UI)
" 'belloff' defaults to "all"
" 'compatible' is always disabled
" 'complete' excludes "i"
" 'cscopeverbose' is enabled
" 'history' defaults to 10000 (the maximum)
" 'showcmd' is enabled
" 'sidescroll' defaults to 1
" 'smarttab' is enabled
" 'tabpagemax' defaults to 50
" 'wildmenu' is enabled
" Neovim defaults?
set path+=** " Provides tab-completion for all file-related tasks
set lazyredraw " Don't redraw while executing macros (good performance config)
set showmatch " Show matching brackets when text indicator is over them
set hidden " can put buffer to the background without writing to disk, will remember history/marks.
set fillchars+=vert:│
set laststatus=0
highlight EndOfBuffer ctermbg=NONE guibg=NONE
highlight LineNr ctermbg=NONE guibg=NONE
highlight NonText ctermbg=NONE guibg=NONE
highlight Normal ctermbg=NONE guibg=NONE
highlight SignColumn ctermbg=NONE guibg=NONE
highlight MsgArea ctermbg=NONE guibg=NONE
highlight VertSplit ctermbg=NONE guibg=NONE
highlight pandocEmphasis gui=italic cterm=italic guifg=#ffff00 ctermfg=Yellow
highlight pandocString guifg=#00ff00 ctermfg=Green
highlight pandocNoFormatted guifg=#ff8700 ctermfg=214
"" fzf.vim
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,__pycache__
let $FZF_DEFAULT_OPTS="'--bind=change:top,ctrl-/:toggle-preview,ctrl-n:down,ctrl-p:up,ctrl-k:kill-line,alt-p:toggle-preview,alt-w:toggle-preview-wrap,alt-y:execute-silent(echo {1} | pbcopy)' --cycle --delimiter=':, ' --exit-0 --inline-info --multi --no-height --no-sort --preview='bat --style=numbers --color=always {1}' --preview-window='70%:hidden' --reverse --tiebreak=index"
" Disable visualbell
set noerrorbells visualbell t_vb=
" CamelCaseWord
" let g:camelchar = "A-Z"
" Also stop on numbers.
" let g:camelchar = "A-Z0-9"
" Include '.' for class member, ',' for separator, ';' end-statement, " and <[< bracket starts and "'` quotes.
let g:camelchar = "A-Z0-9.,;:{([`'\""
" http://sherifsoliman.com/2017/07/22/nvim-r/
" press alt+, to have Nvim-R insert the assignment operator: <-
let R_assign_map = "<A-,>"
let R_auto_start = 0
" https://github.com/randy3k/radian#nvim-r-support
let R_esc_term = 0
let R_app = "radian"
let R_cmd = "R"
let R_hl_term = 0
let R_args = [] " if you had set any
let R_bracketed_paste = 1
let R_source = '~/tmux_split.vim'
" https://github.com/jalvesaq/Nvim-R/blob/master/doc/Nvim-R.txt#L1669
" set a minimum source editor width
let R_min_editor_width = 18
" make sure the console is on the right by making it narrow
let R_rconsole_width = 57
" https://www.freecodecamp.org/news/turning-vim-into-an-r-ide-cd9602e8c217/
" let g:rout_follow_colorscheme = 1
" let g:Rout_more_colors = 1
" Don't expand a dataframe to show columns by default
" let R_objbr_opendf = 0
" https://github.com/jalvesaq/Nvim-R/blob/master/doc/Nvim-R.txt#L2152
" Only use the mappings listed below
let R_user_maps_only = 1
" Do not replace grave accent with chunk delimiters in Rmd files
" Use alt-i to insert code chunks instead
let R_rmdchunk = 0
" COC settings
" https://github.com/neoclide/coc.nvim/blob/82c3834f8bfc5d91ce907405722fe0f297e13cff/doc/coc.txt#L1202
let g:coc_global_extensions = ['coc-bibtex', 'coc-git', 'coc-json', 'coc-python', 'coc-r-lsp', 'coc-sh', 'coc-snippets', 'coc-yaml', 'coc-yank']
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
let g:coc_snippet_next = '<tab>'
let g:coc_snippet_prev = '<s-tab>'
"" NERDTree configuration
let g:NERDTreeChDirMode=2
let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let g:NERDTreeShowBookmarks=1
let g:nerdtree_tabs_focus_on_files=1
let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
let g:NERDTreeWinSize = 50
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite
" grep.vim
let Grep_Default_Options = '-IR'
let Grep_Skip_Files = '*.log *.db'
let Grep_Skip_Dirs = '.git node_modules'
set autoread
"*****************************************************************************
"" Abbreviations
"*****************************************************************************
"" No one is really happy until you have this shortcuts
cnoreabbrev W! w!
cnoreabbrev Q! q!
cnoreabbrev Qall! qall!
cnoreabbrev Wq wq
cnoreabbrev Wa wa
cnoreabbrev wQ wq
cnoreabbrev WQ wq
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall
"*****************************************************************************
"" Commands
"*****************************************************************************
" remove trailing whitespaces
command! FixWhitespace :%s/\s\+$//e
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
"*****************************************************************************
"" Autocmd Rules
"*****************************************************************************
"" The PC is fast enough, do syntax highlight syncing from start unless 200 lines
augroup vimrc-sync-fromstart
autocmd!
autocmd BufEnter * :syntax sync maxlines=200
augroup END
" https://vimways.org/2018/formatting-lists-with-vim/
autocmd FileType pandoc,markdown,text setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 formatoptions+=tnp formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s+[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:
" Syntax highlighting for files with weird extensions
autocmd BufNewFile,BufRead .tmux.conf* set syntax=tmux
autocmd BufNewFile,BufRead *radian_profile set syntax=r
autocmd BufNewFile,BufRead *.R set ft=r
autocmd BufNewFile,BufRead shortcuts.jupyterlab-settings set syntax=json
"" Remember cursor position
augroup vimrc-remember-cursor-position
autocmd!
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
augroup END
"" make/cmake
augroup vimrc-make-cmake
autocmd!
autocmd FileType make setlocal noexpandtab
autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake
augroup END
if has('autocmd')
autocmd GUIEnter * set visualbell t_vb=
endif
" python
" vim-python
augroup vimrc-python
autocmd!
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79
\ formatoptions+=croq softtabstop=4
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
augroup END
" Snakemake
au BufNewFile,BufRead Snakefile set syntax=snakemake
au BufNewFile,BufRead *.smk set syntax=snakemake
au BufNewFile,BufRead *.snk set syntax=snakemake
au BufNewFile,BufRead *.snakefile set syntax=snakemake
au FileType snakemake let Comment="#"
au FileType snakemake setlocal completeopt=menuone,longest
au FileType snakemake setlocal tw=79 tabstop=4 shiftwidth=4 softtabstop=4
" Nvim-R mappings
autocmd FileType r,rmd nnoremap <buffer> <C-w>a :!wmctrl -r "R Graphics" -b add,above
autocmd FileType r,rmd nnoremap <buffer> <C-w>A :!wmctrl -r "R Graphics" -b remove,above
" Keyboard shortcuts for <- -> and other operators in R specific files
" https://github.com/jalvesaq/Nvim-R/issues/85
" The trailing spaces below are intentional!
autocmd FileType r,rmd inoremap <buffer> <A-n> <Esc>:normal! a %>%<CR>a<CR>
autocmd FileType r,rmd inoremap <buffer> <A-m> <Esc>:normal! a %>%<CR>a
autocmd FileType r,rmd inoremap <buffer> <A-i> <Esc>:normal! a %in%<CR>a
autocmd FileType r,rmd inoremap <buffer> <A-,> <Esc>:normal! a <-<CR>a
autocmd FileType r,rmd inoremap <buffer> <A-.> <Esc>:normal! a -><CR>a
autocmd FileType r,rmd inoremap <buffer> <A-/> <Esc>:normal! a %/%<CR>a
autocmd FileType rmd inoremap <buffer> <A-i> <Esc>:normal! a ```{r}<CR>```<Esc>O
autocmd FileType rmd nnoremap <buffer> <leader><CR> :w<CR> :!Rscript -e "rmarkdown::render('%')"<CR>
autocmd FileType rmd nnoremap <buffer> <leader>] :w<CR> :!Rscript -e "bookdown::render_book('%')"<CR>
autocmd FileType r nnoremap <buffer> <leader><CR> :w<CR> :!Rscript %<CR>
autocmd FileType python nnoremap <buffer> <silent> <leader><CR> :w !python<CR>
" https://github.com/jalvesaq/Nvim-R/blob/master/doc/Nvim-R.txt#L2586
" https://github.com/beigebrucewayne/vim-ide-4-all/blob/master/R-neovim.md
"" Remapping the basic :: send line (<Plug>RDSendLine doesn't work well)
" Remappings based on RStudio shortcuts: https://rstudio.com/wp-content/uploads/2016/01/rstudio-IDE-cheatsheet.pdf
"" Remapping selection :: send multiple lines + echo lines
" Remapping double character nvim-R mappings to single character
autocmd FileType r nmap <buffer> <A-a> <Plug>RSendAboveLines
autocmd FileType r nmap <buffer> <M-S-CR> <Plug>RESendFile
autocmd FileType r nmap <buffer> <leader>a <Plug>RESendFile
autocmd FileType r,rmd nmap <buffer> <A-0> <Plug>RClearAll
autocmd FileType r,rmd nmap <buffer> <C-l> <Plug>RClearConsole
autocmd FileType r,rmd nmap <buffer> <leader>- <Plug>RCloseLists
autocmd FileType r,rmd nmap <buffer> <leader>0 <Plug>RUpdateObjBrowser
autocmd FileType r,rmd nmap <buffer> <leader>; <Plug>RRightComment
autocmd FileType r,rmd nmap <buffer> <leader>= <Plug>ROpenLists
autocmd FileType r,rmd nmap <buffer> <leader>b <Plug>REDSendMBlock
autocmd FileType r,rmd nmap <buffer> <leader>d <Plug>RSetwd
autocmd FileType r,rmd nmap <buffer> <leader>e <Plug>RShowEx
autocmd FileType r,rmd nmap <buffer> <leader>f <Plug>RDSendFunction
autocmd FileType r,rmd nmap <buffer> <leader>g <Plug>RPlot
autocmd FileType r,rmd nmap <buffer> <leader>h <Plug>RHelp
autocmd FileType r,rmd nmap <buffer> <leader>i <Plug>RObjectPr
autocmd FileType r,rmd nmap <buffer> <leader>k <Plug>Rknit
autocmd FileType r,rmd nmap <buffer> <leader>m <Plug>RSendMotion
autocmd FileType r,rmd nmap <buffer> <leader>n <Plug>RObjectNames
autocmd FileType r,rmd nmap <buffer> <leader>o <Plug>RDSendLineAndInsertOutput
autocmd FileType r,rmd nmap <buffer> <leader>p <Plug>REDSendParagraph
autocmd FileType r,rmd nmap <buffer> <leader>q <Plug>RClose
autocmd FileType r,rmd nmap <buffer> <leader>r <Plug>RShowArgs
autocmd FileType r,rmd nmap <buffer> <leader>s <Plug>RStart
autocmd FileType r,rmd nmap <buffer> <leader>t <Plug>RObjectStr
autocmd FileType r,rmd nmap <buffer> <leader>u <Plug>RSummary
autocmd FileType r,rmd nmap <buffer> <leader>v <Plug>RViewDFv
autocmd FileType r,rmd nmap <buffer> <leader>w <Plug>RMakeWord
autocmd FileType r,rmd nmap <buffer> <leader>x <Plug>RToggleComment
autocmd FileType r,rmd nmap <buffer> <silent> <M-CR> :call SendLineToR("down")<CR>
autocmd FileType r,rmd nmap <buffer> <silent> <leader>l :call SendLineToR("down")<CR>
autocmd FileType r,rmd xmap <buffer> <leader>o <Plug>RSendSelAndInsertOutput
autocmd FileType r,rmd xmap <buffer> <leader>v <Plug>REDSendSelection
autocmd FileType r,rmd xmap <buffer> <M-CR> <Plug>REDSendSelection
autocmd FileType rmd nmap <buffer> <A-p> <Plug>RSendChunkFH
autocmd FileType rmd nmap <buffer> <M-S-CR> <Plug>REDSendChunk
autocmd FileType rmd nmap <buffer> <leader>c <Plug>REDSendChunk
autocmd FileType rmd nmap <buffer> <silent> <A-i> :normal! a ```{r}<CR>```<Esc>O
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
"*****************************************************************************
"" Mappings
"*****************************************************************************
nmap <silent><C-CR> <Plug>SlimeSendCell
nmap <silent><M-CR> <Plug>SlimeLineSend `]:set nowrapscan<CR>:call search('^.\+')<CR>:set wrapscan<CR>
nmap <silent><S-CR> <Plug>SlimeSendCell `]:set nowrapscan<CR>:call search('^.\+')<CR>:set wrapscan<CR>
" nmap <silent><leader>c <Plug>SlimeSendCell `]:set nowrapscan<CR>:call search('^.\+')<CR>:set wrapscan<CR>
" nmap <silent><leader>l <Plug>SlimeLineSend `]:set nowrapscan<CR>:call search('^.\+')<CR>:set wrapscan<CR>
" nmap <silent><leader>m <Plug>SlimeMotionSend
nnoremap <silent><leader>p :Page<CR>
xmap <silent><M-CR> <Plug>SlimeRegionSend `]:set nowrapscan<CR>:call search('^.\+')<CR>:set wrapscan<CR>
" xmap <silent><leader>c <Plug>SlimeSendCell `]:set nowrapscan<CR>:call search('^.\+')<CR>:set wrapscan<CR>
" xmap <silent><leader>l <Esc><Plug>SlimeLineSend `]:set nowrapscan<CR>:call search('^.\+')<CR>:set wrapscan<CR>
xmap <silent><leader>v <Plug>SlimeRegionSend `]:set nowrapscan<CR>:call search('^.\+')<CR>:set wrapscan<CR>
cnoremap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
" unimpaired style mapping for toggling autoformat
nnoremap <expr> yoa &fo =~ 'a' ? ':set fo-=a<CR>' : ':set fo+=a<CR>'
" brilliant mapping to toggle emacs-style ctrl-k mapping
" https://vi.stackexchange.com/a/15579
let s:ctrlKmapped=1
function! ToggleCtrlK()
if s:ctrlKmapped
iunmap <C-k>
else
inoremap <expr> <C-k> col('.') == col('$') ? '<Del>' : '<C-o>d$'
endif
let s:ctrlKmapped = !s:ctrlKmapped
endfunction
nnoremap yok :call ToggleCtrlK()<CR>
" brilliant mapping to toggle emacs-style ctrl-v mapping
" https://vi.stackexchange.com/a/15579
let s:ctrlVmapped=1
function! ToggleCtrlV()
if s:ctrlVmapped
iunmap <C-v>
else
inoremap <C-v> <PageDown>
endif
let s:ctrlVmapped = !s:ctrlVmapped
endfunction
nnoremap yov :call ToggleCtrlV()<CR>
" pbcopy for OSX copy/paste
if has('macunix')
xmap <D-x> :!pbcopy<CR>
xmap <D-c> :w !pbcopy<CR><CR>
endif
"" Vmap for maintain Visual Mode after shifting > and <
xmap < <gv
xmap > >gv
"" Move visual block
xnoremap J :m '>+1<CR>gv=gv
xnoremap K :m '<-2<CR>gv=gv
" https://vi.stackexchange.com/a/22233
" copied from plugin/surround.vim
nmap ds <Plug>Dsurround
nmap cs <Plug>Csurround
nmap cS <Plug>CSurround
nmap ys <Plug>Ysurround
nmap yS <Plug>YSurround
nmap yss <Plug>Yssurround
nmap ySs <Plug>YSsurround
nmap ySS <Plug>YSsurround
xmap S <Plug>VSurround
xmap gS <Plug>VgSurround
imap <C-S> <Plug>Isurround
" ----- remove these -----
" imap <C-G>s <Plug>Isurround
" imap <C-G>S <Plug>ISurround
" Emacs and bash style insert mode CTRL shortcuts
" <C-a> = Move to start of the line; like in vim command mode: c_ctrl-b; To insert previously inserted text, use <C-r>. or <Alt-.> (below)
inoremap <C-a> <Home>
cnoremap <C-a> <Home>
" <C-b> = Move one character backward; the opposite of <C-f>
inoremap <C-b> <Left>
cnoremap <C-b> <Left>
" <C-d> = Delete one character forward; the opposite of <C-h>
inoremap <silent><expr> <C-d> "\<C-g>u<Delete>"
cnoremap <C-d> <Delete>
" <C-e> = Move to end of the line (already exists in command mode: c_ctrl-e), this also cancels completion
inoremap <C-e> <End>
" <C-f> = Move one character forward; the opposite of <C-b>; <C-f> is too useful (for : / ?) to remap
inoremap <C-f> <Right>
" <C-g> = Cancel completion
inoremap <silent><expr> <C-g> pumvisible() ? "\<C-e>" : "<C-g>"
" <C-h> = Delete one character backward; the opposite of <C-d>; already exists in command mode: c_ctrl-h
inoremap <silent><expr> <C-h> "\<C-g>u<BS>"
" <C-k> = Delete to end of line; the opposite of <C-u>; https://www.reddit.com/r/vim/comments/9i58q8/question_re_delete_word_forward_in_insert_mode/e6he226/; https://superuser.com/a/855997
inoremap <expr> <C-k> col(".") == col("$") ? "<Del>" : "<C-o>d$"
cnoremap <C-k> <C-\>estrpart(getcmdline(),0,getcmdpos()-1)<CR>
" cnoremap <C-k> <C-f>d$<C-c><End>
" <C-r> = make paste from register undoable in insert mode; already exists in command mode: c_ctrl-r
inoremap <silent><expr> <C-r> "\<C-g>u<C-r>"
" <C-u> = Delete to start of line; the opposite of <C-k>; already exists in command mode: c_ctrl-u
inoremap <silent><expr> <C-u> "\<C-g>u<C-u>"
" <C-w> = Delete word backward; opposite of <A-d>; same as <A-h>; already exists in command mode: c_ctrl-w
inoremap <silent><expr> <C-w> "\<C-g>u<C-w>"
" <C-y> = Paste from system clipboard (not from killring like in bash/emacs)
inoremap <silent> <C-y> <C-o>:call <SID>ResetKillRing()<CR><C-r><C-o>"
cnoremap <C-y> <C-r><C-o>"
" <C-_> = Undo like in bash/emacs (this works really well)
inoremap <C-_> <C-o>u
inoremap <C-x><C-u> <C-o>u
" <C-/> = Undo like in bash/emacs (this works really well)
inoremap <C-/> <C-o>u
" <C-=> = Redo; opposite of <C-_>
inoremap <C-=> <C-o><C-r>
" Vimacs
imap <C-@> <C-Space>
inoremap <C-<> <C-o>:call <SID>StartMarkSel()<CR><C-o>v1G0o
inoremap <C->> <C-o>:call <SID>StartMarkSel()<CR><C-o>vG$o
inoremap <C-M-%> <C-o>:call <SID>QueryReplaceRegexp()<CR>
inoremap <C-M-/> <C-x>
inoremap <C-M-o> <C-o>:echoerr "<C-M-o> not supported yet; sorry!"<CR>
inoremap <C-M-r> <C-o>:call <SID>StartSearch('?')<CR><C-o>?
inoremap <C-M-s> <C-o>:call <SID>StartSearch('/')<CR><C-o>/
inoremap <C-M-x> <C-x>
inoremap <C-S-Tab> <C-o><C-w>W
inoremap <C-Tab> <C-o><C-w>w
inoremap <C-]> <C-x>
inoremap <C-s> <C-o>:call <SID>StartSearch('/')<CR><C-o>/
inoremap <C-t> <Left><C-o>x<C-o>p
inoremap <C-v> <PageDown>
inoremap <C-x>+ <C-o><C-w>=
inoremap <C-x>/ <C-o>:call <SID>PointToRegister()<CR>
inoremap <C-x>0 <C-o><C-w>c
inoremap <C-x>1 <C-o><C-w>o
inoremap <C-x>2 <C-o><C-w>s
inoremap <C-x>3 <C-o><C-w>v
inoremap <C-x>4<C-f> <C-o>:FindFileOtherWindow<Space>
inoremap <C-x>4f <C-o>:FindFileOtherWindow<Space>
inoremap <C-x><BS> <C-o>d(
inoremap <C-x><C-b> <C-o>:buffers<CR>
inoremap <C-x><C-c> <C-o>:confirm qall<CR>
inoremap <C-x><C-f> <C-o>:hide edit<Space>
inoremap <C-x><C-o> <C-o>:call <SID>DeleteBlankLines()<CR>
inoremap <C-x><C-q> <C-o>:set invreadonly<CR>
inoremap <C-x><C-r> <C-o>:hide view<Space>
inoremap <C-x><C-s> <C-o>:update<CR>
inoremap <C-x><C-t> <Up><C-o>dd<End><C-o>p<Down>
inoremap <C-x><C-w> <C-o>:write<Space>
inoremap <C-x>= <C-g>
inoremap <C-x>O <C-o><C-w>W
inoremap <C-x>h <C-o>:call <SID>StartMarkSel()<CR><Esc>1G0vGo
inoremap <C-x>i <C-o>:read<Space>
inoremap <C-x>k <C-o>:bdelete<Space>
inoremap <C-x>o <C-o><C-w>w
inoremap <C-x>p <C-o><C-o>
inoremap <C-x>r<C-@> <C-o>:call <SID>PointToRegister()<CR>
inoremap <C-x>r<C-Space> <C-o>:call <SID>PointToRegister()<CR>
inoremap <C-x>r<Space> <C-o>:call <SID>PointToRegister()<CR>
inoremap <C-x>rj <C-o>:call <SID>JumpToRegister()<CR>
inoremap <C-x>s <C-o>:wall<CR>
inoremap <script> <C-o> <CR><Left>
inoremap <silent> <C-M-v> <C-o>:ScrollOtherWindow<CR>
inoremap <silent> <C-Space> <C-r>=<SID>StartVisualMode()<CR>
vnoremap <C-M-\> =
vnoremap <C-g> <Esc>
vnoremap <C-w> "1d
vnoremap <C-x><C-@> <Esc>
vnoremap <C-x><C-Space> <Esc>
vnoremap <C-x><Tab> =
" " Emacs and bash style insert mode ALT shortcuts
" " <A-a> = Move to previous sentence start ; opposite of <A-e>
nnoremap <A-a> (
inoremap <A-a> <C-o>(
" <A-b> = Move one word backward; opposite of <A-f>
nnoremap <A-b> b
inoremap <A-b> <S-Left>
cnoremap <A-b> <S-Left>
" <A-c> = Capitalize letter and move forward
" https://github.com/andrep/vimacs/blob/master/plugin/vimacs.vim#L1229
nnoremap <A-c> gUllgueea
inoremap <expr> <A-c> getline('.')[col('.')-1] =~ "\\s" ? "<C-o>W<C-o>gUl<C-o>l<C-o>guw<Esc>ea" : "<C-o>gUl<C-o>l<C-o>guw<Esc>ea"
" <A-d> = Delete word forward; opposite of <A-h> and <C-w>; https://www.reddit.com/r/vim/comments/9i58q8/question_re_delete_word_forward_in_insert_mode/e6he226/
nnoremap <A-d> dw
inoremap <expr> <A-d> col(".") == col("$") ? "<Del>" : "<C-o>de"
cnoremap <A-d> <S-Right><C-w>
" " <A-e> = Move to previous sentence start ; opposite of <A-a>
nnoremap <A-e> )T.
inoremap <A-e> <Esc>)T.i
" <A-f> = Move one word forward; opposite of <A-b>
nnoremap <A-f> w
inoremap <A-f> <S-Right>
cnoremap <A-f> <S-Right>
" <A-h> = Delete word backward; opposite of <A-d>; same as <C-w>
nnoremap <A-h> db
inoremap <silent><expr> <A-h> "\<C-g>u<C-w>"
cnoremap <A-h> <C-w>
" <A-j> = Move down; opposite of <A-k>
inoremap <A-j> <Down>
cnoremap <A-j> <Down>
" " <A-k> = Delete to end of sentence
nnoremap <A-k> df.
inoremap <A-k> <C-o>df.
" <A-l> = Lowercase to word end; opposite of <A-u>
" https://github.com/andrep/vimacs/blob/master/plugin/vimacs.vim#L1229
inoremap <A-l> <C-o>gue<Esc>ea
cnoremap <A-l> <C-f>guee<C-c>
" <A-u> = Uppercase to WORD end; opposite of <A-l>
" https://github.com/andrep/vimacs/blob/master/plugin/vimacs.vim#L1229
nnoremap <A-u> gUeea
inoremap <A-u> <C-o>gUe<Esc>ea
cnoremap <A-u> <C-f>gUee<C-c>
" " <A-q> = Fill / Format paragraph
nnoremap <A-q> gwip
inoremap <A-q> <C-o>gwip
" <A-.> = Insert previously inserted text (if any)
nnoremap <A-.> a<C-r>.
inoremap <A-.> <Esc>a<C-r>.
cnoremap <A-.> <C-r>.
" Vimacs
inoremap <C-x>4. <C-o><C-w>}
inoremap <M-!> <C-o>:!
inoremap <M-%> <C-o>:call <SID>QueryReplace()<CR>
inoremap <M-*> <C-o><C-t>
inoremap <M-.> <C-o><C-]>
inoremap <M-/> <C-p>
inoremap <M-0><C-k> <C-o>d0
inoremap <M-1> <C-o>1
inoremap <M-2> <C-o>2
inoremap <M-3> <C-o>3
inoremap <M-4> <C-o>4
inoremap <M-5> <C-o>5
inoremap <M-6> <C-o>6
inoremap <M-7> <C-o>7
inoremap <M-8> <C-o>8
inoremap <M-9> <C-o>9
inoremap <M-:> <C-o>:
inoremap <M-<> <C-o>1G<C-o>0
inoremap <M->> <C-o>G<C-o>$
inoremap <M-Space> <C-o>:call <SID>StartMarkSel()<CR><C-o>viw
inoremap <M-\> <Esc>beldwi
inoremap <M-^> <Up><End><C-o>J
inoremap <M-`> <C-o>
inoremap <M-h> <C-o>:call <SID>StartMarkSel()<CR><C-o>vapo
inoremap <M-k> <C-o>d)
inoremap <M-m> <C-o>^
inoremap <M-n> <C-o>:cnext<CR>
inoremap <M-p> <C-o>:cprevious<CR>
inoremap <M-r> <C-r>=
inoremap <M-s> <C-o>:set invhls<CR>
inoremap <M-v> <PageUp>
inoremap <M-x> <C-o>:
inoremap <M-y> <C-o>:call <SID>YankPop()<CR>
inoremap <M-z> <C-o>dt
inoremap <silent> <M-g> <C-o>:call <SID>GotoLine()<CR>
inoremap <silent> <M-q> <C-o>:call <SID>FillParagraph()<CR>
vnoremap <M-!> !
vnoremap <M-h> o}o
vnoremap <M-w> "1y
vnoremap <M-x> :
"" Git
nnoremap gs :Gstatus<CR>
nnoremap [g :diffget //2<CR>
nnoremap ]g :diffget //3<CR>
nnoremap <silent><leader>gw :Gwrite<CR>
nnoremap <silent><leader>gc :Gwrite<bar>Gcommit<CR>
nnoremap <leader>gp :Gpush<CR>
nnoremap <leader>gu :Gpull<CR>
nnoremap <leader>gd :Gvdiff<CR>
nnoremap <leader>gr :Gremove<CR>
nnoremap <leader>gl :Glog<CR>
nnoremap <leader>gg :Gwrite<CR>:Gcommit -m "edit "%<CR>:Gpush<CR>
" https://github.com/neoclide/coc-git
" https://github.com/neoclide/coc-yank
" navigate chunks of current buffer
nmap [c <Plug>(coc-git-prevchunk)
nmap ]c <Plug>(coc-git-nextchunk)
" show chunk diff at current position
nmap gs <Plug>(coc-git-chunkinfo)
" show git log at current position
nmap gl <Plug>(coc-git-commit)
" create text object for git chunks
omap ig <Plug>(coc-git-chunk-inner)
xmap ig <Plug>(coc-git-chunk-inner)
omap ag <Plug>(coc-git-chunk-outer)
xmap ag <Plug>(coc-git-chunk-outer)
" add and reset
nmap <silent> <leader>d :CocCommand git.diffCached<CR>
nmap <silent> ga :CocCommand git.chunkStage<CR>
nmap <silent> gr :CocCommand git.chunkUndo<CR>
nmap <silent> yog :CocCommand git.toggleGutters<CR>
" yank
nmap <silent> gy :CocCommand git.copyUrl<CR>
nnoremap <silent> <leader>y :<C-u>CocList -A --normal yank<cr>
"" Set working directory
nnoremap <leader>. :lcd %:p:h<CR>
"" Opens an edit command with the path of the currently edited file filled in
noremap <leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
nnoremap <silent> <leader>n :NERDTreeToggle<CR>
" terminal emulation
" nnoremap <silent> <leader>t :terminal<CR>
"" Clean search (highlight)
nnoremap <silent> <leader><leader> :noh<cr>
"" Open current line on GitHub
nnoremap <leader>o :.Gbrowse<CR>
nnoremap <silent> <leader>A :Ag<CR>
nnoremap <silent> <leader>b :Buffers<CR>
"Recovery commands from history through FZF
nnoremap <silent> <leader>h :History<CR>
nnoremap <silent> <leader>B :BCommits<CR>
nnoremap <silent> <leader>C :Commands<CR>
nnoremap <silent> <leader>gf :GFiles<CR>
nnoremap <silent> <leader>F :Files<CR>
nnoremap <silent> <leader>H :Helptags<CR>
nnoremap <silent> <leader>M :Maps<CR>
nnoremap <silent> <leader>' :Marks<CR>
nnoremap <silent> <leader>L :Lines<CR>
nnoremap <silent> <leader>R :Rg<CR>
nnoremap <silent> <leader>T :Tags<CR>
nnoremap <silent> <leader>z :FZF -m<CR>
" https://github.com/junegunn/fzf.vim#mappings
" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Symbol renaming.
" nmap <leader>r <Plug>(coc-rename)
" Formatting selected code.
" xmap <leader>f <Plug>(coc-format-selected)
" nmap <leader>f <Plug>(coc-format-selected)
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
" xmap <leader>a <Plug>(coc-codeaction-selected)
" nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
" nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Mappings for CoCList
" Show all diagnostics.
" nnoremap <silent><nowait> <leader>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
" nnoremap <silent><nowait> <leader>e :<C-u>CocList extensions<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <leader>o :<C-u>CocList outline<cr>
" Search workspace symbols.
" nnoremap <silent><nowait> <leader>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <leader>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <leader>k :<C-u>CocPrev<CR>
" Run :file everytime I switch buffers
nnoremap <leader>; :bn<CR>:file<CR>
nnoremap <leader>, :bp<CR>:file<CR>
tnoremap <leader>; <C-\><C-n>:bn<CR>:file<CR>
tnoremap <leader>, <C-\><C-n>:bp<CR>:file<CR>
nnoremap ]b :bn<CR>:file<CR>
nnoremap [b :bp<CR>:file<CR>
tnoremap ]b <C-\><C-n>:bn<CR>:file<CR>
tnoremap [b <C-\><C-n>:bp<CR>:file<CR>
" Run :file everytime I switch to alternate file (^6)
nnoremap <C-^> <C-^>:file<CR>
tnoremap <C-^> <C-\><C-n><C-^>:file<CR>
" Run :file everytime I go thru the jump list
nnoremap <C-o> <C-o>:file<CR>
nnoremap <C-i> <C-i>:file<CR>
" Run :file everytime I switch windows (not needed in nvim)
" https://github.com/jalvesaq/Nvim-R/blob/master/doc/Nvim-R.txt#L1075
" To recover R console after pressing <C-w>o (window only), press <C-w>u (window undo)
" https://vi.stackexchange.com/questions/241/undo-only-window
" function! Zoom()
" if winbufnr(2) == -1 " https://stackoverflow.com/a/7070691
" wa | source ~/session.vim
" else
" mksession! ~/session.vim | wincmd o
" endif
" endfunction
" nnoremap <C-w>o :call Zoom()<CR>
let g:maximizer_set_default_mapping = 0
nnoremap <silent><C-w>o :MaximizerToggle<CR>
vnoremap <silent><C-w>o :MaximizerToggle<CR>gv
nnoremap <C-w>c :mksession! ~/session.vim<CR>:wincmd c<CR>:file<CR>
nnoremap <C-w>q :mksession! ~/session.vim<CR>:wincmd q<CR>:file<CR>
" https://vi.stackexchange.com/questions/241/undo-only-window
nnoremap <C-w>u :silent :source ~/session.vim<CR>
" e is easier to reach than = and is unbound by default
nnoremap <C-w>e <C-w>=
" = is easier to type than +
nnoremap <C-w>= <C-w>+
" , is easier to type than < and is unbound by default
nnoremap <C-w>, <C-w><
" . is easier to type than < and is unbound by default
nnoremap <C-w>. <C-w>>
" Terminal like in vim
tnoremap <C-w>+ <C-\><C-n><C-w>+
tnoremap <C-w>- <C-\><C-n><C-w>-
tnoremap <C-w>< <C-\><C-n><C-w><
tnoremap <C-w>= <C-\><C-n><C-w>=
tnoremap <C-w>> <C-\><C-n><C-w>>
tnoremap <C-w>H <C-\><C-n><C-w>H
tnoremap <C-w>J <C-\><C-n><C-w>J
tnoremap <C-w>K <C-\><C-n><C-w>K
tnoremap <C-w>L <C-\><C-n><C-w>L
tnoremap <C-w>N <C-\><C-n>
tnoremap <C-w>P <C-\><C-n><C-w>P
tnoremap <C-w>R <C-\><C-n><C-w>R
tnoremap <C-w>S <C-\><C-n><C-w>S
tnoremap <C-w>T <C-\><C-n><C-w>T
tnoremap <C-w>W <C-\><C-n><C-w>W
tnoremap <C-w>] <C-\><C-n><C-w>]
tnoremap <C-w>^ <C-\><C-n><C-w>^
tnoremap <C-w>_ <C-\><C-n><C-w>_
tnoremap <C-w>b <C-\><C-n><C-w>b
tnoremap <C-w>c <C-\><C-n><C-w>c
tnoremap <C-w>d <C-\><C-n><C-w>d
tnoremap <C-w>f <C-\><C-n><C-w>f
tnoremap <C-w>g <C-\><C-n><C-w>g
tnoremap <C-w>h <C-\><C-n><C-w>h
tnoremap <C-w>i <C-\><C-n><C-w>i
tnoremap <C-w>j <C-\><C-n><C-w>j
tnoremap <C-w>k <C-\><C-n><C-w>k
tnoremap <C-w>l <C-\><C-n><C-w>l
tnoremap <C-w>n <C-\><C-n><C-w>n
tnoremap <C-w>o <C-\><C-n><C-w>o
tnoremap <C-w>p <C-\><C-n><C-w>p
tnoremap <C-w>q <C-\><C-n><C-w>q
tnoremap <C-w>r <C-\><C-n><C-w>r
tnoremap <C-w>s <C-\><C-n><C-w>s
tnoremap <C-w>t <C-\><C-n><C-w>t
tnoremap <C-w>v <C-\><C-n><C-w>v
tnoremap <C-w>w <C-\><C-n><C-w>w
tnoremap <C-w>x <C-\><C-n><C-w>x