"------------------------------------------------------------------ " Preferences to (g)Vim " José Cláudio Faria " UESC/DCET " 2013/03/30 - 19:50:50 "------------------------------------------------------------------ "------------------------------------------------------------------ " Utilidades e opções gerais "------------------------------------------------------------------ "------------------------------ " Algumas abreviaturas: "------------------------------ iab nao não iab qeu que iab sao são iab tao tão iab vao vão iab çao ção "------------------------------ " Syntax - ativa/desativa "------------------------------ function! ToggleSyntax() if exists("g:syntax_on") syntax off else syntax enable endif endfunction nmap ;y :call ToggleSyntax() "http://drchip.0sites.net/astronaut/vim/index.html "imap ymd =strftime("%Y/%m/%d") "imap mdy =strftime("%m/%d/%y") "imap ndy =strftime("%b %d, %Y") "imap hms =strftime("%T") "imap ynd =strftime("%Y %b %d") imap t =strftime("%Y/%m/%d - %T") "----------------------------------------- " Highlighting that moves with the cursor "----------------------------------------- hi cursorline cterm=NONE term=underline cterm=underline guibg=Grey90 "hi cursorcolumn cterm=NONE term=reverse ctermbg=7 guibg=Grey90 ":nnoremap h :set cursorline! cursorcolumn! :nnoremap h :set cursorline! set cursorline "------------------------------ " Calculadora científica "------------------------------ :command! -nargs=+ Cal :py print :py from math import * "------------------------------ " Status bar "------------------------------ "set laststatus=2 " Always visible "set statusline=%t[%{strlen(&fenc)?&fenc:'none'},%{&ff}]%h%m%r%y%=%c,%l/%L\ %P " My preferences "set statusline=%F%m%r%h%w\ [format:%{&ff}]\ [type:%Y]\ [ascii:\%04.8b]\ [hex:\%04.4B]\ [pos:%04l,%04v][%p%%]\ [len:%L] "------------------------------ " Required by Pathogen "------------------------------ " Needed on some linux distros. filetype off "call pathogen#runtime_append_all_bundles() call pathogen#incubate() call pathogen#helptags() "------------------------------ " General options "------------------------------ " Get out of VI's compatible mode set nocompatible set shiftwidth=2 "Indentation with two spaces for all set nowrap "Do no word wrap "set textwidth=120 " Highlight search "set hlsearch " Toogles (on/off) highlight search map h :set hlsearch! " Replace ESC by jj ":map! jj " When .vimrc is edited, reload it autocmd! bufwritepost .vimrc source % " Bakspace not working? set backspace=2 " Show hide characteres "set list listchars=tab:»·,trail:·,eol:§ " Colors and fonts set guifont=DejaVu\ Sans\ Mono\ 10 " Combinam bem com terminal "colorscheme moria "colorscheme soso " Alternativos "colorscheme imperial "colorscheme morning "colorscheme slate "colorscheme montz " Dark colorscheme jellybeans "(meu preferido) "colorscheme southernlights "(jakson) " Sets how many lines of history VIM har to remember set history=100 " Enable syntax at startup syntax enable " Enable filetype plugin. required for: Latex-Suite, Vim-R-Plugin, ... filetype plugin on filetype indent on " Set to auto read when a file is changed from the outside set autoread " Have the mouse enabled all the time: set mouse=a " Preferências set ai " Auto identation set ve=all " Allows to move the cursor to any place "set nu " Will show line number " Sintax to *.txt au BufNewFile,BufRead *.txt source ~/.vim/bundle/syntax-personal/txt.vim au BufNewFile,BufRead *.tex source ~/.vim/bundle/syntax-personal/tex.vim " Standard configurations GOGS " set nobackup " Do not save backup set wildmode=longest,list " Completion with TAB set ignorecase " Ignore case sensitive when searching filetype plugin indent on " Will detecta type pf file and applies the indentation set smartindent " Auto-indentation set expandtab " Identation with space " Spell option "set spelllang=pt " Insert new line in normal mode. nmap O nmap o " Restore screen size and position " Saves data in a separate file, and so works with multiple instances of Vim. if has("gui_running") function! ScreenFilename() if has('amiga') return "s:.vimsize" elseif has('win32') return $HOME.'\_vimsize' else return $HOME.'/.vimsize' endif endfunction function! ScreenRestore() " - Remembers and restores winposition, columns and lines stored in " a .vimsize file " - Must follow font settings so that columns and lines are accurate " based on font size. if !has("gui_running") return endif if g:screen_size_restore_pos != 1 return endif let vim_instance = (g:screen_size_by_vim_instance==1?(v:servername):'GVIM') " Read any existing variables from .vimsize file silent! execute "sview " . escape(ScreenFilename(),'%#\ $') silent! execute "0/^" . vim_instance . " /" let vim_name = matchstr(getline('.'), '^\w\+') let vim_cols = matchstr(getline('.'), '^\w\+\s\+\zs\d\+') let vim_lines = matchstr(getline('.'), '^\w\+\s\+\d\+\s\+\zs\d\+') let vim_posx = matchstr(getline('.'), '^\w\+\s\+\d\+\s\+\d\+\s\+\zs\d\+') let vim_posy = matchstr(getline('.'), '^\w\+\s\+\d\+\s\+\d\+\s\+\d\+\s\+\zs\d\+') if vim_name == vim_instance execute "set columns=".vim_cols execute "set lines=".vim_lines silent! execute "winpos ".vim_posx." ".vim_posy endif silent! q endfunction function! ScreenSave() " Used on exit to retain window position and size if !has("gui_running") return endif if !g:screen_size_restore_pos return endif let vim_instance = (g:screen_size_by_vim_instance==1?(v:servername):'GVIM') silent! execute "split " . escape(ScreenFilename(),'%#\ $') silent! execute "0/^" . vim_instance . " /" let vim_name = matchstr(getline('.'), '^\w\+') if vim_name == vim_instance delete _ endif $put = vim_instance . ' ' . &columns . ' ' . &lines . ' ' . \ (getwinposx()<0?0:getwinposx()) . ' ' . \ (getwinposy()<0?0:getwinposy()) silent! x! endfunction if !exists('g:screen_size_restore_pos') let g:screen_size_restore_pos = 1 endif if !exists('g:screen_size_by_vim_instance') let g:screen_size_by_vim_instance = 1 endif autocmd VimEnter * call ScreenRestore() autocmd VimLeavePre * call ScreenSave() endif "------------------------------------------------------------------ " LanguageToll "------------------------------------------------------------------ let g:languagetool_jar=$HOME . '/languagetool/LanguageTool.jar' "------------------------------------------------------------------ " Marksbowser plugin "------------------------------------------------------------------ let marksCloseWhenSelected = 0 let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" "------------------------------------------------------------------ " NERDTree plugin "------------------------------------------------------------------ " Give a shortcut key to NERD Tree map :NERDTreeToggle "------------------------------------------------------------------ " Vim-R-plugin options "------------------------------------------------------------------ "let vimrplugin_term = "xfce4-terminal" "let vimrplugin_term = "roxterm" let vimrplugin_term_cmd = "terminator --title R -x" " Remapping key let maplocalleader = ";" map :runtime ftplugin/r.vim " The main R menu will be always visible to all file extension (only gVim) if has("gui_running") inoremap else inoremap endif " Remapeamentos e novos mapeamentos do plugin vmap RDSendSelection vmap e REDSendSelection nmap RDSendLine nmap :call RSendPartOfLine("left", 0) nmap :call RSendPartOfLine("right", 0) nmap :call RClearConsole() map h :call RAction("head") map t :call RAction("tail") map q :call RAction("str") map p :call RAction("dput") map s :call SendCmdToR("search()") map a :call SendCmdToR("ls(a=T)") "imap ( ( " Return the funtion args automatically after '(' let vimrplugin_objbr_w = 23 " OE width "let vimrplugin_r_path = '/usr/lib/Rdevel/lib64/R/bin' " My R flavor to use "let vimrplugin_r_path = '/usr/lib/R/bin' " My R flavor to use let g:vimrplugin_single_r = 1 " All buffers use the same R process let g:vimrplugin_maxdeparse = 100 " R maxdeparse option let vimrplugin_listmethods = 1 " Always list methods of plot "let vimrplugin_never_unmake_menu = 1 " R menu always visible "let vimrplugin_open_df = 1 " Hide details from R explorer -> vimcom "let vimrplugin_open_list = 1 " Hide details from R explorer -> vimcom "let vimrplugin_vimpager = "no" " Open help always in new tab "let vimrplugin_allnames = 1 " Will show all objects let vimrplugin_ca_ck = 1 " Force do clear the prompt of the R console let vimrplugin_vsplit = 1 " Disposition: 0 to vertical and 1 to horizontal let vimrplugin_external_ob = 0 " 0: OB in the editor, 1: OB in the external R console " Indentation let vimrplugin_indent_commented = 0 let r_indent_ess_comments = 0 " Do not create proper tmux configuration file let vimrplugin_notmuxconf = 1 " Position o Object Explorer "let vimrplugin_objbr_place = "script,right" " It is the new default "let vimrplugin_objbr_place = "console,left" "let vimrplugin_vimcom = 1 " Related to vimcom package "let vimrplugin_openpdf_quietly = 1 " Will try to open automatically the pdf let vimrplugin_latexcmd = "latexmk -pdf" let vimrplugin_openhtml = 1 " "------------------------------------------------------------------ " Latex-Box options "------------------------------------------------------------------ imap [[ \begin{ imap ]] LatexCloseCurEnv nmap LatexChangeEnv vmap LatexWrapSelection vmap LatexEnvWrapSelection imap (( \eqref{ "------------------------------------------------------------------ " neocomplcache options "------------------------------------------------------------------ " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3