set nocompatible " ----------------------------------------------------------------------- " Vundle: {{{ " - https://github.com/vim-scripts/vundle " NeoBundle.vim " - https://github.com/Shougo/neobundle.vim " if has('vim_starting') set runtimepath+=~/.vim/bundle/neobundle.vim endif call neobundle#rc(expand('~/.vim/bundle')) " " Unite NeoBundle 'git://github.com/Shougo/neobundle.vim.git' NeoBundle 'git://github.com/Shougo/vimfiler.git' NeoBundle 'git://github.com/Shougo/vimproc.git' NeoBundle 'git://github.com/Shougo/neocomplcache.git' NeoBundle 'git://github.com/Shougo/neocomplcache-snippets-complete.git' NeoBundle 'git://github.com/Shougo/unite.vim.git' NeoBundle 'git://github.com/thinca/vim-qfreplace.git' NeoBundle 'git://github.com/t9md/vim-unite-ack.git' NeoBundle 'git://github.com/h1mesuke/unite-outline.git' NeoBundle 'git://github.com/Shougo/vimshell.git' NeoBundle 'git://github.com/Shougo/unite-ssh.git' NeoBundle 'git://github.com/ujihisa/vimshell-ssh.git' " " Git NeoBundle 'git://github.com/tpope/vim-fugitive.git' NeoBundle 'git://github.com/Shougo/vim-vcs.git' NeoBundle 'git://github.com/thinca/vim-openbuf.git' "NeoBundle 'https://github.com/motemen/git-vim' " " Text NeoBundle 'git://github.com/h1mesuke/vim-alignta.git' NeoBundle 'git://github.com/t9md/vim-textmanip.git' NeoBundle 'git://github.com/thinca/vim-template.git' NeoBundle 'git://github.com/tpope/vim-surround.git' NeoBundle 'git://github.com/tpope/vim-repeat.git' NeoBundle 'git://github.com/kana/vim-textobj-user.git' NeoBundle 'git://github.com/kana/vim-textobj-indent.git' "NeoBundle 'git://github.com/msanders/snipmate.vim.git' " " Display NeoBundle 'git://github.com/nathanaelkane/vim-indent-guides.git' NeoBundle 'git://github.com/Lokaltog/vim-powerline.git' NeoBundle 'git://github.com/Lokaltog/vim-easymotion.git' " " Syntax NeoBundle 'git://github.com/t9md/vim-quickhl.git' NeoBundle 'git://github.com/othree/html5.vim.git' NeoBundle 'git://github.com/cakebaker/scss-syntax.vim.git' NeoBundle 'git://github.com/hail2u/vim-css3-syntax.git' NeoBundle 'git://github.com/hallison/vim-markdown.git' "NeoBundle 'git://github.com/tpope/vim-markdown.git' " " Develop NeoBundle 'git://github.com/sjl/gundo.vim.git' NeoBundle 'git://github.com/thinca/vim-quickrun.git' NeoBundle 'git://github.com/thinca/vim-ref.git' NeoBundle 'git://github.com/scrooloose/syntastic.git' "NeoBundle 'git://github.com/basyura/jslint.vim.git' " " Browser NeoBundle 'git://github.com/yuratomo/w3m.vim.git' NeoBundle 'git://github.com/tsukkee/lingr-vim.git' NeoBundle 'git://github.com/basyura/TweetVim.git' NeoBundle 'git://github.com/basyura/twibill.vim.git' NeoBundle 'git://github.com/tyru/open-browser.vim.git' NeoBundle 'git://github.com/mattn/webapi-vim.git' "NeoBundle 'git://github.com/vim-scripts/TwitVim.git' " " Presen NeoBundle 'https://github.com/sorah/presen.vim' NeoBundle 'git://github.com/pocket7878/presen-vim.git' NeoBundle 'git://github.com/pocket7878/curses-vim.git' NeoBundle 'git://github.com/thinca/vim-showtime.git' "NeoBundle 'git://github.com/thinca/vim-fontzoom.git' " " Colorscheme NeoBundle 'git://github.com/nanotech/jellybeans.vim.git' NeoBundle 'git://gist.github.com/187578.git' " <- h2u_black " }}} filetype plugin indent on " ----------------------------------------------------------------------- " Basis:{{{ " " Add $PATH for node (jslint/csslint) if has('vim_starting') if isdirectory(expand('~/.nvm/v0.6.18/bin/')) execute 'let $PATH="' . $PATH . ':' . $HOME .'/.nvm/v0.6.18/bin/"' endif endif " display set number set ruler set cmdheight=1 set laststatus=2 set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P set title set linespace=0 set showcmd set wildmenu set wildmode=list:longest,full " syntax color "set t_Co=8 syntax on "colorscheme h2u_black colorscheme jellybeans "highlight LineNr ctermfg=0 "colorscheme slate "highlight Normal guibg=grey5 "highlight NonText guibg=grey5 "colorscheme ron "highlight LineNr ctermfg=grey set cursorline highlight CursorLine cterm=bold "set cursorcolumn "highlight CursorColumn ctermbg=0 " search set ignorecase set smartcase set wrapscan set hlsearch set incsearch "set grepprg=ack\ -a set grepprg=grep\ -nH " edit set autoindent set cindent set showmatch set backspace=indent,eol,start set clipboard=unnamed set pastetoggle= set guioptions+=a command! -nargs=1 -bang -bar -complete=file Rename sav | call delete(expand('#:p')) " tab set tabstop=4 " 画面上でタブ文字が占める幅 set expandtab " の代わりに空白を使う set smarttab " 押すとshiftwidthの数だけ空白を挿入する set shiftwidth=4 " インデントに使われる空白の数 set shiftround " インデントをshiftwidthの倍数にする set nowrap "set listchars=eol:↲ set listchars=tab:»»,eol:¦,trail:_ set list " Enable folding. set foldenable set foldmethod=marker set foldmarker={{{,}}} set foldcolumn=3 " diff set diffopt=filler,vertical " window set splitbelow set splitright set visualbell set previewheight=30 " backup set backup set swapfile set backupdir=~/.vim/backup set directory=~/.vim/swap if has('persistent_undo') set undofile set undodir=./.vimundo,~/.vim/undo endif "}}} " ----------------------------------------------------------------------- " QuickStart: {{{ " - gundo.vim (https://github.com/sjl/gundo.vim) " - jslint.vim(https://github.com/basyura/jslint.vim) " - VimFiler (https: //github.com/Shougo/vimfiler) " nnoremap :IndentGuidesToggle nnoremap :VimFiler nnoremap :SyntasticToggleMode nnoremap :GundoToggle "}}} " ----------------------------------------------------------------------- " Keymap:{{{ " -------------------- " timeout set timeout set timeoutlen=3000 set ttimeoutlen=100 " practice noremap noremap noremap noremap inoremap inoremap inoremap " practice noremap inoremap inoremap j getline('.')[col('.') - 2] ==# 'j' ? "\\" : 'j' "inoremap jj "inoremap "nnoremap " below, cause error on MacVim-KaoriYa "inoremap " help "nnoremap :help "nnoremap :help " move nnoremap zl zL nnoremap zh zH nnoremap j gj nnoremap k gk nnoremap gj j nnoremap gk k nnoremap gh gT nnoremap gl gt nnoremap fe $ vnoremap fe $ nnoremap % vnoremap % " text-edit noremap i " brackets" inoremap {} {} inoremap [] [] inoremap () () inoremap "" "" inoremap '' '' inoremap <> <> inoremap []5 [% %] inoremap {}5 {% %} " search nnoremap n nzz nnoremap N Nzz nnoremap * *zz nnoremap # #zz nnoremap g* g*zz nnoremap g# g#zz cnoremap / getcmdtype() == '/' ? '\/' : '/' " fix window-size nnoremap :5wincmd < nnoremap :5wincmd > nnoremap :5wincmd - nnoremap :5wincmd + " move window nnoremap h nnoremap j nnoremap k nnoremap l " buffer nnoremap bb :b# nnoremap bp :bprevious nnoremap bn :bnext nnoremap bd :bdelete " re-select 'last edited text' nnoremap gc `[v`] vnoremap gc :normal gc onoremap gc :normal gc " vim(rc) nnoremap r :execute "source " expand("%:p") nnoremap v :source $MYVIMRC \| if has('gui_running') \| source $MYGVIMRC \| endif nnoremap , :edit $MYVIMRC nnoremap . :edit $MYGVIMRC " Encode command! -bang -nargs=? Utf8 edit ++enc=utf-8 command! -bang -nargs=? Sjis edit ++enc=sjis command! -bang -nargs=? Euc edit ++enc=euc-jp " Other Hacks noremap ; : noremap : ; nnoremap :nohlsearch cnoremap cnoremap cnoremap ~/ " consecutive numbers - 0,1,2,3,4... nnoremap co :ContinuousNumber vnoremap co :ContinuousNumber command! -count -nargs=1 ContinuousNumber let c = col('.')|for n in range(1, ?-line('.'):1)|exec 'normal! j' . n . |call cursor('.', c)|endfor "}}} " ----------------------------------------------------------------------- " augroups: {{{ " " For noexpandtab augroup MyAutoCmd " reset autocmd-list autocmd! " If open new-buffer, set expandtab autocmd BufNewFile,BufRead * set expandtab " cursor-line highlight " - when .vimrc reloaded, VimShell-ssh corrupting "autocmd WinEnter,BufEnter * setlocal cursorline "autocmd WinEnter,BufEnter * setlocal cursorcolumn "autocmd WinLeave * setlocal nocursorline "autocmd WinLeave * setlocal nocursorcolumn " closetag "autocmd Filetype xml inoremap ? / "autocmd Filetype html inoremap ? / "autocmd Filetype html inoremap ? / " go to file! autocmd FileType html setlocal includeexpr=substitute(v:fname,'^\\/','','') | setlocal path+=;/ " format autocmd BufRead *.mkd setlocal wrap autocmd BufRead *.txt setlocal textwidth=0 " Custom folding "autocmd BufEnter * if &filetype == "javascript" | set foldmarker={,} | set foldlevel=3 | set foldcolumn=7 | endif " set less-syntax autocmd BufEnter *.less set filetype=scss augroup END "inoremap ? / "inoremap ?> /> " if type 'set filetype=xxxxx', reset key-binding "if !exists('b:undo_ftplugin') " let b:undo_ftplugin = '' "endif "let b:undo_ftplugin .= ' "\ | execute "iunmap ?" "\ | execute "iunmap ?>" "\' "}}} " ----------------------------------------------------------------------- " encoding: {{{ " - http://www.kawaz.jp/pukiwiki/?vim " if !has('gui_macvim') && !has('kaoriya') set encoding=utf8 set fileencodings=iso-2022-jp,sjis,utf8 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" 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" let s:enc_euc = 'euc-jisx0213' let s:enc_jis = 'iso-2022-jp-3' endif 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 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 set fileformats=unix,dos,mac if exists('&ambiwidth') set ambiwidth=double endif endif "}}} " ----------------------------------------------------------------------- " BufOnly.vim: {{{ " - Delete all the buffers except the current/named buffer. " - http://nanasi.jp/articles/vim/bufonly_vim.html#id4 " " Copyright November 2003 by Christian J. Robinson " " Distributed under the terms of the Vim license. See ":help license". " " Usage: " :Bonly / :BOnly / :Bufonly / :BufOnly [buffer] " " Without any arguments the current buffer is kept. With an argument the " buffer name/number supplied is kept. " command! -nargs=? -complete=buffer -bang Bonly \ :call BufOnly('', '') command! -nargs=? -complete=buffer -bang BOnly \ :call BufOnly('', '') command! -nargs=? -complete=buffer -bang Bufonly \ :call BufOnly('', '') command! -nargs=? -complete=buffer -bang BufOnly \ :call BufOnly('', '') function! BufOnly(buffer, bang) if a:buffer == '' " No buffer provided, use the current buffer. let buffer = bufnr('%') elseif (a:buffer + 0) > 0 " A buffer number was provided. let buffer = bufnr(a:buffer + 0) else " A buffer name was provided. let buffer = bufnr(a:buffer) endif if buffer == -1 echohl ErrorMsg echomsg "No matching buffer for" a:buffer echohl None return endif let last_buffer = bufnr('$') let delete_count = 0 let n = 1 while n <= last_buffer if n != buffer && buflisted(n) if a:bang == '' && getbufvar(n, '&modified') echohl ErrorMsg echomsg 'No write since last change for buffer' \ n '(add ! to override)' echohl None else silent exe 'bdel' . a:bang . ' ' . n if ! buflisted(n) let delete_count = delete_count+1 endif endif endif let n = n+1 endwhile if delete_count == 1 echomsg delete_count "buffer deleted" elseif delete_count > 1 echomsg delete_count "buffers deleted" endif endfunction "}}} " ----------------------------------------------------------------------- " HTML Key Mappings for Typing Character Codes: {{{ " " |-------------------------------------------------------------------- " |Keys |Insert |For |Comment " |---------|---------|-----|------------------------------------------- " |\& |& |& |ampersand " |\< |< |< |less-than sign " |\> |> |> |greater-than sign " |\. |· |・ |middle dot (decimal point) " |\? |— |? |em-dash " |\2 |“ |“ |open curved double quote " |\" |” |” |close curved double quote " |\` |‘ |‘ |open curved single quote " |\' |’ |’ |close curved single quote (apostrophe) " |\` |` |` |OS-dependent open single quote " |\' |' |' |OS-dependent close or vertical single quote " |\ |  | |non-breaking space " |--------------------------------------------------------------------- " " > http://www.stripey.com/vim/html.html " " autocmd! BufEnter * if &filetype == "html" | call MapHTMLKeys() | endif function! MapHTMLKeys(...) if a:0 == 0 || a:1 != 0 inoremap \\ \ inoremap \& & inoremap \< < inoremap \> > inoremap \. ・ inoremap \- — inoremap \   inoremap \` ‘ inoremap \' ’ inoremap \2 “ inoremap \" ” autocmd! BufLeave * call MapHTMLKeys(0) else iunmap \\ iunmap \& iunmap \< iunmap \> iunmap \- iunmap \ iunmap \` iunmap \' iunmap \2 iunmap \" autocmd! BufLeave * endif " test for mapping/unmapping endfunction " MapHTMLKeys() "}}} " ----------------------------------------------------------------------- " snipMate.vim: {{{ " - http://www.vim.org/scripts/script.php?script_id=2540 " " below, Reload xxx.snippet. :call SnipMateReload() " -> http://webtech-walker.com/archive/2009/10/26021358.html " function! SnipMateReload() if &ft == 'snippet' let ft = substitute(expand('%'), '.snippets', '', '') if has_key(g:did_ft, ft) unlet g:did_ft[ft] endif silent! call GetSnippets(g:snippets_dir, ft) endif endfunction "}}} " ----------------------------------------------------------------------- " FontsToggle: {{{ " - inspired zoom.vim@hokaccha " - http://gist.github.com/200505 " function! FontToggle(trigger) if &guifont == "Courier\ New:h14" if a:trigger == 'b' execute 'set guifont=Courier\ New:h36' execute 'set columns=51' execute 'set lines=16' elseif a:trigger == 'f' execute 'set guifont=nanahoshi-beta:h18' execute 'set guifontwide=nanahoshi-beta:h18' "execute 'set guifont=Inconsolata:h15' "execute 'set guifontwide=Inconsolata:h15' execute 'set columns=124' execute 'set lines=36' endif else execute 'set guifont=Courier\ New:h14' execute 'set guifontwide=' execute 'set columns=140' execute 'set lines=40' endif endfunction nnoremap :call FontToggle('f') nnoremap :call FontToggle('b') "}}} " ----------------------------------------------------------------------- " fontzoom.vim: {{{ "nmap (fontzoom-larger) "nmap (fontzoom-smaller) "}}} " ----------------------------------------------------------------------- " neocomplcache: {{{ " - https://github.com/Shougo/neocomplcache " - https://github.com/Shougo/neocomplcache/blob/998764e1072fa5b183c3da4705b8187658fa0b41/presen/neocomplcache.txt " " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 let g:neocomplcache_enable_smart_case = 1 let g:neocomplcache_enable_camel_case_completion = 1 let g:neocomplcache_enable_underbar_completion = 1 let g:neocomplcache_min_syntax_length = 3 "Quick Type, ignore neocomplcache. let g:NeoComplCache_SkipCompletionTime = '0.3' let g:NeoComplCache_SkipInputTime = '0.1' " : delete popup and hold indent " : close popup and delete backword char. " : close popup and delete backword char. " : close popup and delete backword char. " : close popup and delete backword char. " : manual-start neocomplcache. " : Vim native-keyword complement. " : Vim native-Omni completion. inoremap pumvisible() ? "\\X\" : "\X\" inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#smart_close_popup()."\" inoremap pumvisible() ? "\" : "\\\" inoremap pumvisible() ? "\" : "\\" inoremap &filetype == 'vim' ? "\\\" : "\\\" "}}} " ----------------------------------------------------------------------- " neocomplcache-snippets-complete: {{{ " - https://github.com/Shougo/neocomplcache-snippets-complete " let g:neocomplcache_snippets_dir = '~/.vim/snippets' smap (neocomplcache_snippets_expand) smap (neocomplcache_snippets_expand) imap neocomplcache#sources#snippets_complete#expandable() ? \ "\(neocomplcache_snippets_expand)" : pumvisible() ? "\" : "\" " For snippet_complete marker. if has('conceal') set conceallevel=2 concealcursor=i endif "}}} " ----------------------------------------------------------------------- " quickrun: {{{ " - https://github.com/thinca/vim-quickrun/ " let g:quickrun_config = {} let g:quickrun_config.haskell = {'command' : 'runhugs'} " Set shortcut keys. " \ 'w' : '>', for [key, com] in items({ \ 'x' : '>:', \ 'p' : '>!', \ 'q' : '>>', \ }) execute 'nnoremap ' key ':QuickRun' com '-mode n' execute 'vnoremap ' key ':QuickRun' com '-mode v' endfor "}}} " ----------------------------------------------------------------------- " smartchr: {{{ " - http://www.vim.org/scripts/script.php?script_id=2290 " "inoremap + smartchr#one_of(' + ', '++', '+') "inoremap & smartchr#one_of(' & ', ' && ', '&') " "inoremap = smartchr#one_of('=', ' = ', ' == ') "inoremap - smartchr#one_of('-', ' - ', '--') "inoremap / smartchr#one_of('/', ' / ', '// ') ""inoremap % smartchr#one_of(' % ', '%') ""inoremap : smartchr#one_of(': ', ':') "inoremap ? smartchr#one_of('? ', '?') "inoremap . smartchr#loop('.', ' -> ', '...') " "inoremap } smartchr#one_of('}', '}') "inoremap ; smartchr#one_of(';', ';') "}}} " ----------------------------------------------------------------------- " unite.vim: {{{ " - https://github.com/Shougo/unite.vim " let g:unite_winheight = 10 let g:unite_source_history_yank_enable = 1 let g:unite_source_history_yank_limit = 100 " The prefix key. nnoremap ff :Unite file -buffer-name=files -no-quit nnoremap fu :Unite buffer file_mru -buffer-name=mru -no-quit nnoremap fb :Unite bookmark -buffer-name=bookmark nnoremap fl :Unite line -buffer-name=line nnoremap fg :Unite grep -buffer-name=grep -no-quit -auto-preview nnoremap f1 :Unite file -buffer-name=files -input=/Users/sigwyg/Dropbox/memo/ autocmd MyAutoCmd FileType unite call s:unite_my_settings() function! s:unite_my_settings()" " Overwrite settings. imap (unite_input_directory) endfunction" "}}} " ----------------------------------------------------------------------- " unite-grep: {{{ " - https://github.com/Shougo/vimproc/tree/master let g:unite_source_grep_command = "grep" let g:unite_source_grep_default_opts = "-Hn" "}}} " ----------------------------------------------------------------------- " VimFiler: {{{ " - https: //github.com/Shougo/vimfiler " let g:vimfiler_split_command = 'vertical rightbelow vsplit' let g:vimfiler_min_filename_width = 20 "let g:vimfiler_max_filename_width = 50 let g:vimfiler_as_default_explorer = 1 " Overwrite settings. autocmd MyAutoCmd FileType vimfiler call s:vimfiler_my_settings() function! s:vimfiler_my_settings()" nmap l nmap j nmap R (vimfiler_redraw_screen) endfunction" "}}} " ----------------------------------------------------------------------- " VimShell: {{{ " - https: //github.com/Shougo/vimshell " let g:vimshell_prompt = $USER."% " let g:vimshell_user_prompt = 'fnamemodify(getcwd(), ":~")' let g:vimshell_right_prompt = 'vcs#info("(%s)-[%b]%p", "(%s)-[%b|%a]%p")' let g:vimshell_split_command = 'split' let g:vimshell_editor_command = '/Applications/local/MacVim-kaoriya.app/Contents/MacOS/Vim --servername=VIM --remote-tab-wait-silent' autocmd MyAutoCmd FileType vimshell call s:vimshell_settings() function! s:vimshell_settings() "imap (vimshell_another_delete_backward_char) "imap (vimshell_another_delete_backward_char) call vimshell#altercmd#define('i', 'iexe') call vimshell#altercmd#define('is', 'iexe ssh') call vimshell#altercmd#define('gim', 'git commit -m') call vimshell#set_alias('la', 'ls -la') call vimshell#set_alias('gis', 'git status') call vimshell#set_alias('gid', 'git diff') call vimshell#set_alias('gic', 'git commit') " for Insert action on VimShell-history "call unite#custom_default_action('source/vimshell/history/completion' , 'insert') call unite#custom_default_action('vimshell/history' , 'insert') endfunction "}}} " ----------------------------------------------------------------------- " textmanip.vim: {{{ " - https://github.com/t9md/vim-textmanip " xmap (textmanip-duplicate-down) nmap (textmanip-duplicate-down) xmap (textmanip-duplicate-up) nmap (textmanip-duplicate-up) xmap (textmanip-move-down) xmap (textmanip-move-up) xmap (textmanip-move-left) xmap (textmanip-move-right) "}}} " ----------------------------------------------------------------------- " quickhl.vim: {{{ " - https://github.com/t9md/vim-textmanip " nmap m (quickhl-toggle) xmap m (quickhl-toggle) nmap M (quickhl-reset) xmap M (quickhl-reset) nmap j (quickhl-match) let g:quickhl_keywords = [ \ {"pattern": '\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}', "regexp": 1 }, \ {"pattern": "NOTE"}, \ {"pattern": "MEMO"}, \ {"pattern": "aside"}, \ {"pattern": " "}, \ {"pattern": '\(\S\)\@<=\s\+$', "regexp": 1 }, \ ] " " If "set nolist" (ex. :Unite file), delete highlight. " - BufNewFile/BufRead not work. " - BufEnter/WinEnter working only to return window. " "autocmd BufEnter unite if &list == "0" | call quickhl#lock() | endif autocmd MyAutoCmd FileType unite call quickhl#lock() autocmd MyAutoCmd FileType vimfiler call quickhl#lock() "}}} " ----------------------------------------------------------------------- " html5.vim: {{{ " - https://github.com/othree/html5.vim let g:html5_event_handler_attributes_complete = 1 let g:html5_rdfa_attributes_complete = 1 let g:html5_microdata_attributes_complete = 1 let g:html5_aria_attributes_complete = 1 "}}} " ----------------------------------------------------------------------- " jslint.vim: {{{ " - https://github.com/basyura/jslint.vim " - :copen -> :cnext ... "autocmd MyAutoCmd FileType javascript call s:javascript_filetype_settings() " "function! s:javascript_filetype_settings() " autocmd BufLeave call jslint#clear() " autocmd BufWritePost call jslint#check() " autocmd CursorMoved call jslint#message() "endfunction "}}} " ----------------------------------------------------------------------- " indent-guides: {{{ " - https://github.com/nathanaelkane/vim-indent-guides " - :IndentGuidesToggle let g:indent_guides_enable_on_vim_startup = 1 let g:indent_guides_indent_levels = 30 let g:indent_guides_start_level = 2 let g:indent_guides_guide_size = 1 let g:indent_guides_space_guides = 1 let g:indent_guides_auto_colors = 0 let g:indent_guides_color_change_percent = 20 augroup indentGuide autocmd! indentGuide autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#191919 ctermbg=6 autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#303030 ctermbg=0* augroup END "}}} " ----------------------------------------------------------------------- " vim-powerline: {{{ " - https://github.com/Lokaltog/vim-powerline let g:Powerline_symbols = 'fancy' let g:Powerline_stl_path_style = 'short' "}}} " ----------------------------------------------------------------------- " w3m.vim: {{{ " - https://github.com/yuratomo/w3m.vim "let g:w3m#homepage = "http://www.google.co.jp/" "let g:w3m#search_engine = 'http://www.google.co.jp/search?hl=ja&ie=' . &encoding . '&q=' " \ 'http://search.yahoo.co.jp/search?search.x=1&fr=top_ga1_sa_124&tid=top_ga1_sa_124&ei=' . &encoding . '&aq=&oq=&p=' "}}} " ----------------------------------------------------------------------- " syntastic: {{{ " - https://github.com/scrooloose/syntastic let g:syntastic_check_on_open=0 let g:syntastic_javascript_checker = 'jshint' let g:syntastic_mode_map = { 'mode': 'active', \ 'active_filetypes': [''], \ 'passive_filetypes': ['css'] } "}}} " ----------------------------------------------------------------------- " Like :CdCurrent {{{ " - :CD " command! -nargs=? -complete=dir -bang CD call s:ChangeCurrentDir('', '') function! s:ChangeCurrentDir(directory, bang) if a:directory == '' lcd %:p:h else execute 'lcd' . a:directory endif if a:bang == '' pwd endif endfunction "}}} " ----------------------------------------------------------------------- " htmlform.vim: {{{ " - https: //github.com/sigwyg/htmlform.vim " - http://archiva.jp/web/sugamo_css/sugamo_vim_01.html " vnoremap \u :call ChangeUL() vnoremap \t :call ChangeTable() " ChangeUL function! ChangeUL() range let l:count = a:firstline while l:count <= a:lastline let l:str = getline(l:count) let l:out = substitute(l:str, '^\s\+', '', '') let l:out = substitute(l:str, '^\(.\+\)$', '
  • \1<\/li>', '') call setline(l:count, l:out) let l:count = l:count + 1 endwhile call append(a:lastline, '') call append(a:firstline - 1, '
      ') endfunction " ChangeTable function! ChangeTable() range let l:count = a:firstline while l:count <= a:lastline let l:str = getline(l:count) let l:out = substitute(l:str, '\s\{2,}', '', '') let l:out = '' . l:out . '' call setline(l:count, l:out) let l:count = l:count + 1 endwhile call append(a:lastline, '') call append(a:firstline - 1, '') endfunction " }}} " ----------------------------------------------------------------------- " for markdown: {{{ " - http://archiva.jp/web/tool/vim2mkd.html nnoremap \m :call DisplayMarkdown() function! DisplayMarkdown() !perl ~/dotfiles/Markdown.pl --html4tags "%" > /tmp/__markdown.html; vert diffsplit /tmp/__markdown.html highlight DiffChange guibg=grey0 highlight DiffAdd guibg=grey0 highlight DiffText gui=NONE, guibg=grey0 highlight DiffDelete guibg=grey0 call cursor(1,1) " %diffput " wincmd c " set ft=html " diffoff endfunction " }}} " ----------------------------------------------------------------------- " CSS3PropertyDuplicate(): {{{ " - Origin: https://gist.github.com/972806 " - Forked: https://gist.github.com/1901182 " function! CSS3PropertyDuplicate() let l:css3 = getline(".") let l:line = line(".") let l:ind = matchlist(css3, '\v(\s*)(.*)') let l:webkit = ind[1] . "-webkit-" . ind[2] let l:moz = ind[1] . "-moz-" . ind[2] let l:ms = ind[1] . "-ms-" . ind[2] let l:o = ind[1] . "-o-" . ind[2] call append(line -1, [webkit, moz, ms, o]) call cursor(line, 1) endfunction nnoremap ,3 :call CSS3PropertyDuplicate() " }}} " ----------------------------------------------------------------------- " Open junk file: {{{ " - Origin: http://vim-users.jp/2010/11/hack181/ " - Usage: ":JunkFile" " command! -nargs=0 JunkFile call s:open_junk_file() function! s:open_junk_file() let junk_dir = $HOME . '/.vim_junk' if !isdirectory(junk_dir) call mkdir(junk_dir, 'p') endif let filename = input('Junk Code: ', junk_dir.strftime('/%Y-%m-%d-%H%M%S.')) if filename != '' execute 'edit ' . filename endif endfunction " }}}