Closed kiryph closed 8 years ago
Hi, I'm afraid it wont work as is. (It might work in visual mode) I originally wrote the command to match on the :he
Note that
So it is not good for non alpha lists like ( || && ) etc, which would be handy.
I think there have since been some other substitution scripts that might handle this (cycle.vim?) but I haven't looked at them.
I looked at changing the
You could also take advantage of the SwapitFallback(incrementor,Decrimentor) and write your own function. You would probably only need a few substitutes s/^#/##/ s/^##/### etc.
Thanks for your reply.
Maybe you can add the information to the documentation of swapit
that only alphanumeric keywords are allowed.
Indeed you were right that other plugins could handle non-alphanumeric letters. I have checked additional features I like:
Plugin | dot-repeat | Forward to speeddating and builtin inc/dec |
non-alphanum keywords |
---|---|---|---|
swapit | yes | yes | no |
bootleq/vim-cycle | yes | yes | yes |
zef/vim-cycle | no | no | yes |
switch.vim | yes | no | yes |
toggle.vim | only toggle no inc/dec |
no | yes |
I guess I will give bootleq/vim-cycle
a shot.
bootleq/vim-cycle
:By default 0/1
is toggled. Intefers with forwarding to speeddating. Remove it from the default list. My first configuration together with speeddating looks like:
" Plugins {{{1:
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-speeddating'
Plug 'bootleq/vim-cycle'
call plug#end()
" Plugin Settings: {{{1
" Cycle: {{{2
nmap <silent> <C-A> <Plug>CycleNext
nmap <silent> <C-X> <Plug>CyclePrev
vmap <silent> <C-A> <Plug>CycleNext
vmap <silent> <C-X> <Plug>CyclePrev
map <silent> <Plug>CycleFallbackNext <Plug>SpeedDatingUp
map <silent> <Plug>CycleFallbackPrev <Plug>SpeedDatingDown
let g:cycle_default_groups = [
\ [['true', 'false']],
\ [['yes', 'no']],
\ [['on', 'off']],
\ [['+', '-']],
\ [['>', '<']],
\ [['"', "'"]],
\ [['==', '!=']],
\ [['and', 'or']],
\ [["in", "out"]],
\ [["up", "down"]],
\ [["min", "max"]],
\ [["get", "set"]],
\ [["add", "remove"]],
\ [["to", "from"]],
\ [["read", "write"]],
\ [["only", "except"]],
\ [['without', 'with']],
\ [["exclude", "include"]],
\ [["asc", "desc"]],
\ [["#", "##", "###"]],
\ [['是', '否']],
\ [['{:}', '[:]', '(:)'], 'sub_pairs'],
\ [['(:)', '「:」', '『:』'], 'sub_pairs'],
\ [['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
\ 'Friday', 'Saturday'], 'hard_case', {'name': 'Days'}],
\ ]
" 2013-01-01
" #
" +
" true
And yes, everything I've tried works as expected: dot repeat of increment with count, non-alpha chars, forwarding to speeddating.
Another note regarding incrementing/decrementing markdown header levels:
The plugin https://github.com/plasticboy/vim-markdown provides the functions :HeaderIncrease
and :HeaderDecrease
. However, I am not sure whether they can chained into ctrl-a/x
as done with speeddating.
I had another idea for a swaplist for markdown files:
I have tried two definitions in
~/.vim/after/ftplugin/markdown_swapit.vim
:1.
2.
Unfortunately, both do not work. Why?