I'm trying to get the count of lines in the current file using vimscript but I can't figure out how (and google is returning a bunch of crap about showing line numbers).
If we are in the vim editor, then simply do this, “Press the ENTER key, write the Line number, and press Shift+ g”: Again the output is the same.
If you're already in vi, you can use the goto command. To do this, press Esc , type the line number, and then press Shift-g . If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in the file.
Press ^ to move the cursor to the start of the current line. Press $ to move the cursor to the end of the current line.
You can use line()
function:
:echo line('$')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With