From 405b113f94f7e2633a32ed4c5fb7acdbcdb1c41f Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Wed, 6 Jan 2016 04:05:52 +0100 Subject: [PATCH] Tips: quickly jump to header or source file --- CHANGELOG.md | 1 + README.md | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17df652..5262a04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. - Tips: [Quickly move current line](README.md#quickly-move-current-line) - Tips: [Quickly add empty lines](README.md#quickly-add-empty-lines) - Tips: [Quickly edit your macros](README.md#quickly-edit-your-macros) +- Tips: [Quickly jump to header or source file](README.md#quickly-jump-to-header-or-source-file) - Tips: [Don't lose selection when shifting sidewards](README.md#dont-lose-selection-when-shifting-sidewards) ## [1.0] - 2016-01-06 diff --git a/README.md b/README.md index 2cad313..f49ca1d 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ - [Quickly move current line](#quickly-move-current-line) - [Quickly add empty lines](#quickly-add-empty-lines) - [Quickly edit your macros](#quickly-edit-your-macros) +- [Quickly jump to header or source file](#quickly-jump-to-header-or-source-file) - [Don't lose selection when shifting sidewards](#dont-lose-selection-when-shifting-sidewards) #### [Debugging](#debugging-1) @@ -395,6 +396,16 @@ nnoremap m :='let @'. v:register .' = '. string(getreg(v:regi ``` Use it like this `m` or `"qm`. +#### Quickly jump to header or source file + +This technique can probably be applied to many filetypes. It sets _file marks_ +(see `:h marks`) when leaving a source or header file, so you can quickly jump +back to the last accessed one by using `'C` or `'H` (see `:h 'A`). +```viml +autocmd BufLeave *.{c,cpp} mark C +autocmd BufLeave *.h mark H +``` + #### Don't lose selection when shifting sidewards If you select one or more lines, you can use `<` and `>` for shifting them