Use :sort
to sort selected lines alphabetically. (:sort u
to remove duplicates; :sort!
to sort desc, :sort n
for numeric sorting)
package main | |
import ( | |
"bytes" | |
"fmt" | |
"bufio" | |
"log" | |
"os" | |
) |
package main | |
import "fmt" | |
func main() { | |
m := make(map[rune]int) | |
var twos, threes int | |
input := []string{"aabbffuuu", "zzaaafff", "ff"} |
Use :[from],[to]s/[search]/[replace]/g
to replace all occurrences of [search]
with [replace]
on the lines from [from]
to [to]
.
Use :Ack --type [type] [pattern]
to search for [pattern]
only in files of [type]
with ack.vim. Check available types with ack --help-types
.
E.g.: Ack --type js forEach
.
Use *:Ack
to search for the word under the cursor in the current directory with ack.vim.
Use gq
to wrap the currently selected lines to the textwidth
setting (gqq
to wrap the current line and gqip
to wrap the current paragraph).
BTW: The vim-editorconfig sets the textwidth
to the specified max_line_length
.
Use b#
to switch to the previous buffer (i.e. the file which was previously edited)
Use vim -oN
to open VIM with N
horizontal splits. Use vim -ON
to open VIM with N
vertical splits.