Being tired of using arrow keys for navigation inside vim ?
wondered about tabbed editing in vim ?
tired of using Esc wq! in vim ?
Want to make effective use of your Vim editor.?
Ever wondered you could use ctrl+(key) for editing operations as you do in other GUI editots.?
Here are some tips which would turn your vim to a powerful editing tool.
I am sure you will get addicted to and will be falling in love with VIM,as i did :)
When you have not changed the settings of vim, the file you need to paste in is ~/.vimrc If there is no such file, dont worry create it.
wondered about tabbed editing in vim ?
tired of using Esc wq! in vim ?
Want to make effective use of your Vim editor.?
Ever wondered you could use ctrl+(key) for editing operations as you do in other GUI editots.?
Here are some tips which would turn your vim to a powerful editing tool.
I am sure you will get addicted to and will be falling in love with VIM,as i did :)
Do i need any additional files to be downloaded?
I have used many plugins here, that i needed most. If your main editor is vim and you have no option of GUI to do your work, then you should be using these to have a pleasant working :)How Do I Make these changes in My VIM ?
copy the section that you wish you need to try, and paste the test to your .vimrc file.When you have not changed the settings of vim, the file you need to paste in is ~/.vimrc If there is no such file, dont worry create it.
if &term == "xterm"
set t_ti=
endif
set autoindent
set background=dark
set ruler
set laststatus=2
If only hitting enter starts the search,
add the below lines to search as you type in and highlight your search results.
set incsearch set hlsearchloosing your history of commands you give in your vim ?
Tell vim to save the last 999 commands you typed in !!
set history=999***********************************************************************************
File Operations P**********************************************************************************
clears highlighting
mapUse Ctrl+w to save the file.:nohl map
mapIgnore changes and Quit:w
mapsave and Quit command in visual mode:q!
map wqUndo command in visual mode:wq! imap wq :wq!
mapRedo,copy and paste command in visual modeu
map***********************************************************************************U map yy map p
" Insert mode key Mappings ***********************************************************************************
Use contrl+w to save in insert mode
:imapuse ctrl+space to autocomplete in vim !!:w
:imapSave and Quit in insert mode
:imapIgnore changes and Quit in insert mode:wq
:imapUndo and redo command in insert mode:q!
:imapCopy and paste command in insert modeu :imap U
imapToggle between Tlist and mouse mode.yy imap p
function! ToggleMouse()
if &mouse == 'a'
set mouse=
TlistClose
echo "Mouse usage disabled"
else
set mouse=a
TlistOpen
echo "Mouse usage enabled"
endif
endfunction
:imap mm :call ToggleMouse()
*********************************************************************************** " set the ctags path ***********************************************************************************
search for ctags from the current directory upwards till the root(without this line, you need to be in the directory in which the ctags was built, to use the c tags)
set tags=tags;/***********************************************************************************
" Tab navigation ***********************************************************************************
map***********************************************************************************:tabprevious nnoremap :tabnext
" Cscope in vim ***********************************************************************************
"cscope mapping
if has("cscope")
" Find this C symbol
map :tab split:cs find 0 =expand("")
" Find This Global Definiton
map :tab split:cs find 1 =expand("")
" Find Funtions called by this function
map :tab split:cs find 2 =expand("")
" Find functions calling this function
map :tab split:cs find 3 =expand("")
" Find This Text String
map :tab split :cs find 4 =expand("")
" Find this definition
map :tab split:exec("tag ".expand(""))
" Find the egrep
map :cs find e =expand("")
" Find the file
map :cs find f
map :vsp :exec("tag ".expand(""))
" Find this C symbol
map :cs find 0 =expand("")
" Find This Global Definiton
map :cs find 1 =expand("")
" Find Funtions called by this function
map :cs find 2 =expand("")
" Find functions calling this function
map :cs find 3 =expand("")
" Find This Text String
map :cs find 4 =expand("")
map :tab split :cs find 3 =expand("")
" Find this definition
map :exec("tag ".expand(""))
" Find the egrep
map :cs find e =expand("")
" Find the file
map :cs find f
map :vsp :exec("tag ".expand(""))
endif
map :ta
map
map
*********************************************************************************** " Mouse control ***********************************************************************************
map
" Plugin Commands ***********************************************************************************
"Toggle Tablist nnoremap
" Misc ***********************************************************************************
filetype plugin on ***********************************************************************************
Disable the arrow keys ! use hjkl instead ***********************************************************************************
nnoremap***********************************************************************************nnoremap nnoremap nnoremap inoremap inoremap inoremap inoremap nnoremap j gj nnoremap k gk
" save on lost focus ***********************************************************************************
au FocusLost * :wa***********************************************************************************
" use jj for
inoremap jj***********************************************************************************
" for srcexpl plugin ***********************************************************************************
" The switch of the Source Explorer nmap:Tlist :SrcExplToggle " Set the height of Source Explorer window let g:SrcExpl_winHeight = 8 " Set 100 ms for refreshing the Source Explorer let g:SrcExpl_refreshTime = 100 " Set 'Enter' key to jump into the exact definition context let g:SrcExpl_jumpKey = " " " Set 'Space' key for back from the definition context let g:SrcExpl_gobackKey = " " " In order to Avoid conflicts, the Source Explorer should know what " plugins are using buffers. And you need add their bufname into the list below " according to the command 'buffers!' let g:SrcExpl_pluginList = [ \ "__Tag_List__", \ "_NERD_tree_", \ "Source_Explorer" \ ] " Enable/Disable the local definition searching, and note that this is not " guaranteed to work, the Source Explorer doesn't check the syntax for now. " It only searches for a match with the keyword according to command 'gd' let g:SrcExpl_searchLocalDef = 1 " Do not let the Source Explorer update the tags file when opening let g:SrcExpl_isUpdateTags = 0 " Use 'Exuberant Ctags' with '--sort=foldcase -R .' or '-L cscope.files' to " create/update a tags file let g:SrcExpl_updateTagsCmd = "ctags --sort=foldcase -R ." " Set ' ' key for updating the tags file artificially let g:SrcExpl_updateTagsKey = " "
Make some differentiation in your comments, from the commands to be used. Doesn't look appealing in the current way
ReplyDelete