Open myimages opened 6 years ago
Yes, I do remember not being able to get the word left/right movements to behave the same as Vim. The problem was as you mentioned the difference in word boundaries. I had some trouble in getting both cw
and c2w
(c#w
in general) to work as in Vim. I tried to pick a reasonable compromise that was supported by Scintilla out of the box.
I originally implemented this module using the Scintilla functions like del_word_right
and word_right_extend
but found the code was much simpler if I replied only on getting positions back from Scintilla, i.e. word_end_position
. By building position functions and then combining them with actions like move
, cut
, and select
, I could get the whole cross product of action/movements supported by Vim with only needing to code the dimensions. For example, movements
X actions
= { w
, fa
, l
, j
, ... } X { move
, cut
, select
, ... } = { w
, dw
, vw
, ..., fa
, dfa
, vfa
, ... }. For this reason, I only use the position commands from Scintilla.
If you find a better way to support word movements, please submit a PR!
For dd
at the end of the file, could you clarify what you mean? I have found that Textadept/Scintilla will show the next line number when the previous line has a newline. For example, a file with contents `ab\ncd\n' will show line numbers 1, 2, 3 though the file has only 2 lines. As such, deleting line 3 has no effect.
thank you for the clarification.
sure , I ll see If I could get this to work.
for the dd
part , buffer:delete_line()
does not delete the line if it was an empty line at the end of the file so I apologize for reporting this as bug. I am not sure if this should be reported as a TA bug or not.
the movement
cw
anddw
, change and deletes the word including (dot
)cw
in taviactual vim behavior ( of a word boundary )
cw
TA
buffer:del_word_right
with no args seems to do the right thing every time which matches vim's behavior of what a word is.I ll send a pull request if I figure this out since I am still new to lua and TA.
also , Delete line
dd
does not work when there is an empty line at the end of the file.