ちょっと前より vim 使うようになった
週に1日くらいだったのがもうすこし使うようになったんですが、もうすこし使いこなせるようになりたい。
typo はずいのでなおした。
気付いたらぷらぎんがやや増えてた。
~/.vim/plugin
~/.vimrc
set nocompatible set nobackup set hidden set history=100 filetype plugin indent on scriptencoding utf-8 " indent set autoindent smartindent set expandtab "set tabstop=4 softtabstop=4 shiftwidth=4 set tabstop=2 softtabstop=2 shiftwidth=2 augroup Tabs autocmd! autocmd FileType ruby setlocal tabstop=2 softtabstop=2 shiftwidth=2 autocmd FileType make setlocal noexpandtab augroup END " appearance set background=dark colorscheme slate syntax enable set showmatch set wrap set number set ruler set showcmd set list set listchars=tab:>.,eol:< set laststatus=2 set statusline=%<%f[%n]\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']('.(&ft!=''?&ft:'Fundamental').')'}%=%l,%c%V%8P set wildmenu highlight ZenkakuSpace cterm=underline ctermfg=DarkYellow guibg=DarkYellow augroup Visible autocmd! autocmd VimEnter,WinEnter * match ZenkakuSpace / / augroup END " tabline function! MyTabLabel(n) let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) let buflen = tabpagewinnr(a:n, '$') let bufname = fnamemodify(bufname(buflist[winnr - 1]), ':t') let label = a:n . ": " let label .= bufname == '' ? 'No name' : bufname let label .= '[' . buflen . ']' return label endfunction function! MyTabLine() let s = '' for i in range(tabpagenr('$')) if i + 1 == tabpagenr() let s .= '%#TabLineSel#' else let s .= '%#TabLine#' endif let s .= '%' . (i + 1) . 'T' let s .= ' %{MyTabLabel(' . (i + 1) . ')} ' endfor let s .= '%#TabLineFill#%T' if tabpagenr('$') > 1 let s .= '%=%#TabLine#%999Xx' endif return s endfunction set tabline=%!MyTabLine() set showtabline=2 " search set hlsearch set wrapscan set noincsearch set ignorecase set smartcase " mapping nnoremap j gj nnoremap k gk vnoremap j gj vnoremap k gk nnoremap <Space>n :<C-u>n<CR> nnoremap <Space>N :<C-u>N<CR> nnoremap <Space>p :<C-u>prev<CR> nnoremap <Space>tf :<C-u>tabfirst<CR> nnoremap <Space>tl :<C-u>tablast<CR> nnoremap <Space>tn :<C-u>tabn<CR> nnoremap <Space>tN :<C-u>tabN<CR> nnoremap <Space>tp :<C-u>tabp<CR> nnoremap <Space>te :<C-u>tabe<CR> nnoremap <Space>tc :<C-u>tabc<CR> nnoremap <Space>to :<C-u>tabo<CR> nnoremap <Space>tt :<C-u>TabRecent<CR> nnoremap <Space>bf :<C-u>br<CR> nnoremap <Space>bl :<C-u>bl<CR> nnoremap <Space>bn :<C-u>bn<CR> nnoremap <Space>bN :<C-u>bN<CR> nnoremap <Space>bp :<C-u>bp<CR> nnoremap <Space>cf :<C-u>crew<CR> nnoremap <Space>cl :<C-u>cla<CR> nnoremap <Space>cn :<C-u>cn<CR> nnoremap <Space>cN :<C-u>cN<CR> nnoremap <Space>cp :<C-u>cp<CR> nnoremap <Space>r :<C-u>registers<CR> nnoremap <Space>l :<C-u>ls<CR> nnoremap <Space>m :<C-u>marks<CR> nnoremap <Space>j :<C-u>tabs<CR> nnoremap <Space>k :<C-u>tags<CR> nnoremap <Space>. :<C-u>edit $MYVIMRC<CR> function! s:toggle_quickfix_window() " toggle quickfixwindow " http://d.hatena.ne.jp/kuhukuhun/20090119/1232343733 let _ = winnr('$') cclose if _ == winnr('$') cwindow endif endfunction nnoremap <silent> <Space>q :<C-u>call <SID>toggle_quickfix_window()<CR> " 日付 command! -nargs=0 AppendDate :execute "normal a".strftime("%Y-%m-%d") command! -nargs=0 AppendNow :execute "normal a".strftime("%c") command! -nargs=0 AppendTime :execute "normal a".strftime("%H:%M") " enc/fenc command! -bang -nargs=? Utf8Edit edit<bang> ++enc=utf-8 <args> command! -bang -nargs=? EucjpEdit edit<bang> ++enc=euc-jp <args> command! -bang -nargs=? SjisEdit edit<bang> ++enc=sjis <args> command! -bang -nargs=? Cp932Edit edit<bang> ++enc=cp932 <args> command! -nargs=0 Utf8Set setlocal fenc=utf-8 command! -nargs=0 EucjpSet setlocal fenc=euc-jp command! -nargs=0 SjisSet setlocal fenc=sjis nnoremap <Leader>eu :<C-u>Utf8Edit<CR> nnoremap <Leader>ee :<C-u>EucjpEdit<CR> nnoremap <Leader>es :<C-u>SjisEdit<CR> nnoremap <Leader>ec :<C-u>Cp932Edit<CR> nnoremap <Leader>su :<C-u>Utf8Set<CR> nnoremap <Leader>se :<C-u>EucjpSet<CR> nnoremap <Leader>ss :<C-u>SjisSet<CR> " encoding " http://www.kawaz.jp/pukiwiki/?vim#cb691f26 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' " iconvがeucJP-msに対応しているかをチェック 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' " iconvがJISX0213に対応しているかをチェック 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 " 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 s:enc_euc unlet s:enc_jis endif " 日本語を含まない場合は fileencoding に encoding を使うようにする 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 "" plugins " skk.vim let skk_jisyo = '~/.vim/plugin/skk/skk-jisyo' let skk_large_jisyo = '~/.vim/plugin/skk/SKK-JISYO.L' let skk_auto_save_jisyo = 1 let skk_keep_state = 0 let skk_egg_like_newline = 0 let skk_show_annotation = 1 let skk_use_face = 1 " hatena.vim set runtimepath+=~/.vim/plugin/hatena/ let g:hatena_always_trivial = 1 let g:hatena_user = $LOGNAME let g:hatena_users = ['studyroom:moja8', 'moja8', $LOGNAME] nnoremap <Leader>hu :HatenaUser " ack.vim let g:AckCmd = '~/bin/ack' " TODO: sort css property ha ftplugin ni kakou " http://d.hatena.ne.jp/secondlife/20060831/1157010796 nmap gso vi{:!~/bin/sortcss<CR> vmap gso i{:!~/bin/sortcss<CR> " yankring.vim let g:yankring_history_dir = '$HOME/.vim' let g:yankring_max_history = 200 let g:yankring_max_display = 200 let g:yankring_window_use_separate = 1 let g:yankring_window_height = 13 nnoremap <silent> <Space>y :YRShow<CR> command! -nargs=1 Y YRSearch <args> " tabrecent.vim command! -bang -nargs=? T TabRecent<bang> <args> " surround.vim let g:surround_{char2nr("-")} = "<% \r %>" let g:surround_{char2nr("=")} = "<%= \r %>" let g:surround_{char2nr("n")} = "<\1tagname: \r..*\r&\1\2attribute: \r..*\r &\2\3value: \r..*\r=\"&\"\3>\r</\1\1>" let g:surround_{char2nr("a")} = "<a href=\"\r\">\1link\ text: \1</a>" " fuzzyfinder.vim nnoremap [FF] <Nop> nmap <Leader>f [FF] nnoremap [FF]f :FuzzyFinderBuffer<CR> nnoremap [FF]b :FuzzyFinderFile<CR> nnoremap [FF]m :FuzzyFinderMruFile<CR>
キーマッピングがバカのひとつおぼえみたいな感じなのですが、これってどうにかならないでしょうか。だれか教えてほしいですです…!