- Generate tags for the help docs:
- Default vim utility
:helpt path_to_doc_folder
- Provided by Pathogen
:Helptags
- echo the environment variables:
echo &variablename
set variable ?
- Check the number of selected lines in visual mode:
g<c-g>
-
Delete the things with in parentheses:
- Installation of YouCompleteMe!
YouCompleteMe!
-
List all the settings that are different from the default value:
:set
Check where is a variable last set: :verbose set var ?
List all the scripts that the vim has sourced: :scriptnames
-
Some path related macros:
-
the difference between let and set
- "let" is to set the value of a variable while "set" is to set the value of a option
- an option can be transfered to a variable by adding a &, so "let" can assign value to &option. But "set" has no way to set the value of a variable.
- some boolean options can only be set by "set", because they don't take any values. eg:
set number
set option& : to restore the default value of an option
set option! : to unset a boolean option
-
try to write to some read only file
!sudo tee % \gt/dev/null will definitely do the job.
- but after trying a while, I found
!sudo cat \gt % won't do the job. This is because "cat" just write to the stdout, and you were using a bash operator \gt to put it to a file, and of course if you wrote in that way the sudo won't be able to cover the trailing bash operator.
- the solution to this is to reform
sudo. Instead of the previous version, we should use : !sudo -s "cat \gt %" and -s means sudo will use a shell to run the entire expression
- reselected the previous highlighted selects :
gv