Better use of Vim
Key change
I used to think that the key change operation was unnecessary, but after trying for a month, I had no way to re-use others' keyboards ---- It was too slow.
The purpose of the conversion is to map Ctrl to Caps Lock. The reason is that it is easy for the little thumb to press this capital lock and it is difficult to press the original ctrl position.
Changing the key is more important for Emacs users.
Tmux
I have always used Ubuntu as an operating system for code writing. For me, terminals are second only to the use frequency of text editors.
Tmux does not require a great skill. Every time I split the window, there is no high-end operation.
C-b
Add%
You can split the window.C-b
Add→
Is to go to the right of the window, the same is true on the left.
Easy to installsudo apt install tmux
You can.
Plugins
Vim with plug-ins and Vim without plug-ins are two editors.
We recommend that you install vundle. vim as the vim Package Manager. I just introduced this thing. You can be impressed by your hands.
We recommend a website named vimawesome.com which contains the vim plug-in set. You can see the information of most plug-ins.
Then, give a list of my own plug-ins:
Plugin 'VundleVim/Vundle.vim'Plugin 'bling/vim-airline'Plugin 'kien/ctrlp.vim'Plugin 'scrooloose/nerdcommenter'Plugin 'scrooloose/nerdtree'Plugin 'Raimondi/delimitMate'Plugin 'lepture/vim-css'Plugin 'wavded/vim-stylus'Plugin 'fatih/vim-go'Plugin 'SirVer/ultisnips'Plugin 'gosukiwi/vim-atom-dark'Plugin 'pangloss/vim-javascript'Plugin 'mattn/emmet-vim'
The subject color isatom-dark
I have tried material theme before, but I think it's ugly and I don't have the beauty in sublime, so I changed it.
Ctrlp is used to quickly search for files. To be honest, it is really necessary. It gave me a bad habit: I can no longer stand webstorm's search function.
Nerdcommenter is used for fast comments and reverse comments. It is obvious that there is no sublime intelligence, but it has never been found a better alternative.
Nerdtree is the file tree list. Real artifacts. After I read help, I found that it was omnipotent.
Airline is purely decorative. For me, there is no substantive function. But I have been facing this product for nine hours in a day.
DelimitMate auto-completion"
These things.
The followingcss
,stylus
,go
,javascript
All languages are enhanced.
Ultisnips is a fast code snippet. For example, each file has a header comment, and the framework can be put in it. A large number of code writes are artifacts.
Shortcut Key
The shortcut keys of vim are somewhat unreasonable. This makes it hard to remember.
At first, I thought that I was reading tan haoqiang's book. This is an inexplicable shorthand everywhere. However, all the key locations are clear. Next time I see some abbreviations, I will try to understand them according to the following list:
|
|
D |
Delete) |
Y |
Yank (paste) |
C |
Change) |
V |
View) |
O |
Open) |
R |
Replace) |
W |
Word) |
U |
Undo) |
There are many others. In short, when using it, think about why this operation corresponds to this key.
Of course, there are a few keys that are totally unreasonable for efficiency, suchhjkl
These four.
What's amazing.
Operation. You can repeat the previous operation. Very useful tips. But I don't want to say too much. I think these things are more in my own practice and comprehension.
Vim has a magic<Leader>
Key. I have mapped it;
Because it is close to the right thumb, it is easy to press, and it does not conflict with the normal key many functions.
The following is the personal key settings for the plug-in:
I mapped the toggle of nerdtree;t
On, there is no reason, purely feel good.
;cc
Yes annotations,;cu
Yes. This key position was learned from jeffway. I always felt that it was not a good fit, but it was also a good habit.
Nothing else is special.
Common Operations
Although I have not used vim for decades, I still have some operations that I think are commonly used.
I usually do not like to use buffer. Most of them use tab, because tab is easier to observe.
Therefore, the following shortcut keys are commonly used:
gt
: Tab Switch
Ctrl-w-h
In the current window switch, I think this key combination means w represents the window, and Ctrl is only the prefix. The next hjkl is up, down, and left.
In-depth plug-ins
I have something to say about plug-ins.
In my opinion, the configuration of the plug-in is quite complicated.
For example, ctrlp, you need to drop node_modules, ignore,
For airline, You need to download powerline-fonts to display triangles.
Innerdtree
You can pressr
Refresh the current node and pressm
There are more options inm
To delete files.
Write your own snippets in ultisnips.
I think you can better apply these plug-ins to better understand the power of these plug-ins. You need to know that every one of these plug-ins is great, and they can't bear to make their own silly products!
For more Vim tutorials, see the following:
Vim Learning Guide
Quick learn Vi Editor
Powerful Vim Editor
Build a Vim Development Environment on CentOS 6.2
Make Vim an excellent C ++ IDE
Vim tips: C language settings
Set the Vim row number in Ubuntu
This article permanently updates the link address: