Hot answers tagged

6

One possible solution is to do the calculation by yourself and add them in your status line: First you will need a function which returns as a string your current position as a decimal percentage: function! GetCurrentPosition() return printf('%.2f%%', ( 100.0 * line('.') / line('$') )) endfunction The function uses line('.') to get the position of the ...


4

The default format of the ruler option is directly set in the C core of Vim. If you do not like the default, you can customize it using the 'rulerformat' option and using the statusline format expressions. By experimenting, it seems the default ruler format (when not customized) is: :set rulerformat=%l,%c%V%=%P │ │ │ │ └ position in the ...


4

You can get the size of the buffer in bytes with: :echo line2byte('$') + len(getline('$')) line2byte() gets the number of bytes until the last line, but not including the last line, so we need to add the length of the last line ourselves. You can use %{expr} to use any expression inside the statusline or rulerfrmat settings; for example: let &...


1

Try the following two commands: " Match when cursor before column matchadd('ColorColumn', '\%#.*\zs\%81v', 100) " Match when cursor after column matchadd('ColorColumn', '\%81v\ze.*\%#', 100) It should be possible to combine these into a single regular expression, but simply placing them into an alternation with \| doesn't work correctly*, so doing so ...


1

You can get the size of the file that is loaded in the current buffer with: getfsize(expand(@%)). To add it to the statusline you would use: let &statusline .= "%{getfsize(expand(@%))}" Be aware that it will show -1 for the size of a new unnamed buffer and will update on modified files only after they are saved.


Only top voted, non community-wiki answers of a minimum length are eligible