Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
vim [2019/06/28 18:14] paul |
vim [2020/10/19 17:24] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Vim ====== | ====== Vim ====== | ||
+ | |||
Vim is one of my favorite tools. Whenever you are working and think, hey it | Vim is one of my favorite tools. Whenever you are working and think, hey it | ||
would be really useful if I could do this, chances are Vim lets you do just that | would be really useful if I could do this, chances are Vim lets you do just that | ||
Line 5: | Line 6: | ||
===== Installing Vim ===== | ===== Installing Vim ===== | ||
+ | |||
Installing Vim with my plugins requires Vim with python. The reason for this is so that YCM works. | Installing Vim with my plugins requires Vim with python. The reason for this is so that YCM works. | ||
There is an issue with YCM, Vim and Ubuntu 16.04 which is a conflict between python 2 and 3. | There is an issue with YCM, Vim and Ubuntu 16.04 which is a conflict between python 2 and 3. | ||
Line 20: | Line 22: | ||
python3-dev ruby-dev lua5.1 lua5.1-dev libperl-dev git | python3-dev ruby-dev lua5.1 lua5.1-dev libperl-dev git | ||
- | sudo apt-get remove | + | sudo apt-get remove |
</ | </ | ||
- | Make sure Vim is removed! When you type Vim you should see nothing | + | Make sure Vim is removed! When you type vim you should see nothing |
==== Compiling ==== | ==== Compiling ==== | ||
Line 31: | Line 33: | ||
<code bash> | <code bash> | ||
cd | cd | ||
- | git clone https:// | + | git clone https:// |
- | cd Vim | + | cd vim |
git checkout | git checkout | ||
Line 48: | Line 50: | ||
| | ||
- | make VimRUNTIMEDIR=/ | + | make vimRUNTIMEDIR=/ |
sudo apt install checkinstall | sudo apt install checkinstall | ||
sudo checkinstall | sudo checkinstall | ||
- | sudo update-alternatives --install / | + | sudo update-alternatives --install / |
- | sudo update-alternatives --set editor / | + | sudo update-alternatives --set editor / |
- | sudo update-alternatives --install /usr/bin/vi vi / | + | sudo update-alternatives --install /usr/bin/vi vi / |
- | sudo update-alternatives --set vi / | + | sudo update-alternatives --set vi / |
</ | </ | ||
Be sure to change the version when executing the make command. For instance, if the major Vim version is at 8.2, then make line should be: | Be sure to change the version when executing the make command. For instance, if the major Vim version is at 8.2, then make line should be: | ||
<code bash> | <code bash> | ||
- | make VimRUNTIMEDIR=/ | + | make vimRUNTIMEDIR=/ |
</ | </ | ||
Then grab the Vundle plugin manager. | Then grab the Vundle plugin manager. | ||
<code bash> | <code bash> | ||
- | git clone https:// | + | git clone https:// |
</ | </ | ||
- | Get the '' | + | Get the '' |
- | Run Vim and use command < | + | Run Vim and use command < |
YouCompleteMe requires a bit more processing to install: | YouCompleteMe requires a bit more processing to install: | ||
<code bash> | <code bash> | ||
- | cd .Vim/ | + | cd .vim/ |
./ | ./ | ||
</ | </ | ||
Line 95: | Line 97: | ||
// List of packages to not update (regexp are supported) | // List of packages to not update (regexp are supported) | ||
Unattended-Upgrade:: | Unattended-Upgrade:: | ||
- | "Vim"; | + | "vim"; |
// | // | ||
// | // | ||
Line 107: | Line 109: | ||
[[https:// | [[https:// | ||
- | < | + | < |
:echo has(" | :echo has(" | ||
:echo has(" | :echo has(" | ||
Line 127: | Line 129: | ||
|script-variable| | |script-variable| | ||
|function-argument| | |function-argument| | ||
- | |Vim-variable| | + | |vim-variable| |
</ | </ | ||
The following command shows you all the variables that are set. | The following command shows you all the variables that are set. | ||
- | < | + | < |
:let g: | :let g: | ||
</ | </ | ||
If you type a variable name after, you will get what it is currently set to. | If you type a variable name after, you will get what it is currently set to. | ||
- | < | + | < |
:let g: | :let g: | ||
</ | </ | ||
+ | |||
+ | To go to a tab, do '' | ||
+ | |||
+ | Send one command while in insert mode: '' | ||
+ | |||
+ | Open a link in mac with the cursor on it: '' | ||
+ | |||
+ | ===== Snippets ===== | ||
+ | |||
+ | To use snippets for repetive code, put that code in a folder. Then use the '' | ||
+ | ./ | ||
+ | Pease! | ||
==== Editing Remote Files ==== | ==== Editing Remote Files ==== | ||
Line 148: | Line 162: | ||
===== Plugins ===== | ===== Plugins ===== | ||
+ | |||
The following is info on the plugins I use. | The following is info on the plugins I use. | ||
+ | ==== Airline ==== | ||
+ | |||
+ | It took me so long to figure this stupid plugin out. It doesn' | ||
+ | |||
+ | === For MacOS === | ||
+ | |||
+ | Install the patched font, then select the font in terminal. | ||
+ | |||
+ | {{: | ||
==== NerdTree ==== | ==== NerdTree ==== | ||
Line 163: | Line 187: | ||
the '' | the '' | ||
- | < | + | < |
- | let g: | + | let g: |
</ | </ | ||
Line 179: | Line 203: | ||
red, and they cover any text making it super annoying. SO. You have to change the | red, and they cover any text making it super annoying. SO. You have to change the | ||
color. THIS IS NOT EASY as there are like a bajillion different colors. There are | color. THIS IS NOT EASY as there are like a bajillion different colors. There are | ||
- | cterm colors and gui colors. Gui colors are for gVim, which we don't use so don't | + | cterm colors and gui colors. Gui colors are for gvim, which we don't use so don't |
worry about that. We use cterm colors, and there are ctermfg and ctermbg. | worry about that. We use cterm colors, and there are ctermfg and ctermbg. | ||
< | < | ||
- | gui == gVim. | + | gui == gvim. |
cterm == terminal. | cterm == terminal. | ||
fg == foreground | fg == foreground | ||
Line 202: | Line 226: | ||
So to change the warning highlight color, I would say: | So to change the warning highlight color, I would say: | ||
- | < | + | < |
highlight YcmWarningSection ctermfg=XTERMCOLORNUMBER | highlight YcmWarningSection ctermfg=XTERMCOLORNUMBER | ||
</ | </ | ||
Line 210: | Line 234: | ||
==== Command-T ==== | ==== Command-T ==== | ||
For the command-t plugin, you need to go to '' | For the command-t plugin, you need to go to '' | ||
- | type in '' | + | type in '' |
c extension" | c extension" | ||
Line 233: | Line 257: | ||
brackets. There are lots of ones I use regularly and to refresh do | brackets. There are lots of ones I use regularly and to refresh do | ||
- | < | + | < |
:help unimpared | :help unimpared | ||
</ | </ | ||
Line 244: | Line 268: | ||
- | ===== Vim Operations ===== | + | ===== vim Operations ===== |
==== Exuberant Ctags ==== | ==== Exuberant Ctags ==== | ||
Line 267: | Line 291: | ||
To search and replace within a visual selection within a line you must use the %V atom. Make a selection and use the following command: | To search and replace within a visual selection within a line you must use the %V atom. Make a selection and use the following command: | ||
- | < | + | < |
: | : | ||
</ | </ | ||
Line 273: | Line 297: | ||
==== Movement ==== | ==== Movement ==== | ||
- | < | + | < |
]] " Jump forward to begin of next toplevel | ]] " Jump forward to begin of next toplevel | ||
[[ " Jump backwards to begin of current toplevel (if already there, previous toplevel) | [[ " Jump backwards to begin of current toplevel (if already there, previous toplevel) | ||
Line 287: | Line 311: | ||
==== Commenting ==== | ==== Commenting ==== | ||
- | I use plugin [[https:// | + | I use plugin [[https:// |
- | < | + | < |
gc{motion} | gc{motion} | ||
gc< | gc< | ||
Line 297: | Line 321: | ||
==== Programming ==== | ==== Programming ==== | ||
- | < | + | < |
< | < | ||
</ | </ | ||
+ | |||
+ | ==== Ordered Number List ==== | ||
+ | |||
+ | Make a list of 1's, then block select the second one, and then press g < | ||
==== Quickfix ==== | ==== Quickfix ==== | ||
Line 309: | Line 337: | ||
==== Vidir ==== | ==== Vidir ==== | ||
- | To edit filenames in a dir using Vim, use the linux executable '' | + | To edit filenames in a directory |
===== Programming C/C++ in Vim ===== | ===== Programming C/C++ in Vim ===== | ||
Line 335: | Line 363: | ||
Link: [[https:// | Link: [[https:// | ||
- | Link: [[http://useVim.com/ | + | Link: [[http://usevim.com/ |
Issue is because of xsmp init. Vim is trying to connect | Issue is because of xsmp init. Vim is trying to connect | ||
- | |||