Welcome to mirror list, hosted at ThFree Co, Russian Federation.

2018-02-09-vim-tips.md « post « content « exampleSite - github.com/zhaohuabing/hugo-theme-cleanwhite.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b81871eb9ec7bfbaba9e4c72cea2554fc1fe6e71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
layout:     post
title:      "Vim Tips"
subtitle:   ""
description: "Vim Tips and tricks"
date:       2018-02-09 11:00:00
author:     "赵化冰"
image:      "/img/2018-02-09-vim-tips/matrix.jpg"
published: true
tags:
    - Tips
    - Vim
URL: "/2018/02/09/vim-tips/"
categories: [ Tips ]
---
## vim graphical cheat sheet

![](//img/2018-02-09-vim-tips/vi-vim-cheat-sheet.svg)
<!--more-->
## Vim Jumps

* ^ — Move to start of line
* $ — Move to end of line
* b — Move back a word
* w — Move forward a word
* e — Move to the end of the next word
* Ctrl-o and Ctrl-i to go to the previous/next location you jumped to
* ``(two backticks) jump back to where you were
* gi go back to the last place you inserted a text and enter insert mode

## Vim Navigations

* { and } jump paragraph back and forth
* Ctrl-F/B move one screen back and forth
* Search the word under cursor, then n/p to jump to next/previous 


## Enable Vim mode in bash
vi ~/.inputrc
set editing-mode vi

## Enable system clipboard upport

See if system clipboard is supported:     
```
$ vim --version | grep clipboard
-clipboard       +iconv           +path_extra      -toolbar
+eval            +mouse_dec       +startuptime     -xterm_clipboard
```

Rinstall vim as vim-gnome:   
```
sudo apt-get install vim-gnome
```
Select what you want using the mouse - then type to copy to clipboard:  
```
"+y
```

To paste to vim from clipboard type:  
```
"+p
```
## Others
* Ex: open the current directory
* set number: show line number