" .vimrc " Maintainer: janus_wel " basic options {{{1 set nocompatible " compatible mode off " NeoBundle {{{1 filetype off filetype plugin indent off if has('vim_starting') set runtimepath+=~/.vim/bundle/neobundle.vim/ set runtimepath+=~/vimfiles/bundle/neobundle.vim/ call neobundle#rc(expand('~/.vim/bundle/')) endif NeoBundle 'Shougo/unite.vim' NeoBundle 'mattn/zencoding-vim' NeoBundle 'januswel/jwlib' NeoBundle 'januswel/autotmpl.vim' NeoBundle 'januswel/html5.vim' " options {{{1 " general {{{2 " viminfo set viminfo+=% " save and restore the buffer list " path setting set path^=~/bin/ " prepend my bin to 'path' " timing to write set noautowrite " disable writing files automatically set noautowriteall " make my wish to vim thoroughly " wait till input is determined set notimeout " don't make me hurry set nottimeout " once agein, don't " backup {{{2 " The directories that are named as "backup" and found in runtime-paths are " setted in 'backupdir'. let s:candidates = split(globpath(&runtimepath, 'backup'), '\n') let s:backupdirs = [] let s:candidate = '' for s:candidate in s:candidates if isdirectory(s:candidate) call add(s:backupdirs, s:candidate) endif endfor " Backup feature is enabled when there are one or more directories that suit " above conditions exist. let s:backupdir = join(s:backupdirs, ',') if s:backupdir != '' set backup " backup feature on set writebackup " make a backup file before overwriting a file set backupcopy=auto " how backup files are created, best one set backupext=~ " trailing character of backup file let &backupdir = s:backupdir . ',' . &backupdir endif unlet s:candidates s:backupdirs s:candidate s:backupdir " display & information {{{2 set showtabline=2 " show tab bar always set number " show line numbers set noruler " don't show row and column number of cursor set title " display editing file name at title bar set laststatus=2 " show status line always set showmode " show mode name set cmdheight=1 " height of command-line is 1 row set showmatch " show pair parentheses, brackets and so on set scrolloff=3 " above and below cursor number is 3 line set showcmd " show entered and partial command set nolist " don't show space characters (tab, line break) set confirm " confirm me before quitting modified buffers " statusline {{{2 " %3(%m%) : modified flag (bracketed, fixed) " %< : where to truncate line " %3n : buffer number (3 digit) " %t : filename (only leaf) " %y : filetype (bracketed) " %{&fenc!=#""?&fenc:&enc} : fileencoding " %{&ff} : fileformat " %r : read only flag (bracketed) " %= : spliter left between right " %{tabpagenr()} : current tabnumber " %{tabpagenr("$")} : tabpage count " %v : virtual column " %l : line number " %L : lines count " %{strtrans(matchstr(getline("."),".",col(".")-1))} : chars under the cursor " 0x%04B : hexadecimal octets " %3P : percentage through file of displayed window let s:statusline = [ \ '%3(%m%) %<%3n %t %y', \ '[%{&fenc!=#""?&fenc:&enc}:%{&ff}]', \ '%r', \ '%=', \ '[%{tabpagenr()}/%{tabpagenr("$")}]', \ '[%v:%l/%L]', \ '[%2(%{strtrans(matchstr(getline("."),".",col(".")-1))}%)', \ ' 0x%04B]', \ '[%3P]', \ ] let &statusline = join(s:statusline, '') unlet s:statusline " tabline {{{2 let &tabline = '%!jwlib#tabline#NoMouseTabLine(' \ . '"jwlib#tabline#ExtAndFileTypeTabLabel"' \ . ')' " tab, space and indent {{{2 set tabstop=4 " tab width set shiftwidth=4 " number of spaces inserted by cindent, <<, >> and so on " number of spaces inserted by or deleted by (enterd by user) set softtabstop=0 " when this is setted to 0, use content of 'tabstop' set expandtab " expand tab to spaces set autoindent " auto indent on " search {{{2 set incsearch " incremental search on set hlsearch " highlight matched word set ignorecase " use ignore case normally set smartcase " but use match case when capital character is contained set wrapscan " search wrap around the end of the file " diff {{{2 set diffopt=filler,context:5 " show filler lines " and use a context of 5 lines " window {{{2 set splitbelow " make a new window at the below of the current window set splitright " make a new window at the right of the current window set helpheight=0 " a height of help window is half of the current window " editing {{{2 " allow backspacing over autoindent, line breakes, start of insert set backspace=indent,eol,start " and affect also hexadecimal number and single alphabet set nrformats=hex,alpha " completion {{{2 " command-line mode set wildmenu " command-line completion on set wildmode=list:longest " list all candidates and complete longest matched " insert mode " scanning places (and order) by keyword completion " . : current buffer " w : buffers from other windows " b : other loaded buffers " t : tab completion " i : current and included files set complete=.,w,b,t,i " options " menu : use a popup menu " menuone : use a popup menu also when only one match " preview : show extra information in the preview window set completeopt=menu,menuone,preview " encoding & format {{{2 " 'fileencodings' is setted by plugin "jaencs.vim" if has('win32') if has('gui') set encoding=utf-8 else set encoding=cp932 endif else set encoding=utf-8 endif " end-of-line format " candidates of EOL format for exist files " first one is used as new file's EOL format set fileformats=unix,dos " platform specific {{{2 " clipboard is used as unnamed register if has('gui') || has('xterm_clipboard') set clipboard=unnamed endif " :hardcopy if has('printer') set printoptions=number:y set printheader=%<%t%=page\ %N if has('win32') set printfont=VL_Gothic:h12:cSHIFTJIS endif endif " C/Migemo " this settings influence only Kaoriya version if has('migemo') set migemo set migemodict=$VIM/dict/utf-8.d/migemo-dict endif " filetype {{{1 filetype on " filetype detection on filetype plugin on " for omni completion filetype indent on " each filetype indent on " syntax highlight {{{1 syntax enable " use syntax highlight " color scheme: Janus.vim colorscheme Janus " my color scheme " let {{{1 " general {{{2 " , let mapleader = ',' let maplocalleader = ';' " plugin: autodate.vim " date format to insert automatically let autodate_format = '%Y %3m %d' " plugin: protec.vim " runtime file is untouchable let protec_readonly_paths = '$VIM/**,$INCLUDE/**' let protec_nomodifiable_paths = '$VIM/**,$INCLUDE/**' " for :TOhtml let g:html_font = 'VL Gothic' "let g:html_ignore_folding = 1 let g:html_no_pre = 1 let g:html_number_lines = 1 let g:html_use_css = 1 let g:html_use_encoding = &encoding let g:use_xhtml = 1 " disable plugin {{{2 " settings for Kaoriya version if has('kaoriya') let plugin_cmdex_disable = 1 let plugin_dicwin_disable = 1 let plugin_format_disable = 1 let plugin_hz_ja_disable = 1 let plugin_scrnmode_disable = 1 let plugin_verifyenc_disable = 1 " don't source gvimrc_example.vim in $VIM " see $VIM/gvimrc let no_gvimrc_example = 1 endif " platform specific {{{2 if has('win32') " in Windows, processing tar, gzip and zip with vim is non-sense... let loaded_gzip = 1 let loaded_tarPlugin = 1 let loaded_zipPlugin = 1 else " setting for bash (:help sh.vim) let is_bash = 1 endif " mappings {{{1 " general {{{2 " make nnoremap m :update:make! "%" " source nnoremap :source ~/.vimrc:source ~/.gvimrc " jump to the tag under the cursor nnoremap p :execute ':ptag ' . expand('') " toggle 'paste' nnoremap :setlocal paste!:setlocal paste? " show buffer list nnoremap b :buffers " yank all lines of the buffer nnoremap y :%yank " to write commit messages of tortoisegit nnoremap gc :setlocal bt=nofile ft=gitcommit spell " generate tags for help if has('win32') nnoremap gh :helptags ~/vimfiles/doc else nnoremap gh :helptags ~/.vim/doc endif " toggle spell check if has('spell') && has('syntax') nnoremap s :setlocal spell!:setlocal spell? endif " cursor {{{2 " move cursor as it looks nnoremap j gj nnoremap k gk nnoremap 0 g0 nnoremap ^ g^ nnoremap $ g$ vnoremap j gj vnoremap k gk vnoremap 0 g0 vnoremap ^ g^ vnoremap $ g$ " disable "," and ";" to use as mapleader and maplocalleader nnoremap , nnoremap ; vnoremap , vnoremap ; " window & tabpage {{{2 " move cursor among windows, to next one and to previous one nnoremap :wincmd w nnoremap :wincmd W " move the window to a new tab page nnoremap w :wincmd T " adjust heights and widths of all visible windows equally nnoremap = :wincmd = " open the result of looking up a keyword under the cursor in new tabpage nnoremap K:wincmd T " :tabnew is hard to complete nnoremap t :tabnew " open the buffer in a new tab page from the buffer list nnoremap :tab sbuffer " open the tag under the cursor in a new tabpage nnoremap :tab wincmd ] " switch between tabpages nnoremap gT nnoremap gt " move a tabpage around " plugin: TabShift.vim nnoremap :TabShift! -1 nnoremap :TabShift! +1 " searches {{{2 " put matched word in the top of the screen " "zv" indicates to open fold " "zt" indicates to redraw screen with the cursor line as the top of the screen nnoremap n nzvzt nnoremap N Nzvzt nnoremap * *zvzt nnoremap # #zvzt nnoremap g* g*zvzt nnoremap g# g#zvzt " stop the highlighting matched texts nnoremap h :nohlsearch " clear search pattern nnoremap :let @/='' " matches {{{2 " clear match pattern nnoremap :match " show CHARACTER TABULATION nnoremap t :match Error /\t/ " editing {{{2 " line break, mnemonic: "S"plit nnoremap i " to upper case nnoremap g gU inoremap gUiw`]a " to lower case nnoremap gl gu " to camel case inoremap bgUllgue`]a " tuck it " U+0020 SPACE vnoremap `>a ` " U+0027 APOSTROPHE and U+0022 QUOTATION MARK vnoremap ' `>a'` vnoremap " `>a"` " U+0060 GRAVE ACCENT vnoremap ` `>a`` " parentheses, curly, square and angle brackets vnoremap ( `>a)` vnoremap { `>a}` vnoremap [ `>a]` vnoremap < `>a>` " U+0025 PERCENT SIGN vnoremap % `>a%` " U+005F LOW LINE vnoremap _ `>a_` " U+007C VERTICAL LINE " see :help map_bar vnoremap | `>a|` " entity references, less and greater than sign vnoremap a `>a>``[ " xhtml inline tags vnoremap k `>a/kbd>`kbd>`[ vnoremap c `>a/code>`code>`[ vnoremap d `>a/del>`del>`[ vnoremap i `>a/ins>`ins>`[ vnoremap q `>a/q>`q>`[ " U+FF5E FULLWIDTH TILDE vnoremap w `>a uff5e`uff5e `[ " U+300C LEFT CORNER BRACKET and U+300D RIGHT CORNER BRACKET vnoremap b `>au300d`u300c`[ " C style comment vnoremap `>a*/` " completion {{{2 inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" " path operation {{{2 " show current directory nnoremap d :pwd " change directory to one that has the editing file nnoremap :lcd %:p:h:pwd " change directory to the upper one nnoremap u :lcd ../:pwd " plugin {{{2 " sweepbuflist.vim nmap SweepBufList|:buffers " expandvar.vim nmap e ExpandVariable nmap EvalExpression nmap c GenerateCtags " openwin32explorer.vim and viewinhtml.vim if has('win32') nmap f WinExplorer nmap ViewInHtml endif " abbreviation {{{1 " fix typo abbreviate retrun return abbreviate cosnt const abbreviate scirpt script abbreviate cludge kludge abbreviate hlep help abbreviate parcent percent abbreviate persent percent abbreviate parsent percent abbreviate tilda tilde abbreviate appropreate appropriate abbreviate acknowledgement acknowledgment " script {{{1 augroup numof_scroll autocmd! numof_scroll autocmd! WinEnter * set scroll=3 augroup END " }}}1 " vim: ts=4 sw=4 sts=0 et fdm=marker fdc=3