mirror of
https://github.com/Hizenberg469/Vim-tutorials.git
synced 2026-04-19 22:02:24 +03:00
moved my notes to my-learning
This commit is contained in:
95
my-learning/vimrc-tut.txt
Normal file
95
my-learning/vimrc-tut.txt
Normal file
@@ -0,0 +1,95 @@
|
||||
vimrc
|
||||
--------------
|
||||
|
||||
* rc = run commands
|
||||
* System-wide vimrc and personal vimrc
|
||||
* Unix/Linux/Mac: ~/.vimrc
|
||||
* Windows: $HOME/_vimrc
|
||||
* Each line is executed as a command.
|
||||
|
||||
set ruler = :set ruler
|
||||
|
||||
vimrc line command
|
||||
|
||||
|
||||
|
||||
%% TIPS %%
|
||||
|
||||
* If we use :set line-cmd, it will display all the option
|
||||
which have value other than the default value are displayed.
|
||||
|
||||
* To revert a option back to its default value, we can use:
|
||||
:set <option>&
|
||||
|
||||
* To open and edit a file, while the vim is already running,
|
||||
we can use:
|
||||
:e <filename>
|
||||
|
||||
* To see the full path of the current working file in vim, we
|
||||
can use <num> + CTRL + g.
|
||||
|
||||
where <num> > 0.
|
||||
|
||||
* To list all the option we can use to set in .vimrc file can done
|
||||
using:
|
||||
|
||||
:h option-list
|
||||
|
||||
Note: There are total 379 option that we can set.
|
||||
|
||||
Another way to view the option is by using:
|
||||
|
||||
:option
|
||||
|
||||
|
||||
* To get to know about different type of color-scheme
|
||||
we can use:
|
||||
|
||||
:color<space> + CTRL + d
|
||||
|
||||
* After downloading the colorscheme.
|
||||
|
||||
We can put it in the directory:
|
||||
|
||||
/home/<user>/.vim/colors -> Linux
|
||||
/Users/<user>/.vim/colors -> Mac
|
||||
|
||||
|
||||
* To map some keystrokes with a particular key (Just like a snippet)
|
||||
|
||||
we use:
|
||||
|
||||
map <KEY> <KEYSTROKES>
|
||||
|
||||
|
||||
* To execute a command written in a file.
|
||||
|
||||
we will use:
|
||||
|
||||
:source <filename>
|
||||
|
||||
For ex:
|
||||
|
||||
:source .vimrc
|
||||
|
||||
|
||||
* Vim has lot of Key-binding having a specific command to execute.
|
||||
|
||||
To define a namespace kind of a thing for specific key-binding
|
||||
to execute certain commands we can use mapleader concept.
|
||||
|
||||
By default mapleader key is "\"
|
||||
|
||||
This can be changed by using
|
||||
let mapleader="<key>"
|
||||
|
||||
|
||||
then using it like
|
||||
|
||||
map <leader>w :w!<CR>
|
||||
|
||||
map <leader>key <keystrokes>
|
||||
|
||||
To see the current mapping of keys we can use command:
|
||||
|
||||
:mapping
|
||||
Reference in New Issue
Block a user