Enhanced gf command for Vim with line:column support and multi-line path detection.
- Line and column support - Jump to
file:line:columnformat (Vim's built-ingfonly supportsfile:line) - Vertical split support - Smart vsplit handling via
g:gf_improved_verticalor automatic detection fromdiffopt - Multi-line path detection - Handles file paths split across multiple lines (especially useful for terminal buffer output)
- Works with all standard
gfvariations (gf,gF,<C-w>f,<C-w>F,<C-w>gf,<C-w>gF)
Plug 'lambdalisue/vim-gf-improved'call dein#add('lambdalisue/vim-gf-improved')use 'lambdalisue/vim-gf-improved'The plugin automatically maps the standard gf commands to the improved versions:
gf- Open file under cursorgF- Same asgfbut with line/column support<C-w>f- Open file in split<C-w>F- Open file in split with line/column support<C-w>gf- Open file in new tab<C-w>gF- Open file in new tab with line/column support
Place your cursor on any of these formats and press gF:
path/to/file.txt- Opens filepath/to/file.txt:42- Opens file at line 42path/to/file.txt:42:10- Opens file at line 42, column 10
The plugin can detect paths that span multiple lines, useful for terminal output:
Error in /path/to/very/long/
filename/that/spans/multiple/lines.txt:10:5
Place your cursor on the first line of the path (/path/to/very/long/) and press gf - the plugin will search subsequent lines to complete the path.
If you want to define your own mappings:
let g:gf_improved_no_mappings = 1
" Define your own mappings
nmap <Leader>gf <Plug>(gf-improved-gf)
nmap <Leader>gF <Plug>(gf-improved-gF)Control whether <C-w>f and <C-w>F open vertical or horizontal splits:
" Use vertical splits (default: follows 'diffopt' setting)
let g:gf_improved_vertical = 1
" Use horizontal splits
let g:gf_improved_vertical = 0The code in this repository follows MIT license texted in LICENSE. Contributors need to agree that any modifications sent in this repository follow the license.