noremap <F6> <ESC>:vimgrep /\C\(TODO\\|FIXME\\|XXX\\|BUG\)/ ./**/*.c<CR>:copen<CR>:cc<CR><CR>
Показаны сообщения с ярлыком Vim. Показать все сообщения
Показаны сообщения с ярлыком Vim. Показать все сообщения
пятница, 13 июня 2014 г.
TODO, FIXME, etc in Vim
Add this to .vimrc:
воскресенье, 25 августа 2013 г.
Portable Vim (from portableapps.com) and Tools
If you use portable Vim/GVim as PortableApps.com package and want to use external tools (ctags, uncrustify, astyle, global/gtags, so on) you can setup your paths (to tools executable files) based on $HOME variable. For example lets set folder of all tools:
I usually create there - in settings/ - "tools" directory and make there "ctags", "astyle" and other folders with my external tools binaries, config files, etc...
Now you can make something like:
let TOOLSDIR=$HOME . "/vimfiles/tools"because HOME is setted in gVimPortable/App/AppInfo/Launcher/gVimPortable.ini:
[Environment] VIM=%PAL:AppDir%\vim VIMRUNTIME=%PAL:AppDir%\vim\vim74 HOME=%PAL:DataDir%\settings LANG=%PAL:LanguageCustom%Also you can add there any other environment variables to use them in vim config file.
I usually create there - in settings/ - "tools" directory and make there "ctags", "astyle" and other folders with my external tools binaries, config files, etc...
Now you can make something like:
" Beautifiers. exec ':cabbr astyle ' . TOOLSDIR . '/astyle/astyle.exe --options=' . TOOLSDIR . '/astyle/.astylerc' exec ':cabbr uncr ' . TOOLSDIR . '/uncrustify/uncrustify.exe -q -c ' . TOOLSDIR . '/uncrustify/uncrustify.cfg'for your beautifiers. Select code fragment (or all text in file) and type :!astyle for example, to see how it works.
пятница, 5 апреля 2013 г.
My modified version of local vim rc script (auto loading of local rc file from up or current folder):
function SetLocalOptions()
let dirname = getcwd()
let predirname = dirname
while 1
let lvimrc = dirname . "/.lvimrc"
if filereadable(lvimrc)
execute "source " . lvimrc
break
endif
let dirname = fnamemodify(dirname, ":p:h:h")
if dirname == predirname
break
else
let predirname = dirname
endif
endwhile
endfunction
au BufNewFile,BufRead * call SetLocalOptions()
понедельник, 17 декабря 2012 г.
Tags generation for ASF project
If you use Atmel Software Framework you can generate tags (with ctags|GNU Global) for your Vim/Emacs environment in such way (in Makefile):
ctags = c:/Program Files/ctags.exe gtags = c:/global/bin/gtags.exe sed = c:/MinGW/msys/1.0/bin/sed.exe find = c:/MinGW/msys/1.0/bin/find.exe GTAGS_FILES = GTAGS GPATH GRTAGS # Global can not parse out of c:/prj/PRJ1/src TAGS_DIRS = 'c:/Program Files/Atmel/Atmel Studio 6.0/extensions/Atmel/AVRGCC/3.3.2.31/AVRToolchain/avr32/include' \ c:/prj/PRJ1/src/asf-3.0.1 \ c:/prj/PRJ1/src/PRJ1 tags.files: force $(find) $(TAGS_DIRS) -type f -name *.S -or -name *.h -or -name *.c|$(sed) 's/c:\/prj\/PRJ1\/src/./g' >tags.files $(GTAGS_FILES): tags.files $(gtags) -f tags.files .PHONY: global_tags global_tags: $(GTAGS_FILES) tags: tags.files $(ctags) -L tags.files .PHONY: all_tags all_tags: tags global_tags .PHONY: clean_tags clean_tags: rm -f $(GTAGS_FILES) tagsI suppose in this example you use Windows, have MinGW (with find, sed utils). Project is located in c:\prj and has name PRJ1. To generate use targets: tags, global_tags or all_tags. tags file will be about 100 MB, Global tags files will be about 70 MB, but Global can not parse files out of source tree, so avr32/include will be missed - use ctags instead of.
вторник, 10 июля 2012 г.
VIM: aliases vim command on Windows
Considering, we have folder with Makefile, other useful files (tags file, some bat files and so on) and deep-deep folders with sources. We are working with make/gmake in top folder but need to change directory to another deep-deep folders to make something there, for example, run vim... ^)
To do it, I use script:
Save this script as cli.bat, run it and call in terminal:
@echo off PATH = C:\Program Files\Atmel\Atmel Studio 6.0\avrdbg;C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.3.2.31\AVRToolchain\bin;C:\papps\PortableApps\MinGWPortable\App\MinGW\msys\1.0\bin;%PATH% start /D %CD%\deep\deep\src /B cmd.exe doskey myvim=c:\Vim\vim73\gvim.exe -c ":set tags=../../../tags" $*You can see there set of PATH variable for new terminal, aliasing new command myvim with autoset tags file. You can also setup individual _vimrc (per project:), if you need.
Save this script as cli.bat, run it and call in terminal:
myvim some_src.cNo more long paths and pushd/popd/cd! :)
понедельник, 30 мая 2011 г.
Skeleton files for VIM
Very simple script for auto-create of file content by it's extension:
For example, I have in vimfiles/skel/dot.h:
and after creation of some.h I call :Skel and get:
" Use :Skel to apply skeleton (template) to empty new file (skeleton is " dot-file from vimfiles/skel/dot.function _Skel() " for any files norm 1G0 let ext = expand('%:e') let dotfile = $VIM . '/vimfiles/skel/dot.' . ext exec 'r ' . dotfile norm 1Gdd endfunction function HSkel() " for .h files call _Skel() let HGUARG = toupper(expand('%:t:r')) exec 'silent %s/%FILE%/' . HGUARG . '/g' norm G- endfunction function Skel() let ext = expand('%:e') if ext == 'h' call HSkel() elseif ext == 'w' call _Skel() endif endfunction command! -buffer Skel :call Skel()
For example, I have in vimfiles/skel/dot.h:
/* * $Id$ */ #ifndef _%FILE%_H #define _%FILE%_H #endif /* !_%FILE%_H*/
and after creation of some.h I call :Skel and get:
/* * $Id$ */ #ifndef _SOME_H #define _SOME_H #endif /* !_SOME_H*/
Подписаться на:
Сообщения (Atom)