-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.vimrc.text
More file actions
192 lines (174 loc) · 7.59 KB
/
.vimrc.text
File metadata and controls
192 lines (174 loc) · 7.59 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
" Standard text objects:
" iw - inner word, aw - a word
" iW - inner WORD, aW - a WORD
" is - inner sentence, as - a sentence
" ip - inner paragraph, ap - a paragraph
" iq - inner quote, aq - a quote (aslo i', a', i", a")
" i[, a[, i], a[ - a [] block
" ib, ab - a () "block", also a), a(, i), i(
" i{, a{, i}, a{, aB, iB - a {} block
" i<, a<, i>, a> - a <> block
" it, at - a tag block
"
" Note: after using the text object in visual mode, we can repeat
" it again to expand the selection.
" For example, va{a{ will select a block and then expand to the parent block.
"
" See: :help text-objects
" Python indent object
" ai – the current indentation level and the line above
" ii – the current indentation level excluding the line above
Plug 'michaeljsmith/vim-indent-object'
" ic, ac, iC, aC text object for columns
" ic / iC based on inner word / WORD (iw / iW),
" ac / aC - on "a word" / "a WORD" (aw / aW)
" like vic - select a col / dic - delete a col / cic - change a col
" vicI - prepend text to col / vicA - append text
Plug 'coderifous/textobj-word-column.vim'
" Related: https://github.com/kana/vim-textobj-user
" https://github.com/kana/vim-textobj-user/wiki
" Exapand/shrink selection
" + - expand selection
" _ - shrink selection
Plug 'terryma/vim-expand-region'
" Related: https://github.com/rhysd/vim-textobj-anyblock
" This plugin provides text object mappings ib and ab.
" ib is a union of i(, i{, i[, i', i" and i<.
" ab is a union of a(, a{, a[, a', a" and a<.
" Show context of the current line
" Plug 'wellle/context.vim'
" gS / gJ to split / join multiline / single lines forms of code
Plug 'AndrewRadev/splitjoin.vim'
" :Deleft or `dh` (by default) to remove surrounding parent block.
Plug 'AndrewRadev/deleft.vim'
" Disabled in favor of nvim-treesitter-textobjects
" " :SidewaysLeft and :SidewaysRight - move the item under the cursor left or right, where an "item" is defined by a delimiter
" Plug 'AndrewRadev/sideways.vim'
" nnoremap <Leader>hh :SidewaysLeft<cr>
" nnoremap <Leader>ll :SidewaysRight<cr>
" " aa – an argument, ia – inner argument
" " Note: these are defined by targets.vim
" " omap aa <Plug>SidewaysArgumentTextobjA
" " xmap aa <Plug>SidewaysArgumentTextobjA
" " omap ia <Plug>SidewaysArgumentTextobjI
" " xmap ia <Plug>SidewaysArgumentTextobjI
" Required by vim-surround
Plug 'tpope/vim-repeat'
" Change surrounding objects
" cs<from><to> - change surrounding
" cs"' - change " surround " to '
" cs'<q> - change surround ' to <q>..</q>
" cst" - chage surrounding tag to "
" ds<what> - remove surrounding
" ds" - remove surrounding
" ys<motion><what> - add surrounding
" ysiw] - add surrounding [] for inner word
" yssb or yss) - surround a line with ()
" in visual mode S<what> will surround selected text
Plug 'tpope/vim-surround'
" Pair commands, some of them:
" [q / ]q, [Q / ]Q- :cprevious / :cnext, :cfirst / :clast - errors in quickfix
" [<C-Q> / ]<C-Q> - :cpfile / :cnfile - prev / next file in quickfix list
" [l / l], [L / L] - :lprevious / :lnext, :lfirst / :llast - location list
" [<C-L> / ]<C-L> - :lpfile / :lnfile - prev / next file in location list
" Quickfix notes:
" - (superuseful) :cold / :cnew - display older / newer quckfix state
" - location list is the same as quickfix, but local to window (we can
" have different location lists for different windows),
" lol / lnew for older / newer states
" [<C-Q> / ]<C-Q> - :cpfile / :cnfile - errors in files (?)
" [<C-L] / ]<C-L> - :lpfile / :lnfile - errors in files, use current window (?)
" [t / ]t, [T / ]T - :tprevious / :tnext, :tfirst / :tlast - tags
" [a / ]a, [A / ]A - :previous / :next, :first / :last - files in argument list
" [b / ]b, [B / ]b - :bprevious / :bnext, :bfirst / :blast - buffers
"
" [Space - add [count] blank lines before cursor
" ]Space - add [count] blank lines after cursor
" [e - move line up ]e - move line down
"
" [f / ]f - previous / next file in directory
" [n / ]b - previous / next conflict marker
Plug 'tpope/vim-unimpaired'
" Better % from standard matchit plugin:
" - Extends vim's % motion to language-specific words.
" - Adds motions g%, [%, ]%, and z%.
" - g% - go backwards to [count]th previous matching word.
" - [% - go to [count]th previous outer open word.
" - ]% - go to [count]th next outer open close word.
" - z% - go to inside [count]th nearest block.
" - Provides analogous text objects |i%| and |a%|.
" - a% - similar to Vim's aB, but recoginizes more types of blocks.
" - i% - similar to Vim's iB, but recoginizes more types of blocks.
" - Combines these motions into convenient text objects i% and a%.
" - Highlights symbols and words under the cursor which % can work on,
" and highlights matching symbols and words.
" Now you can easily tell where % will jump to.
Plug 'andymass/vim-matchup'
" Exchange MatchParen and MatchParenCur highlights
" Current value can be seen with :hi MatchParen
" augroup is to preserve value after color scheme change (see vim-matchup help).
augroup matchup_matchparen_highlight
autocmd!
" Standard value hi MatchParenCur cterm=bold ctermbg=6 gui=bold guifg=#232926 guibg=#c47ebd
autocmd ColorScheme * hi MatchParen cterm=bold ctermbg=6 gui=bold guifg=lightblue guibg=bg
augroup END
"""""" Visual mode enhancements
" :NR to move selected text into scratch buffer,
" :w to put modified text back
" Plug 'chrisbra/NrrwRgn'
" drawing in vim
" \di - start \ds - stop
" left-right-up-down - draw and move; with shift - just move
" > < ^ v - draw an arrow; pgdb / end / pgup / home - move by diagonal
" \> \< \^ \v - draw a fat arrow;
"
" select visual block and draw:
" \a - arrow between corners;
" \l - line between corners;
" \b - box around; \e - ellipse around;
" \f - fill with char;
" \s - append spaces up to the textwidth (def: 78)
" \h - canvas; ??
" leftmouse - select visual block;
" s-leftmouse - drag and draw with current brush
" c-leftmouse - drag and move the current brush
" \ra ... \rz - replace text with given brush (register); \pa ... - like \ra.., blanks are transparent
Plug 'vim-scripts/DrawIt'
" Move / duplicate text
" space + d / D - duplicate down/up
" visual mode - arrows - move selection
" F10 - toggle replace/insert
Plug 't9md/vim-textmanip'
xmap <Space>d <Plug>(textmanip-duplicate-down)
" nmap <Space>d <Plug>(textmanip-duplicate-down)
xmap <Space>D <Plug>(textmanip-duplicate-up)
" nmap <Space>D <Plug>(textmanip-duplicate-up)
xmap <Down> <Plug>(textmanip-move-down)
xmap <Up> <Plug>(textmanip-move-up)
xmap <Left> <Plug>(textmanip-move-left)
xmap <Right> <Plug>(textmanip-move-right)
" toggle insert/replace with <F10>
" nmap <F10> <Plug>(textmanip-toggle-mode)
xmap <F10> <Plug>(textmanip-toggle-mode)
"
" Related: https://github.com/jondkinney/dragvisuals.vim - dragging visual blocks
" Related: https://github.com/zirrostig/vim-schlepp - moving visual blocks
" Related: vim-scripts/VisIncr - make a column of increasing or decreasing
" numbers, dates, or daynames
""""" Tabularize and tables
" :Tabularize /, - tablarize by ','
" :Tabularize /,/[r|l|c]0
" r - align right, l - left, c - center
" 0 (or other number) - number of spaces between fields
" :Tabularize /,/r1c1l0
" formatters will be applied in the specified order
" :Tabularize /^[^,]*\zs,/r0c0l0 - use regex ^[^,]*\zs, (match only first comma)
" :AddTabularPattern first_comma /^[^,]*\zs,/r0c0l0 - save pattern
" (:Tab first_comma)
" Standard extensions (after/plugin/TabularMaps.vim)
" assignment, two_spaces, multiple_spaces, argument_list,
" split_declarations, trenary_operator, cpp_io, pascal_assign,
" trailing_c_comments
" Similar: https://github.com/tommcdo/vim-lion
" https://github.com/junegunn/vim-easy-align
Plug 'godlygeek/tabular'