Comments (3)
Oooh halloween bug. Spooky!
Good catch, @felippenardi! Thanks! I will try to tackle it soon. Nevertheless, feel free to open a PR if you wish. :)
from cosco.vim.
So... I've been playing and researching a bit about this... I think this is actually in sync with the way vim works: if you execute a :s
command (which is what cosco does under the hood) and then undo that :s
, vim will automatically place the cursor in the beginning of the line.
It kind of makes sense when you think that you're executing an action in the whole line and then reverting the whole line modification.
To my basic VimL understanding, the only way to "cheat" this would be manipulate the undo tree, which I don't even think it's possible or make invisible steps, for example: going to insert mode, insert a char, delete it right after, and then executing the Cosco action (hence undo would go to the previous insertion point (which was were your cursor was).
But I'm not very keen on this solution as it may have undesired side effects as changing the user's jump list
or maybe even make the command slower/noticeable in slower environments. And this a bad practice for plugins (to change vim's default behaviour). What do you think?
What I would suggest until we find a solution for this case is: after undoing (and vim placing your cursor in the beginning of the line), hit Ctrl-o
to jump back to where you were.
I'd be happy to hear from more experienced vim scripters :)
from cosco.vim.
That makes sense! :)
from cosco.vim.
Related Issues (18)
- Experimental semicolon auto insertion breaks in non-editable buffers HOT 4
- Semicolons are added to comment lines HOT 3
- Semicolons added to methods if braces are opened on the next line HOT 2
- New "Undefined variable" error when invoking on Neovim HOT 5
- print "test"; # here's a comment (adds ; here) HOT 2
- colon support, in addition to comma or semicolon HOT 1
- Missplacing comma with semi-colon HOT 3
- Allow users to ignore semicolon insertion based on a regex pattern HOT 3
- Pass end symbol to the command as a fallback option
- g:auto_comma_or_semicolon needs "cosco" prefix for consistency HOT 1
- Doesn't recognize common comment blocks. HOT 8
- Can you provide a 'toggle' feature? HOT 6
- s:strip(string) not working on neovim
- Return to original position is 1 index behind if the action was triggered at the end of the line
- Automatically add needed semicolons HOT 4
- Make the action repeatable with `.` HOT 2
- Possible to use in Insert Mode? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cosco.vim.