VimArea - Day 30 - :'<,'>, marks and PRINT ( incomplete )
This thing is HARD. Still haven't figure out yet. Let me explain:

At the beginning I was looking at '<,'> and it seems to be the range between the start and end of the last VISUAL selection. Which X, X by itself is a range definition.

Range in Vim is very complex and versatile. What makes it so is mostly because of marks. It is one of the arguments you can defined in a range.

Marks

To see the marks, just type :marks and you'll be presented with a list of currently defined marks:
:marks
mark line  col file/text
 '     85    0
 A     23    3 ~/works/astrojs/botanjs/src/Components/Vim/Actions/EDITOR_COMMAND.js
 0     10    0 ~/works/astrojs/botanjs/src/Components/Vim/State/Stack.js
 1    267    0 ~/temp/astroci/logs/access.log
 2    323    0 ~/temp/notify/logs/access.log
 3      2    0 ~/temp/wcache/ci_build
 4      1    0 ~/temp/wcache/logs/README
 5   5904    0 ~/temp/wcache/logs/uhit.log
 6     28    0 ~/temp/wcache/logs/access.log
 7    105    0 ~/temp/wcache/logs/access.log.1
 8     28    0 ~/temp/wcache/logs/access.log
 9    108    0 ~/temp/w10srv/logs/access.log
 "    210    6 var stack = new Stack();
 [      1    0 (function(){
 ]    235    0 })();
 ^    134   27 // does not remove the start position
 .    134   26 // does not remove the start position
Press ENTER or type command to continue

At the beginning I've no idea what those marks were except for < and >. So I checked the help by typing :help marks and FUCK! Another vast universe of Vim.

To reference a mark in a range you'll have to type '{key} such as :'<,'>, which is automatically put there when you typed : in -- VISUAL -- mode.

What makes marks complex

 - They are recorded by lines and columns.
 - Marks A-z seems to be collaborating with the UNDO / REDO commands

What makes it even harder to implement

There is currently no concept of lines in the infrastructure of VimArea ( i.e. lines are dynamically calculated on the fly, since the record of marks needs the line number. I'll have make calculations for every actions that reference to it. )

By design I choose to avoid lines in VimArea because it will have to split lines into an Array and manipulate them with splice, slice, copy, etc. Which in JavaScript is expensive.

I'll have to find a way to record these marks with as low impact as possible to the performance.

Articles in the series


Useful Links

Project home | Demo


Tag(s): vimarea BotanJS
Profile picture
斟酌 鵬兄
Sat Apr 22 2017 15:00:48 GMT+0000 (Coordinated Universal Time)
Last modified: Sat Apr 22 2017 15:00:55 GMT+0000 (Coordinated Universal Time)
Comments
No comments here.
Do you even comment?
website: 
Not a valid website
Invalid email format
Please enter your email
*Name: 
Please enter a name
Submit
抱歉,Google Recaptcha 服務被牆掉了,所以不能回覆了