Skip to content

Instantly share code, notes, and snippets.

@smallfield
Created February 27, 2015 22:49
Show Gist options
  • Save smallfield/86ab63cfb8150bce9c07 to your computer and use it in GitHub Desktop.
Save smallfield/86ab63cfb8150bce9c07 to your computer and use it in GitHub Desktop.
vimrc
" auto reload .vimrc
augroup source-vimrc
autocmd!
autocmd BufWritePost *vimrc source $MYVIMRC | set foldmethod=marker
autocmd BufWritePost *gvimrc if has('gui_running') source $MYGVIMRC
augroup END
"---タイムスタンプのやつ
inoremap <F5> <ESC>i<C-R>=strftime("%H:%M ")<CR>
inoremap <F6> <ESC>i<C-R>=strftime("%Y/%m/%d (%a)")<CR><CR>
nnoremap <F2> <ESC>:o D:\memo\<C-R>=strftime("%Y%m")<CR><CR>
inoremap <F9> □ <ESC>$a
nnoremap <F12> <ESC>:s/□/■/g<CR>:noh<CR>$
nnoremap <ESC><ESC> <ESC>:noh<CR>
" キー入れ替え
nnoremap k gk
nnoremap j gj
vnoremap k gk
vnoremap j gj
nnoremap gk k
nnoremap gj j
vnoremap gk k
vnoremap gj j
inoremap <C-d> <Delete>
inoremap <C-l> <Right>
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-a> <Home>
inoremap <C-e> <End>
inoremap <C-d> <BS>
nnoremap <C-a> <Home>
nnoremap <C-e> <End>
" Escapeするキー
inoremap jk <Esc>
" 透過設定
set transparency=225
set number
set ruler
set list
set listchars=tab:>-,nbsp:%,extends:>,precedes:<
set incsearch
set hlsearch
set autoindent
set autoread
set nobackup
set noswapfile
" Alignを日本語環境で使用するための設定
let g:Align_xstrlen = 3
" golang
au BufWritePre *.go Fmt
au FileType go nmap <leader>r <Plug>(go-run)
if $GOROOT != ''
set rtp+=$GOROOT/misc/vim
endif
autocmd FileType go compiler go
" 垂直分割にする
let g:quickrun_config={'*': {'split': ''}}
let g:quickrun_config._={ 'runner':'vimproc',
\ "runner/vimproc/updatetime" : 10,
\ "outputter/buffer/close_on_empty" : 1,
\ }
" ステータスバー
set statusline=%{expand('%:p:t')}\ %<\(%{expand('%:p:h')}\)%=\ %m%r%y%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}[%3l,%3c]
" クリップボードにyankをコピー
set clipboard=unnamed
" 自動改行を止める奴
set tw=0
" カラースキームの設定
colorscheme jellybeans
" neobundle
if has('vim_starting')
set nocompatible
" neobundle をインストールしていない場合は自動インストール {{{
if !isdirectory(expand("~/.vim/bundle/neobundle.vim/"))
echo "install neobundle..."
" vim からコマンド呼び出しているだけ neobundle.vim のクローン
:call system("git clone git://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim")
endif
" }}}
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('~/.vim/bundle'))
let g:neobundle_default_git_protocol='https'
" neobundle#begin - neobundle#end の間に導入するプラグインを記載します。
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/neocomplete.vim'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/neomru.vim'
NeoBundle 'thinca/vim-quickrun'
" color schema
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'croaker/mustang-vim'
NeoBundle 'jeffreyiacono/vim-colors-wombat'
NeoBundle 'nanotech/jellybeans.vim'
NeoBundle 'vim-scripts/Lucius'
NeoBundle 'vim-scripts/Zenburn'
NeoBundle 'mrkn/mrkn256.vim'
NeoBundle 'jpo/vim-railscasts-theme'
NeoBundle 'therubymug/vim-pyte'
NeoBundle 'tomasr/molokai'
NeoBundle 'ujihisa/unite-colorscheme'
" vimrc に記述されたプラグインでインストールされていないものがないかチェックする
NeoBundleCheck
call neobundle#end()
" NerdTree Settings {{{
nnoremap <silent><C-t> :NERDTreeToggle<CR>
" }}}
"インサートモードで開始
let g:unite_enable_start_insert=1
"ヒストリー/ヤンク機能を有効化
let g:unite_source_history_yank_enable =1
"prefix keyの設定
nmap <Space> [unite]
"スペースキーとaキーでカレントディレクトリを表示
nnoremap <silent> [unite]a :<C-u>UniteWithBufferDir -buffer-name=files file<CR>
"スペースキーとfキーでバッファと最近開いたファイル一覧を表示
nnoremap <silent> [unite]f :<C-u>Unite<Space>buffer file_mru<CR>
"スペースキーとdキーで最近開いたディレクトリを表示
nnoremap <silent> [unite]d :<C-u>Unite<Space>directory_mru<CR>
"スペースキーとbキーでバッファを表示
nnoremap <silent> [unite]b :<C-u>Unite<Space>buffer<CR>
"スペースキーとrキーでレジストリを表示
nnoremap <silent> [unite]r :<C-u>Unite<Space>register<CR>
"スペースキーとtキーでタブを表示
nnoremap <silent> [unite]t :<C-u>Unite<Space>tab<CR>
"スペースキーとhキーでヒストリ/ヤンクを表示
nnoremap <silent> [unite]h :<C-u>Unite<Space>history/yank<CR>
"スペースキーとoキーでoutline
nnoremap <silent> [unite]o :<C-u>Unite<Space>outline<CR>
"スペースキーとENTERキーでfile_rec:!
nnoremap <silent> [unite]<CR> :<C-u>Unite<Space>file_rec:!<CR>
"unite.vimを開いている間のキーマッピング
autocmd FileType unite call s:unite_my_settings()
function! s:unite_my_settings()"{{{
" ESCでuniteを終了
nmap <buffer> <ESC> <Plug>(unite_exit)
endfunction"}}}
" this should be last whatever...
filetype plugin indent on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment