" .vimrc " 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#begin(expand('~/.vim/bundle/')) endif " plugins if !exists('g:vscode') NeoBundle 'januswel/jwlib.vim' NeoBundle 'januswel/binedit.vim' NeoBundle 'januswel/fencdefault.vim' NeoBundle 'januswel/protect.vim' NeoBundle 'januswel/setscroll.vim' NeoBundle 'januswel/smrtcmpl.vim' NeoBundle 'januswel/sweepbuf.vim' NeoBundle 'januswel/tabshift.vim' NeoBundle 'januswel/visualiz.vim' NeoBundle 'januswel/zoomfont.vim' NeoBundle 'januswel/autotmpl.vim' NeoBundle 'januswel/count.vim' NeoBundle 'januswel/expand.vim' NeoBundle 'januswel/filer.vim' NeoBundle 'januswel/profile.vim' NeoBundle 'januswel/sendbrowser.vim' NeoBundle 'januswel/uniconv.vim' NeoBundle 'januswel/rlhelp.vim' NeoBundle 'w0rp/ale' NeoBundle 'junegunn/vader.vim' NeoBundle 'tpope/vim-fugitive' " filetype settings NeoBundle 'januswel/html5.vim' NeoBundle 'januswel/powershell.vim' NeoBundle 'januswel/go.vim' NeoBundle 'januswel/prettier.vim' NeoBundle 'januswel/sql.vim' NeoBundle 'cespare/vim-toml' NeoBundle 'editorconfig/editorconfig-vim' NeoBundle 'isRuslan/vim-es6' NeoBundle 'posva/vim-vue' NeoBundle 'januswel/plantuml-syntax', 'add-command-to-preview' NeoBundle 'rust-lang/rust.vim' NeoBundle 'Shougo/vimproc.vim', { \ 'build' : { \ 'windows' : 'tools\\update-dll-mingw', \ 'cygwin' : 'make -f make_cygwin.mak', \ 'mac' : 'make -f make_mac.mak', \ 'linux' : 'make', \ 'unix' : 'gmake', \ }, \ } NeoBundle 'Quramy/tsuquyomi' NeoBundle 'leafgarland/typescript-vim' NeoBundle 'lepture/vim-velocity' call neobundle#end() endif " options {{{1 " general {{{2 " viminfo set viminfo+=% " save and restore the buffer list " path setting set path^=~/bin/ " prepend my bin to 'path' " disable bell set belloff=all " 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 " set 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 " undo {{{2 if has('persistent_undo') " The directories that are named as "undo" and found in runtime-paths are " set in 'undodir'. let s:candidates = split(globpath(&runtimepath, 'undo'), '\n') let s:undodirs = [] let s:candidate = '' for s:candidate in s:candidates if isdirectory(s:candidate) call add(s:undodirs, s:candidate) endif endfor let s:undodir = join(s:undodirs, ',') if s:undodir != '' let &undodir = s:undodir . ',' . &undodir endif unlet s:candidates s:undodirs s:candidate s:undodir endif " 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 " show status line always set laststatus=2 " 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 set 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 breaks, start of insert set backspace=indent,eol,start " and affect also hexadecimal number and single alphabet set nrformats=hex,alpha " use IM if has('xim') || has('multi_byte_ime') || has('global-ime') set noimdisable endif " ignore CJK characters when spell checking set spelllang=cjk,en " 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 set by plugin "jaencs.vim" if has('win32') if has('gui_running') let &termencoding = &encoding set encoding=utf-8 else set encoding=cp932 endif endif " language and encoding of menu if has('menu') && has('multi_lang') set langmenu=ja.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 " for East Asian Width Class Ambiguous if !exists('g:vscode') if exists('&ambiwidth') set ambiwidth=double endif endif " clipboard is used as unnamed register if has('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 if has('mac') set migemodict=$VIMRUNTIME/dict/migemo-dict endif 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' " 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 " plugin {{{2 let g:ale_sign_column_always = 1 " ftplugin {{{2 let g:rustfmt_autosave = 1 let g:rustfmt_command = '$HOME/.cargo/bin/rustfmt' " 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! "%" " show buffer list nnoremap b :buffers " yank all lines of the buffer nnoremap y :%yank " 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 nmap , nmap ; vmap , vmap ; " window & tabpage {{{2 " move cursor among windows, to next one and to previous one nnoremap :wincmd w nnoremap :wincmd W " :tabnew is hard to complete nnoremap t :tabnew " open the buffer in a new tab page from the buffer list nnoremap :tab sbuffer " shows list if there are more than one candidates, when jump over tags nnoremap g] " 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 inoremap gUiw`]a " to camel case inoremap bgUllgue`]a " camelCase to kebabu-case vnoremap cck :s/\<\@!\([A-Z]\)/-\l\1/g:nohlsearch " kebabu-case to camelCase vnoremap ckc :s/-\([a-z]\)/\u\1/g:nohlsearch " camelCase to SNAKE_CASE vnoremap ccs :s/\<\@!\([A-Z]\)/_\1/g:nohlsearchgUiw " SNAKE_CASE to camelCase vnoremap csc gugv:s/_\([a-z]\)/\U\1/g:nohlsearch " 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`` " U+002A ASTERISK 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|` " U+003A COLON 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 :SweepBuffers:buffers " expandvar.vim nmap e ExpandExpression nmap EvalExpression nmap c GenerateCtags " zoomfont.vim nmap + ZoomIn nmap - ZoomOut nmap & ZoomReset " 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 tags autocmd! autocmd BufNewFile,BufRead *.h,*.hpp,*.c,*.cpp set tags+=~/tags augroup END augroup TypeScript autocmd FileType typescript nmap t : \ echo tsuquyomi#hint() augroup END " }}}1 " vim: ts=4 sw=4 sts=0 et fdm=marker fdc=3