~kiril/vimfiles

ref: 61654249d2ee66ba6e3d98690fb6992d83af501c vimfiles/startup/mappings.vim -rw-r--r-- 2.6 KiB
61654249Kiril Vladimirov Replace a fair amount of mappings with a langmap 4 months ago
                                                                                
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
" Tagbar
map <Leader>t :Vista!!<CR>

" NERDTree
map <Leader>n :NERDTreeToggle<CR>
map <Leader>N :NERDTreeFind<CR>

" Undotree
map <Leader>u :UndotreeToggle<CR>

" Tabs
nnoremap ,t :tabnew<cr>
nnoremap ,T :tabedit %<cr>gT:quit<cr>
nmap <BS> gT
nmap <C-h> gT
nmap <C-l> gt
map qq    <Esc>:Q<CR>

" Some little, but handy mappings
command! Q q

" Save
command! W w
nnoremap <Leader>w :w<CR>

" Save and quit
nnoremap <Leader>x :x<CR>

" Save as root
cmap w!! w !sudo tee % >/dev/null

" Make Y behave like C and D
map Y y$

" Rescan the buffer from start and fix highlighting
nnoremap <Leader>S <Esc>:syntax sync fromstart<CR>

" Splitjoin
nnoremap =j :SplitjoinJoin<CR>
nnoremap =s :SplitjoinSplit<CR>

" Switch
let g:switch_mapping = "-"

" Resizing splits
map <left>  <C-w>10<
map <up>    <C-w>10-
map <down>  <C-w>10+
map <right> <C-w>10>

" Nicer single-line visual mode
nnoremap vv _v$h

" Reindent without losing the selection
xnoremap > >gv
xnoremap < <gv

" Reselect pasted text
nnoremap gP `[v`]

" Spellcheck
map <Leader>se :setlocal spell spelllang=en_us<CR>
map <Leader>sb :setlocal spell spelllang=bg_bg<CR>
map <Leader>sn :setlocal nospell<CR>

" Prettify and minify json
map <leader>Jt  <Esc>:%!python -m json.tool<CR>:StripWhitespace<CR>

" Mutlichange
let g:multichange_mapping = 'sm'
let g:multichange_motion_mapping = "m"

" Sideways
nnoremap <Leader>< :SidewaysLeft<CR>
nnoremap <Leader>> :SidewaysRight<CR>

" Jump to next and previous tags
nnoremap ]t :tnext<CR>
nnoremap [t :tprev<CR>

" Mapping selecting mappings
nnoremap gp         :Files<cr>
nnoremap g.         :Tags<cr>
nnoremap <leader>p  :GFiles<cr>
nnoremap <leader>be :Buffers<cr>
nnoremap <leader>fl :Lines<cr>
nnoremap <leader>rg :Rg <C-R><C-W><cr>
nnoremap <leader>h  :History<cr>
nnoremap <leader>M  :Marks<cr>

" Insert mode completion
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-l> <plug>(fzf-complete-line)

" unstack
let g:unstack_mapkey='<Leader>T'

" TabMan
let g:tabman_toggle = 'gM'

" UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"

" Grepper
nnoremap <leader>/ :Grepper -tool grep<cr>
nnoremap <leader>* :Grepper -tool grep -cword -noprompt<cr>
nnoremap <leader>G :Grepper -tool git<cr>
nmap gs <plug>(GrepperOperator)
xmap gs <plug>(GrepperOperator)

" Repeat last macro
nnoremap <expr> <CR> empty(&buftype) ? '@@' : '<CR>'

" fugitive
map <leader>g :Git<CR>

if exists('$WAYLAND_DISPLAY')
  if executable('wl-copy')
    xnoremap <leader>y y:call system("wl-copy", @")<cr>
  endif
  if executable('wl-paste')
    nnoremap <leader>p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
  endif
endif