How do I open a URL under the cursor in my web browser from Vim?
gx
The gx command opens the URL, file path, or identifier under the cursor using the system's default handler.
navigation #navigation #netrw #workflow #browser #normal-mode
411 results for "G"
gx
The gx command opens the URL, file path, or identifier under the cursor using the system's default handler.
navigation #navigation #netrw #workflow #browser #normal-mode
gU{motion} / gu{motion} / g~{motion}
Vim has three case operators that work with any motion or text object: gU for uppercase, gu for lowercase, and g~ for toggle case.
editing #editing #case #operators #text-objects #normal-mode
:%s/\(\w\+\) \(\w\+\)/\2 \1/g
Vim's substitute command supports captured groups (back-references) using \( and \), allowing you to capture parts of a match and rearrange them in the replacem
:cfdo %s/old/new/g | update
The :cfdo %s/old/new/g update command performs a search and replace across every file in the quickfix list and saves each one.
:'<,'>s/\%Vold/new/g
The \%V atom restricts a search pattern to match only within the visual selection area, including visual block selections.
:g/pattern/m 0
The :global command combined with :move lets you restructure a file by relocating all lines that match a pattern.
<C-g> and <C-t>
While the search prompt is open (with incsearch enabled), pressing advances the cursor to the next match and moves it to the previous match — all without leav
:%s/\<old\>/new/g
Wrapping your search pattern in \ word boundary anchors ensures that Vim only matches the exact whole word, preventing accidental replacements inside longer wor
:/start/,/end/s/pattern/replacement/g
You can restrict a substitution to a range defined by two patterns.
g_
g moves the cursor to the last non-blank character of the current line — skipping trailing spaces and tabs.
*
The command searches forward for the exact word under the cursor, jumping to the next occurrence.
g<C-]>
When a symbol (function, class, variable) is defined in multiple places, CTRL-] blindly jumps to the first match.
:tselect
When a tag has multiple definitions (e.
:cdo s/old/new/g
The :cdo command executes a command on every entry in the quickfix list.
:%s/\(\w\+\)/\u\1/g
Vim provides case-conversion atoms in substitute replacements: \u uppercases the next character, \l lowercases it, \U uppercases until \e, and \L lowercases unt
Create plugin/myplugin.vim
A basic Vim plugin is just a .
:g/^/m 0
This clever use of the :global command reverses every line in the current buffer.
command-line #editing #ex-commands #global #text-manipulation
qa I1. <Esc>j q
This simple macro inserts a list number prefix at the beginning of each line.
:changes
How it works Vim maintains a change list that records the position of every change you make to a buffer.
:/start/,/end/ {command}
Vim's range addressing lets you specify a line range using search patterns instead of explicit line numbers.