Skip to content

Instantly share code, notes, and snippets.

@okn3
Created October 16, 2015 06:09
Show Gist options
  • Select an option

  • Save okn3/20249e4836ab42710f7e to your computer and use it in GitHub Desktop.

Select an option

Save okn3/20249e4836ab42710f7e to your computer and use it in GitHub Desktop.
vimrc設定 okuno
" --------------------------
" Start Neobundle Settings.
" ---------------------------
" bundleで管理するディレクトリを指定
set runtimepath+=~/.vim/bundle/neobundle.vim/
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" neobundle自体をneobundleで管理
NeoBundleFetch 'Shougo/neobundle.vim'
" 追加のプラグイン"
" NERDTreeを設定
NeoBundle 'scrooloose/nerdtree'
"colorscheme hyblid
NeoBundle 'w0ng/vim-hybrid'
"colorscheme wombat
NeoBundle 'jeffreyiacono/vim-colors-wombat'
call neobundle#end()
NeoBundle 'nathanaelkane/vim-indent-guides'
NeoBundle 'tpope/vim-surround'
"IDE化
NeoBundle 'Shougo/neocomplcache'
NeoBundle 'Shougo/neosnippet'
NeoBundle 'Shougo/neosnippet-snippets'
"jedi-vim python
NeoBundle 'davidhalter/jedi-vim'
"ardunio syntax
NeoBundle "sudar/vim-arduino-syntax"
"ctr + P vim
NeoBundle 'ctrlpvim/ctrlp.vim'
"文法チェック
NeoBundle 'scrooloose/syntastic'
let g:syntastic_python_checkers = ['pyflakes', 'pep8']
" Required:
filetype plugin indent on
syntax on
"NERDTree自動起動
autocmd vimenter * if !argc() | NERDTree | endif
" 未インストールのプラグインの確認
NeoBundleCheck
"-----------------------
"Other Setting
"-----------------------
"カーソルを行頭、行末で止まらないようにする
set whichwrap=b,s,h,l,<,>,[,]
" 構文毎に文字色を変化させる
syntax on
" カラースキーマの指定
colorscheme hybrid
" 行番号を表示
set number
" 行番号の色
"highlight LineNr ctermfg=darkyellow
highlight LineNr ctermfg=131
"tab の設定-python-
autocmd FileType python setl autoindent
autocmd FileType python setl smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd FileType python setl tabstop=8 expandtab shiftwidth=4 softtabstop=4
"teb設定
set tabstop=2
set autoindent
set expandtab
set shiftwidth=2
"4⇛2に修正 2014/11/05 TechCamp
"インデントの設定
" vim-indent-guides
let g:indent_guides_auto_colors=0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=237
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=235
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_guide_size=1
"スワップファイルを作成しない
set noswapfile
" jedi-vim 設定
autocmd FileType python setlocal completeopt-=preview
autocmd FileType python setlocal omnifunc=jedi#completions
let g:jedi#auto_vim_configuration = 0
if !exists('g:neocomplcache#force_omni_input_patterns')
let g:neocomplcache#force_omni_input_patterns = {}
endif
let g:neocomplcache#force_omni_input_patterns.python = '\h\w*\|[^. \t]\.\w*'
let g:jedi#popup_select_first = 0
"-------------------------
" End Neobundle Settings.
"-------------------------
"
"------------------------
"neocomplcacheの詳細設定
"------------------------
" 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
" 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' : ''
\ }
" Plugin key-mappings.
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return neocomplcache#smart_close_popup() . "\<CR>"
endfunction
" <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()
" autopep8 setting
" original http://stackoverflow.com/questions/12374200/using-uncrustify-with-vim/15513829#15513829
function! Preserve(command)
" Save the last search.
let search = @/
" Save the current cursor position.
let cursor_position = getpos('.')
" Save the current window position.
normal! H
let window_position = getpos('.')
call setpos('.', cursor_position)
" Execute the command.
execute a:command
" Restore the last search.
let @/ = search
" Restore the previous window position.
call setpos('.', window_position)
normal! zt
" Restore the previous cursor position.
call setpos('.', cursor_position)
endfunction
function! Autopep8()
call Preserve(':silent %!autopep8 -')
endfunction
" Shift + F で自動修正
autocmd FileType python nnoremap <S-f> :call Autopep8()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment