mollifier's watching list
-
[1879] AutoComplPop
特に意識しなくても勝手に補完されるのが楽でよい
-
[1325] bufferlist.vim
バッファ管理系の中では一番シンプルで使いやすい
-
[13] closetag.vim
タグを閉じてくれるだけだが、それだけでかなり楽になる
-
[2367] darkbone.vim
-
[1243] desert256.vim
-
[1861] errormarker.vim
-
[1984] FuzzyFinder
-
[2436] fuzzyjump.vim
面白そう
-
[21] info.vim
-
[1491] JavaScript syntax
-
[3252] L9
fuzzyfinderで必要になるライブラリ
-
[39] matchit.zip
閉じ忘れのチェックに使う。bashにも対応しているのが良い
-
[2620] neocomplcache
-
[1936] OOP javascript indentation
-
[2470] smartword
w とかの移動量がちょうど良くなる
-
[1697] surround.vim
-
[978] svn-diff.vim
-
[1937] Syntax for XUL
-
[1658] The NERD tree
1つのプロジェクトでたくさんのファイルを扱うときに便利
-
[1234] YankRing.vim
勝手に改行が入ったりして、微妙に使いにくい
Profile
.vimrc
" vimrc
" Remove ALL autocommands for the current group.
autocmd!
" Basic "{{{1
language C
set nocompatible
set number
set showmode
set showcmd
set wildmode=list:longest,full
set backspace=0 "same as vi
set textwidth=0 "don't breake line however long it is
set nrformats-=octal "don't use octal number
set history=50
let g:netrw_alto=1
set completeopt=menuone,preview
set modeline
set modelines=5
set showmatch "jump to the matching bracket
set matchtime=1 "1/10sec time scale
set matchpairs+=<:>
let loaded_matchparen = 1
set virtualedit+=block " Allow virtual editing in Visual block mode.
set nolist "show non-printing character
set listchars=tab:>\
set tags+=./tags;
if has('unix')
set nofsync
set swapsync=
endif
" Autocmd "{{{1
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
" Highlight the cursorline in insert mode
augroup InsertHook
autocmd!
autocmd InsertEnter * setlocal cursorline
autocmd InsertLeave * setlocal nocursorline
augroup END
" Utilities "{{{1
"invert scroll bind for all windows
function! InvertScrollBindAll()
if &scrollbind
windo set noscrollbind
echo "disable scrollbind"
else
windo set scrollbind
echo "enable scrollbind"
endif
endfunction
"invert number and list options
function! InvertList()
if &number || &list
setlocal nonumber
setlocal nolist
setlocal foldcolumn=0
else
setlocal number
setlocal list
setlocal foldcolumn=3
endif
endfunction
"code conversion functions
function! ToUtf8()
setlocal fileencoding=utf-8
setlocal fileformat=unix
endfunction
function! ToShiftJis()
setlocal fileencoding=cp932
setlocal fileformat=dos
endfunction
function! ToEucJp()
setlocal fileencoding=euc-jp
setlocal fileformat=unix
endfunction
"convert into HTML entity reference
function! ConvertToHTMLEntityRef()
let s:line = getline(".")
let s:repl = substitute(s:line, '&', '\&', "g")
let s:repl = substitute(s:repl, '<', '\<', "g")
let s:repl = substitute(s:repl, '>', '\>', "g")
let s:repl = substitute(s:repl, '"', '\"', "g")
call setline(".", s:repl)
endfunction
function! Presentation()
set laststatus=0 " never show statusline
set nonumber
set nolist
set foldcolumn=0
endfunction
function! Navi() "{{{
if &ft ==? "c" || &ft ==? "cpp"
vimgrep /^[^ \t#/\\*]\+[0-9A-Za-z_ :\t\\*]\+([^;]*$/j %
elseif &ft ==? "perl"
vimgrep /^\s*sub\s/j %
elseif &ft ==? "ruby"
vimgrep /^\s*\(class\|module\|def\|alias\)\s/j %
elseif &ft ==? "python"
vimgrep /^\s*\(class\|def\)\s/j %
elseif &ft ==? "javascript"
vimgrep /^\s*function\s\|[a-zA-Z_$][a-zA-Z0-9_$]*\s*[=:]\s*function\s*(/j %
elseif &ft ==? "sh"
vimgrep /^\s*\(\h\w*\s*()\|function\s\+\h\w*\)/j %
elseif &ft ==? "html"
vimgrep /\c^\s*\(<h[1-6]\|<head\|<body\|<form\)/j %
elseif &ft ==? ""
"Text ( 1. 2. ,etc )
vimgrep /^\s*\d\+\./j %
elseif &ft ==? "java"
vimgrep /^\s*[^#/\*=]\+[0-9a-zA-Z_ \t\*,.()]\+{[^;]*$/j %
elseif &ft ==? "diff"
"diff (unified format)
vimgrep /^@@[0-9 \t,+-]\+@@$/j %
else
echo "This filetype is not supported."
endif
cw
endfunction "}}}
" Statusline "{{{1
set laststatus=2 "always show statusline
let &statusline = ' %f %m %r%{&foldenable!=0?"[fen]":""}%=%l/%L (%p%%) %{"[".(&fenc!=""?&fenc:&enc)."][".&ff."]"}'
" Indent "{{{1
set tabstop=2
set shiftwidth=2
set softtabstop=0
set expandtab
set autoindent
filetype plugin indent on
" Backup "{{{1
set backup
set backupcopy=yes
set backupdir=$HOME/.backup/vi,.
" Search "{{{1
set hlsearch
set incsearch
"search highlighted word in visual mode
vnoremap * y/<C-R>0<CR>
vnoremap # y?<C-R>0<CR>
"clear hlsearch
nnoremap <SPACE>c :<C-u>nohlsearch<CR>
" Color "{{{1
" enable 256 colors
set t_Co=256
set background=light
"set background=dark
syntax enable
"syntax off
"Tab
highlight SpecialKey ctermfg=Grey
"End of line
highlight NonText ctermfg=Grey
"Search pattern
highlight Search term=reverse ctermfg=White ctermbg=Blue
" Popup Menu
hi Pmenu cterm=NONE ctermfg=Black ctermbg=White
hi PmenuSel cterm=underline,bold ctermfg=White ctermbg=DarkBlue
hi PmenuSbar term=NONE cterm=NONE
hi PmenuThumb term=reverse cterm=reverse
" show invisible characters "{{{2
if has('autocmd') && has('syntax')
syntax on
function! ShowInvisibleCharacters()
" double width space
syntax match DoubleWidthSpace "\%u3000" display containedin=ALL
" trailing whitespace characters
syntax match TrailingWhitespace "\s\+$" display containedin=ALL
" these are performed as error
highlight default link DoubleWidthSpace Error
highlight default link TrailingWhitespace Error
endfunction
augroup showInvisible
autocmd! showInvisible
autocmd BufNew,BufRead * call ShowInvisibleCharacters()
augroup END
endif
" Character and linefeed code "{{{1
"auto recognition (from zun wiki)
"linefeed code
set fileformats=unix,dos,mac
if exists('&ambiwidth')
set ambiwidth=double
endif
"character code
if &encoding !=# 'utf-8'
set encoding=japan
set fileencoding=japan
endif
if has('iconv') "{{{
let s:enc_euc = 'euc-jp'
let s:enc_jis = 'iso-2022-jp'
if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb"
" iconv support eucJP-ms
let s:enc_euc = 'eucjp-ms'
let s:enc_jis = 'iso-2022-jp-3'
elseif iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb"
" iconv suppot JISX0213
let s:enc_euc = 'euc-jisx0213'
let s:enc_jis = 'iso-2022-jp-3'
endif
" set fileencodings
if &encoding ==# 'utf-8'
let s:fileencodings_default = &fileencodings
let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932'
let &fileencodings = &fileencodings .','. s:fileencodings_default
unlet s:fileencodings_default
else
let &fileencodings = &fileencodings .','. s:enc_jis
set fileencodings+=utf-8,ucs-2le,ucs-2
if &encoding =~# '^\(euc-jp\|euc-jisx0213\|eucjp-ms\)$'
set fileencodings+=cp932
set fileencodings-=euc-jp
set fileencodings-=euc-jisx0213
set fileencodings-=eucjp-ms
let &encoding = s:enc_euc
let &fileencoding = s:enc_euc
else
let &fileencodings = &fileencodings .','. s:enc_euc
endif
endif
" unlet variables
unlet s:enc_euc
unlet s:enc_jis
endif "}}}
if has('autocmd')
function! AU_ReCheck_FENC()
if &fileencoding =~# 'iso-2022-jp' && search("[^\x01-\x7e]", 'n') == 0
let &fileencoding=&encoding
endif
endfunction
autocmd BufReadPost * call AU_ReCheck_FENC()
endif
" Filetype "{{{1
"sh
let is_bash=1
"zip
"see also :help zip-extension
au BufReadCmd *.jar,*.xpi call zip#Browse(expand("<amatch>"))
" Fold "{{{1
set foldmethod=expr
set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1
set nofoldenable
set foldcolumn=3
" Map "{{{1
"no effect keys
map s <Nop>
map <SPACE> <Nop>
"make CTRL-K an additional ESC
noremap <C-K> <ESC>
cnoremap <C-K> <C-C>
inoremap <C-K> <ESC>
noremap Y y$
noremap gh ^
noremap gl $
noremap S gJ
"define tcsh style editing keys
cnoremap <C-A> <Home>
cnoremap <C-F> <Right>
cnoremap <C-B> <Left>
"edit
onoremap <silent> q /["'{}()[\]<>]<CR>:nohlsearch<CR>
"insert the text which was deleted or yanked last time
inoremap <C-Z> <C-O>:set paste<CR><C-R>"<C-O>:set nopaste<CR>
"end completion and begin new line
inoremap <C-J> <C-E><CR>
"scroll
noremap J <C-D>
noremap K <C-U>
"jump
"exclusive motion
noremap sm `
"buffer operation
nnoremap sp :<C-u>bp<CR>
nnoremap sn :<C-u>bn<CR>
"window operation
"open and close
nnoremap ss <C-W>s
nnoremap sc <C-W>c
nnoremap so <C-W>o
"move
nnoremap sj <C-W>j
nnoremap sk <C-W>k
nnoremap <silent> sh <C-W>h:call <SID>good_width()<CR>
nnoremap <silent> sl <C-W>l:call <SID>good_width()<Cr>
function! s:good_width()
if winwidth(0) < 84
vertical resize 84
endif
endfunction
"resize
nnoremap + <C-W>+
nnoremap - <C-W>-
nnoremap ) <C-W>>
nnoremap ( <C-W><LT>
function! s:big()
wincmd _ | wincmd |
endfunction
nnoremap <silent> s<CR> :<C-u>call <SID>big()<CR>
nnoremap s0 1<C-W>_
nnoremap s. <C-W>=
nnoremap <Space>w :<C-u>update<CR>:<C-u>echo ""<CR>
nnoremap <Space>q :<C-u>qall<CR>
nnoremap <C-h> :<C-u>help<Space>
nnoremap <Space>m :<C-u>make<CR>
"move to next/previous line with same indentation
nnoremap <silent> <SPACE>k k:<C-u>call search ("^". matchstr (getline (line (".")+ 1), '\(\s*\)') ."\\S", 'b')<CR>^
nnoremap <silent> <SPACE>j :<C-u>call search ("^". matchstr (getline (line (".")), '\(\s*\)') ."\\S")<CR>^
"call function
"invert scrollbind
nnoremap sb :<C-u>call InvertScrollBindAll()<CR>
"navi
nnoremap <SPACE>v :<C-u>call Navi()<CR>
nnoremap go :<C-u>copen<CR>
nnoremap gc :<C-u>cclose<CR>
nnoremap <SPACE>n :<C-u>cnext<CR>
nnoremap <SPACE>p :<C-u>cprevious<CR>
"invert number and list options
nnoremap <silent> sv :<C-u>call InvertList()<CR>
" For plugins "{{{1
"NERD_tree
nnoremap sd :<C-u>NERDTreeToggle<CR>
"eregex
nnoremap / :<C-u>M/
nnoremap ,/ /
"closetag.vimg
if filereadable($HOME . '/.vim/scripts/closetag.vim')
au Filetype html,xml,xsl source $HOME/.vim/scripts/closetag.vim
endif
"surround.vim
"see also :help surround-mappings Note
"remove surround mappings in visual mode
vmap <Leader>s <Plug>Vsurround
vmap <Leader>S <Plug>VSurround
"xul.vim (Syntax for XUL)
let xul_noclose_script = 1
"hatena.vim (Syntax for hatena)
let g:hatena_syntax_html = 1
" autocomplpop.vim JavaScript "{{{2
let g:AutoComplPop_Behavior={'javascript' : [
\ {
\ 'command' : "\<C-n>",
\ 'pattern' : '\k\k$',
\ 'excluded' : '^$',
\ 'repeat' : 0,
\ },
\ {
\ 'command' : "\<C-x>\<C-f>",
\ 'pattern' : (has('win32') || has('win64') ? '\f[/\\]\f*$' : '\f[/]\f*$'),
\ 'excluded' : '[*/\\][/\\]\f*$\|[^[:print:]]\f*$',
\ 'repeat' : 1,
\ },
\ {
\ 'command' : "\<C-x>\<C-o>",
\ 'pattern' : '\([^. \t]\.\)$',
\ 'excluded' : '^$',
\ 'repeat' : 0,
\ },
\ ]}
" fuzzyfinder.vim "{{{2
let g:fuf_ignoreCase = 1
let g:fuf_keyOpenVsplit = '<C-v>'
let g:fuf_file_exclude = '\v\.svn/$|\.git/$|\~$|\.o$|\.exe$|\.bak$|\.swp$|\.swo$|((^|[/\\])\.[/\\]$)'
let g:fuf_dir_exclude = '\v\.svn/$|\.git/$|((^|[/\\])\.{1,2}[/\\]$)'
nnoremap <silent> <SPACE>b :<C-u>FufBuffer<CR>
nnoremap <silent> <SPACE>f :<C-u>FufFile<CR>
nnoremap <silent> <SPACE>r :<C-u>FufMruFile<CR>
nnoremap <silent> <SPACE>d :<C-u>FufDir<CR>
nnoremap <silent> <SPACE>A :<C-u>FufAddBookmark<CR>
nnoremap <silent> <SPACE>B :<C-u>FufBookmark<CR>
" neocomplcache "{{{2
" 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
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
imap <C-j> <Plug>(neocomplcache_snippets_expand)
smap <C-j> <Plug>(neocomplcache_snippets_expand)
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
" SuperTab like snippets behavior.
"imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <expr><CR> neocomplcache#smart_close_popup() . (&indentexpr != '' ? "\<C-f>\<CR>X\<BS>":"\<CR>")
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplcache#close_popup()
inoremap <expr><C-e> neocomplcache#cancel_popup()
" AutoComplPop like behavior.
"let g:neocomplcache_enable_auto_select = 1
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
"autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
" quickrun "{{{2
nnoremap <silent> <SPACE>x :QuickRun -mode n<CR>
vnoremap <silent> <SPACE>x :QuickRun -mode v<CR>
" Source local rc file"{{{1
if filereadable($HOME . '/.vimrc_local')
source $HOME/.vimrc_local
elseif filereadable($HOME . '/_vimrc_local')
source $HOME/_vimrc_local
endif
" vim:set ft=vim foldmethod=marker:
