The default vim go language syntax file uses a tabstop of 8, which is a bit excessive.
This stackoverflow post has a cool way to remove the last occurrence of a character in vim : :%s/.*\zs,/|/ This replaces the last occurrence of a comma with a pipe. Other examples can be found on the vim wikia.
To highlight the current line in Vim, you have to set the cursorline setting. :set cursorline :set cul These two are the same. This can also be set in your _vimrc file, you don’t need the colon then. Here’s an extract from my vimrc file: set cursorline set nowrap set ic " Ignore case set ai " autoindent set tabstop=4 set shiftwidth=4 set expandtab set cul " Cursor highlight map <f1> ^hhxxj0 map <f2> ^i <esc>j0 The last 2 entries add mappings for F1 and F2, to dedent and indent the current line.
In vim, if you want to change something from the current line until the end of the line, you can use .,$ as the range segment of the s command. :.,$s/COMPILE/COMPILE BODY/g Substituting over the full file is done by using the % range, which is a shortcut for 1,$, ie from the first to the last line. :%s/COMPILE/COMPILE BODY/g
To insert the current file name in Vim, go to insert mode. Then type Control-R % . With Control-R you can do more things : Control-R =5*4 This inserts 20 into the current cursor position. Some examples can be found here
Copyright (c) 2024 Michel Hollands