User Tools

Site Tools


vim_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
vim_notes [2020/11/03 22:05] – [join lines with a character] rajuvim_notes [2023/08/02 18:18] (current) – [print full file name] raju
Line 1: Line 1:
 +===== How can I =====
 +==== vertical alignment of columns ====
 +  * [[pretty_print_csv_data#vim | pretty print csv data in vim]]
 +==== show line endings ====
 +  * https://stackoverflow.com/questions/3569997/how-to-find-out-line-endings-in-a-text-file -> https://stackoverflow.com/a/3570051
 +==== change the encoding to utf-8 ====
 +<code>
 +:set fileencoding=utf8
 +:w myfilename
 +</code>
 +Ref:- https://stackoverflow.com/questions/9310274/how-can-i-use-vim-to-convert-my-file-to-utf8
 +
 ==== insert newline in search and replace ==== ==== insert newline in search and replace ====
   :%s/29/\r29/gc   :%s/29/\r29/gc
Line 9: Line 21:
  
   * https://vi.stackexchange.com/a/14248/12620   * https://vi.stackexchange.com/a/14248/12620
 +
 +==== Preprocess files before diffing them ====
 +  * [[Preprocess files before diffing them]]
 +tags | vimdiff, sort
 +
 +
 +==== print full file name ====
 +
 +  * :echo expand("%:p")
 +  * :!ls %:p
 +  * :!realpath % - be aware that realpath is not POSIX
 +  * :!echo "$PWD/%" - very difficult to type this!
 +  * 1 followed by ctrl-g - shows full path name but does not expand "~" to home directory
 +  * :'<,'>!realpath % - to replace the current selection with the file path
 +  * set statusline+=%F - will show full filename in the status bar
 +  * ctrl-g - shows file path relative to vim's current working directory
 +
 +Ref:- http://vi.stackexchange.com/questions/104/how-can-i-see-the-full-path-of-the-current-file
  
vim_notes.1604441129.txt.gz · Last modified: 2020/11/03 22:05 by raju