Is there any key mapping that outputs the current row number of the line being edited? Or, even better yet, can we do formulas based on the output of the key mapping?
I want to get the row number and add 1
to the current text being edited.
Getting a row number is easy—just find the cell you're interested in, click on it, and look at the highlighted row number on the side of the window. Sometimes, however, you need to use that information in a function. That's where ROW comes in. This function can be run with no arguments.
The ROW function in Google Sheets returns the row number of a given cell. For example, if you want to know what row number the cell A1 is in, you would use the function =ROW(A1). This function is especially useful when you're working with formulas and need to refer to specific rows or columns.
The COLUMN function returns the column number of the given cell reference. For example, the formula =COLUMN(D10) returns 4, because column D is the fourth column.
ROW in Excel Example #1If we write the ROW formula excel, let say in the 3rd row in any cell, it will return the number 3, which is the row number.
Ctrl+G will tell you the line number and even the column the cursor is in. If you mean output it as text to your document, then not that I know of.
What do you mean by "output"? You can do:
:echo line(".") + 1
To display the current line number plus 1. You can bind a keystroke with map
, eg:
:noremap <F1> :echo line(".") + 1<cr>
To actually insert the data into the buffer:
:noremap <F1> :execute "normal! i" . ( line(".") + 1 )<cr>
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