Tips: quickly jump to header or source file

This commit is contained in:
Marco Hinz 2016-01-06 04:05:52 +01:00
parent 98c42ddb77
commit 405b113f94
2 changed files with 12 additions and 0 deletions

View File

@ -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 move current line](README.md#quickly-move-current-line)
- Tips: [Quickly add empty lines](README.md#quickly-add-empty-lines) - Tips: [Quickly add empty lines](README.md#quickly-add-empty-lines)
- Tips: [Quickly edit your macros](README.md#quickly-edit-your-macros) - 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) - Tips: [Don't lose selection when shifting sidewards](README.md#dont-lose-selection-when-shifting-sidewards)
## [1.0] - 2016-01-06 ## [1.0] - 2016-01-06

View File

@ -21,6 +21,7 @@
- [Quickly move current line](#quickly-move-current-line) - [Quickly move current line](#quickly-move-current-line)
- [Quickly add empty lines](#quickly-add-empty-lines) - [Quickly add empty lines](#quickly-add-empty-lines)
- [Quickly edit your macros](#quickly-edit-your-macros) - [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) - [Don't lose selection when shifting sidewards](#dont-lose-selection-when-shifting-sidewards)
#### [Debugging](#debugging-1) #### [Debugging](#debugging-1)
@ -395,6 +396,16 @@ nnoremap <leader>m :<c-u><c-r>='let @'. v:register .' = '. string(getreg(v:regi
``` ```
Use it like this `<leader>m` or `"q<leader>m`. Use it like this `<leader>m` or `"q<leader>m`.
#### 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 #### Don't lose selection when shifting sidewards
If you select one or more lines, you can use `<` and `>` for shifting them If you select one or more lines, you can use `<` and `>` for shifting them