#author("2019-08-29T22:15:15+00:00","","") #mynavi() #setlinebreak(on); * 目次 [#h4469f5b] #contents * プラグインマネージャ(vundle)インストール [#t5988e7f] #html(<div style="padding-left:10px;">) #myterm2(){{ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim }} ※ .vimrc に以下の Vundle.vim の部分を記述後、:PluginInstall でインストール #html(</div>) * ~/.vimrc [#r93cb634] #html(<div style="padding-left:10px;">) #mycode2(){{ """"""""""""""""""""""""""""" " 表示設定 """"""""""""""""""""""""""""" syntax on "set cursorline "highlight Normal cterm=none ctermbg=black ctermfg=white highlight cursorline term=reverse cterm=none ctermbg=gray ctermfg=white highlight statusline cterm=none ctermbg=white ctermfg=blue "highlight statusline cterm=none ctermbg=none ctermfg=none set enc=utf-8 set fenc=utf-8 set fencs=utf-8,cp932,sjis,euc-jp set title set ignorecase set smartcase set wrapscan set hlsearch set incsearch set number "set laststatus=2 "set statusline=%F%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c set ruler set ts=4 " change tab space set expandtab set tabstop=4 set shiftwidth=4 if exists('&ambiwidth') set ambiwidth=double endif let _curfile=expand("%:r") if _curfile == 'Makefile' set noexpandtab endif " Change Encoding Command command! Utf8 edit ++enc=utf-8 command! Sjis edit ++enc=cp932 command! Cp932 edit ++enc=cp932 command! Win31j edit ++enc=cp932 """"""""""""""""""""""""""""" " Jsonフォーマッタ """"""""""""""""""""""""""""" command! -nargs=? Jq call s:Jq(<f-args>) function! s:Jq(...) if 0 == a:0 let l:arg = "." else let l:arg = a:1 endif execute "%! jq \"" . l:arg . "\"" endfunction command! JsonFormat :execute '%!python -m json.tool' \ | :execute '%!python -c "import re,sys;chr=__builtins__.__dict__.get(\"unichr\", chr);sys.stdout.write(re.sub(r\"\\u[0-9a-f]{4}\", lambda x: chr(int(\"0x\" + x.group(0)[2:], 16)), sys.stdin.read()))"' \ | :%s/ \+$//ge \ | :set ft=javascript \ | :1 """"""""""""""""""""""""""""" " キーバインド """"""""""""""""""""""""""""" " n1, n0 で行番号の表示有無を切り替える noremap n0 :<C-u>set nonumber<Enter> noremap n1 :<C-u>set number<Enter> " html, div 入力 noremap html <insert><!doctype html><Enter><html lang="ja"><Enter><head><Enter><meta charset="utf-8"><Enter></head><Enter><body><Enter><Enter></body><Enter></html><UP><UP><Esc> noremap div <insert><div id="" class="" style=""><Enter><Enter></div><UP><Esc> " ファイル新規作成時の定型文自動挿入 autocmd BufNewFile *.php 0r $HOME/.vim/template/php.txt autocmd BufNewFile *.html 0r $HOME/.vim/template/html.txt """"""""""""""""""""""""""""" " Vundle.vim """"""""""""""""""""""""""""" set nocompatible " be iMproved, required filetype off " required set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline-themes' call vundle#end() " required filetype plugin indent on " required """"""""""""""""""""""""""""" " vim-airline """"""""""""""""""""""""""""" set laststatus=2 let g:airline#extensions#branch#enabled = 0 "let g:airline_powerline_fonts = 1 if !exists('g:airline_symbols') let g:airline_symbols = {} endif let g:airline_symbols.space = "\ua0" }} #html(</div>) * 作業用関数 [#gcb7d3db] #html(<div style="padding-left:10px;">) find して vim する fvim 関数の定義例 .bashrc #mycode2(){{ fvim(){ if [ "$#" == "0" ]; then echo "ファイル名を指定して下さい" exit 1 fi filename=$1 #files=`mdfind $filename -onlyin ./` files=`find ./ -name *${filename}* | grep -v -E "(.*class$|.pyc$)"` cnt=`echo "$files" | wc -l | awk '{print $1}'` if [ "$cnt" == "0" ]; then echo ファイルが見つかりません fi if [ "$cnt" == "1" ]; then vim "$files" return 0 fi echo "複数のファイルが見つかりました" echo "$files" | awk '{ print NR" "$1 }' echo -n "No: " read no while [ true ]; do file=`echo "$files" | awk -v no=$no '{ if (no == NR) print $1; }'` if [ -e "$file" ]; then vim $file return 0 elif [ "$no" == "q" ]; then return 0 fi done } }} #html(</div>)