我市消协获“全国消协组织先进集体”称号
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 12, 2023 at 22:22 | vote | accept | windfish | ||
Apr 7, 2023 at 14:04 | comment | added | D. Ben Knoble |
@windfish for multiple indents, use :[range]>[>>>…] , but it won't use the custom code. Or use your > with . , though it's possible using tpope/vim-repeat and call repeat#set is necessary to make that work as desired.
|
|
Apr 7, 2023 at 13:19 | vote | accept | windfish | ||
Apr 12, 2023 at 22:22 | |||||
Apr 7, 2023 at 13:19 | comment | added | windfish | @Hoblovski indeed – i didn’t realise that vim doesn’t do multiple indents on movements. in any case, thank you very much! | |
Apr 7, 2023 at 5:23 | history | edited | Hoblovski | CC BY-SA 4.0 |
added 382 characters in body
|
Apr 7, 2023 at 5:11 | comment | added | Hoblovski |
@windfish I guess you would like v:count to designate the number of \t inserted/deleted, but vim only does it for visual selections instead of >> or >{motion} . For example 3>2j is essentially equal to >6j , and 6>> essentially shifts six lines by one shiftwidth instead of one line by six shiftwidths. So I'm trying to keep a consistent behavior, but surely I modified the post to use v:count for visual selections.
|
|
Apr 7, 2023 at 4:44 | history | edited | Hoblovski | CC BY-SA 4.0 |
adopt ben's advice
|
Apr 7, 2023 at 4:41 | comment | added | Hoblovski |
@D.BenKnoble Thank you! I always used a manual ^I but \t is definitely more portable.
|
|
Apr 6, 2023 at 13:43 | comment | added | windfish |
in the meantime i’ve been dabbling at creating a >> solution incorporating v:count , but it looks very contrived: nnoremap <expr> >> '^' . ('T<tab>' ? 'T<tab>' : '0') . ( v:count == 0 ? '' : v:count ) . 'i<c-v><tab><esc>' and nnoremap <expr> << '^T<tab>d' . ( v:count > 0 ? v:count . 'F<tab>' : 'F<tab>' ) and unindenting doesn’t work if the given v:count is greater than the number of leading tabs (the desired behaviour to unindent as many tabs as possible).
|
|
Apr 6, 2023 at 13:39 | comment | added | windfish |
nice! can i extend this to use the current v:count somehow?
|
|
Apr 6, 2023 at 12:38 | comment | added | D. Ben Knoble |
FWIW, :substitute accepts \t in both the pattern and replacement to stand for a Tab character. :execute is not needed here… just write :silent! keeppatterns '[,']substitute/^\t/ , for example.
|
|
Apr 6, 2023 at 10:31 | history | answered | Hoblovski | CC BY-SA 4.0 |