triglav / vim-visual-increment Goto Github PK
View Code? Open in Web Editor NEWvisual-increment.vim - use CTRL+A/X to create increasing sequence of numbers or letters via visual mode
Home Page: https://triglav.github.io/vim-visual-increment/
visual-increment.vim - use CTRL+A/X to create increasing sequence of numbers or letters via visual mode
Home Page: https://triglav.github.io/vim-visual-increment/
Vim 8 has the similar built-in feature but behave differently.
In vim 8, ctrl+A in visual's column increase the numbers by the same step.
While g+ctrl+A behave same like this.
So when updating to vim 8, these two behavior may be a confliction.
Is increasing by the same step omitted on purpose or implemented by another shortcut?
more see this.
In some case there are already some lines with number:
1
4
7
8
I want it be formatted to:
1
2
3
4
But actually it becomes:
1
5
9
11
Maybe add a 'force' mode to override the rest line?
I used Vendle to install this plugin but got the following error:
[2023-09-08 10:12:33] Plugin https://github.com/triglav/vim-visual-increment.git
[2023-09-08 10:12:33] $ git clone --depth 1 --recursive --shallow-submodules 'https://github.com/triglav/vim-visual-increment.git' '/home/yjiang/.vim/bundle/vim-visual-increment'
[2023-09-08 10:12:33] > error: unknown option `shallow-submodules'
Could you tell me how can I fix this problem? Thanks!
I've rebound <C-a>
to a slightly customized one. It gave me some unexpected behaviour. Fortunately, using normal!
makes vim use the builtin default, and everything works again.
diff --git a/plugin/visual-increment.vim b/plugin/visual-increment.vim
index 0e7a17a..98a640b 100644
--- a/plugin/visual-increment.vim
+++ b/plugin/visual-increment.vim
@@ -25,7 +25,7 @@ function! s:doincrement(step, ...)
if start_row == end_row
" just increment/decrement the value if only one line is selected
- exe "normal ".a:step.incrementer
+ exe "normal! ".a:step.incrementer
else
" move to the next line, as we are not interested in incrementing the very
" first one
@@ -34,7 +34,7 @@ function! s:doincrement(step, ...)
let i = a:step
while 1
" increment the current line by <i>
- exe "normal ".i.incrementer
+ exe "normal! ".i.incrementer
" finish once the last row is incremented
if line('.') == end_row
break
Before:
id="thing-0"
id="thing-0"
id="thing-0"
id="thing-0"
id="thing-0"
After:
id="thing-0"
id="thing1"
id="thing2"
id="thing3"
id="thing4"
VIM 7.4 on Debian 8.6
Sometimes it can be useful, but sometimes it is annoying, like in this case:
server-1.
server-1.
server-1.
server-1.
after selecting column of 1
s and pressing CTRL-A
the result will be:
server-1.
server0.
server1.
server2.
Maybe there could be some option or separate mode to stick to a selection.
Great plugin btw, saves a lot of time.
this may just be how it works, but its not how i would expect it to. looks like it increments the first number on each line?
thanks for checking it out!
source:
{
"item": "item.1",
"item_2": "item.1",
"another": "item.1",
"other": "item.1",
"more": "item.1",
}
expected:
{
"item": "item.1",
"item_2": "item.2",
"another": "item.3",
"other": "item.4",
"more": "item.5",
}
actual:
{
"item": "item.1",
"item_3": "item.1",
"another": "item.3",
"other": "item.4",
"more": "item.5",
}
Vim visuel increment seems not to Work in Neovim. I haven't idea why.
Thanks in advance for the answer
Hi, I just wanted to let any users of this plugin know that the behavior this plugin provides is already built into vim through g<C-a>
and g<C-x>
. See :help v_g_CTRL-A
.
So to emulate this plugin I've just added these simple mappings to my vimrc so the:
vnoremap <C-a> g<C-a>
vnoremap <C-x> g<C-x>
vnoremap g<C-a> <C-a>
vnoremap g<C-x> <C-x>
I've used this plugin for many years, so thanks to the maintainer for providing this in the first place.
For example, Select and C-a:
0
0
0
Expected result:
0
1
2
Actual result:
0
1
3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.