« first day (1666 days earlier)      last day (2006 days later) » 

05:11
Hi all, is there a variable to refer to the last line in vim? for example, to do this: :echom strlen(getline(<last-line>))
05:29
@aderchox I think "$" would work
 
2 hours later…
07:57
@DJMcMayhem Yes I had tried $, but now tried it with double quotations around it and it works. Thanks
08:26
Guys why is this leaving a "^M" on the last (no-empty) line? (Sorry I'm new to Vim, let alone its scripts :D)
:nnoremap <expr> ,, strlen(getline("$"))==0 ? 'G<cr>':'GA^M<cr>'
I want ",," to go to last line if it's blank or otherwise to the line after the last line
I used Ctrl-K and then pressed the Enter key twice and Vim suggests ^M for the Enter key, that's why I used it
09:22
@aderchox I think you want Ctrl-V, not Ctrl-K
See :help i_CTRL-V
As opposed to :help i_CTRL-K
But in any case, it's easier to do it with a non-literal string:
:nnoremap <expr> ,, strlen(getline("$"))==0 ? 'G':"GA\<cr>"
I'm not sure why you've included <cr> in both sides of your ternary expression: I think perhaps you've got some confusion about when you need <cr> in a mapping
09:38
Oh. Disregard what I wrote about CTRL-V. My apologies! Didn't realise there was a digraph for Ctrl-M
In fact, disregard everything I wrote above apart from my suggested mapping.
Although I think you probably actually want this mapping: nnoremap <expr> ,, strlen(getline("$"))==0 ? 'G' : 'GA<CR><Esc>'
Which leaves you in normal mode regardless of whether you had anything on your last line to start with.
You don't need to faff about with entering literal Enter characters via CTRL-K because the evaluated expression is used as the right-hand side of the mapping, and so the <CR> and <Esc> are interpreted as in :help :map-special-chars
 
8 hours later…
18:00
Where can I report vim bugs?
I'm pretty sure I've just discovered a bug where the -w keystroke-file options garbles one specific byte but not any of the others
@Rich Oh I appreciate it Rich. Thanks for taking your time and detailed answer.
18:16
Nevermind. Looks like the bug is fixed when I update to the newest version
18:50
0
Q: Highlighting a search capture group

lindheBy :set hl, the search result of a / expression is highlighted, for example: And if one wants to replace one substring distinguished by its surrounding, one can do so elegantly using regex capture groups: However, the search highlight does not reflect this capture group. Sometimes, it would...

 
3 hours later…
22:08
Got a fun little riddle for all you vimmers: Starting from normal mode, insert the exact text Hello world! into your buffer. The twist is that no keystroke may be repeated. Fewest keystrokes wins
(Modifiers like ctrl-alt-shift are OK. "a" and "A" are two different keystrokes)

« first day (1666 days earlier)      last day (2006 days later) »