mirror of https://github.com/nirenjan/dotfiles.git
Add commonly used Vim scripts
parent
978608f8e1
commit
9217cc1a0d
|
@ -2,3 +2,6 @@ vim-scripts
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Commonly used Vim scripts
|
Commonly used Vim scripts
|
||||||
|
|
||||||
|
Copy the scripts to your ~/.vim/ folder
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Function header plugin for vim
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
"
|
||||||
|
" This plugin inserts a C/C++ function header as specified below:
|
||||||
|
" /*
|
||||||
|
" * Function:
|
||||||
|
" * Description:
|
||||||
|
" * Input Args:
|
||||||
|
" * Output:
|
||||||
|
" */
|
||||||
|
"
|
||||||
|
" USAGE:
|
||||||
|
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
|
||||||
|
" 'plugin' directory in some other directory that is in your
|
||||||
|
" 'runtimepath'.
|
||||||
|
"
|
||||||
|
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
|
||||||
|
" your ~/.vimrc file (or cut and paste it into your .vimrc).
|
||||||
|
"
|
||||||
|
" NOTE:
|
||||||
|
" On pressing <F4> in insert mode, this plugin will insert a function-block
|
||||||
|
" comment and place the cursor on the line to type the function name.
|
||||||
|
"
|
||||||
|
" Nirenjan Krishnan nirenjan@gmail.com 2008/12/16
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" Insert function header
|
||||||
|
function FunctionHeading()
|
||||||
|
let s:line=line(".")
|
||||||
|
call setline(s:line ,"/*")
|
||||||
|
call append(s:line ," * Function: ")
|
||||||
|
call append(s:line+1," * Description: ")
|
||||||
|
call append(s:line+2," * Input Args: ")
|
||||||
|
call append(s:line+3," * Outputs: ")
|
||||||
|
call append(s:line+4," */")
|
||||||
|
unlet s:line
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
imap <F4> <Esc>mz:execute FunctionHeading()
`zjA
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Long line indicator for vim
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
"
|
||||||
|
" This plugin marks the characters which exceed the 80 character line
|
||||||
|
" limitation
|
||||||
|
"
|
||||||
|
" USAGE:
|
||||||
|
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
|
||||||
|
" 'plugin' directory in some other directory that is in your
|
||||||
|
" 'runtimepath'.
|
||||||
|
"
|
||||||
|
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
|
||||||
|
" your ~/.vimrc file (or cut and paste it into your .vimrc).
|
||||||
|
"
|
||||||
|
" NOTE:
|
||||||
|
" This file will highlight all characters from column 81 onwards
|
||||||
|
"
|
||||||
|
" Nirenjan Krishnan nirenjan@gmail.com 2008/12/16
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
match LineTooLong '\%>80v.\+'
|
||||||
|
highlight LineTooLong cterm=bold ctermbg=red guibg=LightYellow
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Brackets plugin for vim
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
"
|
||||||
|
" This plugin inserts corresponding closing braces when the user enters an
|
||||||
|
" opening brace in insert mode.
|
||||||
|
"
|
||||||
|
" USAGE:
|
||||||
|
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
|
||||||
|
" 'plugin' directory in some other directory that is in your
|
||||||
|
" 'runtimepath'.
|
||||||
|
"
|
||||||
|
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
|
||||||
|
" your ~/.vimrc file (or cut and paste it into your .vimrc).
|
||||||
|
"
|
||||||
|
" NOTE:
|
||||||
|
" On pressing { in insert mode, this plugin will insert a corresponding closing
|
||||||
|
" } and will also move the cursor up and indent one level.
|
||||||
|
" On pressing ( or [, this plugin will insert the corresponding closing ) or ]
|
||||||
|
" and will place the cursor on the closing ) or ] in insert mode.
|
||||||
|
"
|
||||||
|
" Nirenjan Krishnan nirenjan@gmail.com 2008/12/16
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" Braces {}
|
||||||
|
" Typing { in insert mode will automatically render as
|
||||||
|
" <whatever text came before>{
|
||||||
|
" <cursor placed here>
|
||||||
|
" }
|
||||||
|
imap { {<CR>}<ESC>O<TAB>
|
||||||
|
|
||||||
|
" Parantheses ()
|
||||||
|
" Typing ( in insert mode will automatically insert a closing
|
||||||
|
" paranthesis as well and place the cursor on the closing paranthesis
|
||||||
|
" in insert mode.
|
||||||
|
imap ( ()<ESC>i
|
||||||
|
|
||||||
|
" Brackets []
|
||||||
|
" Typing [ in insert mode will automatically insert a closing
|
||||||
|
" bracket as well and place the cursor on the closing bracket
|
||||||
|
" in insert mode.
|
||||||
|
imap [ []<ESC>i
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Multiline comment plugin for vim
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
"
|
||||||
|
" This plugin inserts a multiline comment as specified below:
|
||||||
|
" /*
|
||||||
|
" *
|
||||||
|
" */
|
||||||
|
"
|
||||||
|
" USAGE:
|
||||||
|
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
|
||||||
|
" 'plugin' directory in some other directory that is in your
|
||||||
|
" 'runtimepath'.
|
||||||
|
"
|
||||||
|
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
|
||||||
|
" your ~/.vimrc file (or cut and paste it into your .vimrc).
|
||||||
|
"
|
||||||
|
" NOTE:
|
||||||
|
" On pressing <F5> in insert mode, this plugin will insert a multiline
|
||||||
|
" comment and place the cursor on the line to type the comment.
|
||||||
|
"
|
||||||
|
" Nirenjan Krishnan nirenjan@gmail.com 2010/09/15
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" Insert multiline comment
|
||||||
|
function MultiLineComment()
|
||||||
|
let s:line=line(".")
|
||||||
|
call setline(s:line ,"/*")
|
||||||
|
call append(s:line ," * ")
|
||||||
|
call append(s:line+1," */")
|
||||||
|
unlet s:line
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
imap <F5> <Esc>mz:execute MultiLineComment()
`zjA
|
||||||
|
|
Loading…
Reference in New Issue