Quantcast
Channel: Vimタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 5608

令和になったのでワイのinit.vim晒す

$
0
0

001.jpg

Vim歴3年のCassinと申します。
最近は init.vim 書くのが自分にとって時間の無駄だという考えに至ったので VSCodeを使っています。

今回紹介するコードはここにあります。Unix系の環境で vim-airlineのフォント, vim-plugそして neovimがインストールされていれば ~/.config/nvimにそのまま git cloneして頂ければ
ほぼエラーなしで使用できると思います。

参照先がわからない様々なサイトのコードにお世話になっております。ありがとうございます。

対応している言語

Haskell, C++11, Ruby, Rust, LaTeX, TOML, Markdown, Python3, Rust, Dart

ディレクトリ構造

ディレクトリ構造
~/.config/nvim
          ├── init.vim
          └── init
              ├── color
              │   └── color.init.vim
              ├── main
              │   ├── main.init.vim
              │   ├── nnormap.init.vim
              │   └── othermap.init.vim  
              └── plugin
                  ├── plugin_install.init.vim
                  └── plugin_settings.init.vim

各設定ファイル

init.vim
scriptencoding utf-8

runtime init/main/main.init.vim
runtime init/main/nnormap.init.vim
runtime init/main/othermap.init.vim
runtime init/plugin/plugin_install.init.vim
runtime init/plugin/plugin_settings.init.vim
runtime init/color/color.init.vim
color.init.vim
scriptencoding utf-8

syntax on" 179 : 黄色" 51  : 水色 (少し明るい)" 45  : 水色" 6   : 水色 (少し暗い)" 24  : 水色 (より暗い)" 255 : 白色" 240 : 灰色" color scheme 拡張 " one darkauColorScheme * hi Normal       ctermbg=none
auColorScheme * hi LineNr       ctermbg=none ctermfg=240 cterm=italic " 行番号
auColorScheme * hi StatusLine   ctermbg=none " アクティブなステータスライン
auColorScheme * hi StatusLineNC ctermbg=none " 非アクティブなステータスライン
auColorScheme * hi Comment      ctermfg=243 cterm=italic " コメントアウト
auColorScheme * hi Statement    ctermfg=45auColorScheme * hi DiffAdd      ctermbg=24  " 追加行
auColorScheme * hi Identifier   ctermfg=45 "cterm=boldauColorScheme * hi Haskell01 ctermfg=179 " 黄色
auColorScheme * hi Haskell02 ctermfg=45  " 水色
auColorScheme * hi Haskell03 ctermfg=255 " 白

" スペルチェックau Colorscheme * hi SpellBad ctermfg=46 cterm=none
" キャメルケースチェックauColorScheme * hi SpellCap ctermfg=46 cterm=boldset background=lightcolo onedark
"colo tomorrow"colo hybrid

augroup filetypedetect
  auBufRead,BufNewFile *.hs :call ColHaskell()
augroup END

" Haskell 用のシンタックスハイライトfunction! ColHaskell()auBufWinEnter * letw:m3 = matchadd("Haskell02",'(')auWinEnter    * letw:m3 = matchadd("Haskell02",'(')auBufWinEnter * letw:m3 = matchadd("Haskell02",')')auWinEnter    * letw:m3 = matchadd("Haskell02",')')auBufWinEnter * letw:m3 = matchadd("Haskell02",'$')auWinEnter    * letw:m3 = matchadd("Haskell02",'$')endfunction" 行末スペース、行末タブの表示" highlight TrailingSpaces ctermbg=red guibg=#FF0000" highlight TrailingSpaces ctermbg=blue guibg=#FF0000
highlight TrailingSpaces ctermbg=50 " or 46() or 240(灰色)
highlight Tabs ctermbg=black guibg=8 " guibg=#000000auBufNewFile,BufRead * call matchadd('TrailingSpaces',' \{-1,}$')auBufNewFile,BufRead * call matchadd('Tabs','\t')" 全角スペースの表示
highlight ZenkakuSpace cterm=underline ctermbg=BLUE
auBufWinEnter * letw:m3 = matchadd("ZenkakuSpace",' ')auWinEnter * letw:m3 = matchadd("ZenkakuSpace",' ')
main.init.vim
scriptencoding utf-8set fenc=utf-8set nobackup
setnoswapfileset autoread
set tabstop=2 shiftwidth=2 expandtab
setnumber"set scrolloff=5set scrolloff=10filetype plugin indent on"set laststatus=2"tex ギリシャ文字可視化無効letg:tex_conceal=''" 英語と日本語のスペルチェック z= で修正候補setspellset spelllang=en,cjk

hiclear SpellBad
""hi SpellBad cterm=underlinehiclear SpellCap
""hi SpellCap cterm=underline,bold" remove trailing whitespace" autocmd BufWritePre * :%s/\s\+$//ge
nnormap.init.vim
scriptencoding utf-8" move middle of the current line
nnoremap sm:<C-u>call cursor(0,strlen(getline("."))/2)<CR>" modes short cut
nnoremap s<space>:<C-u>terminal<cr>" 日本語
nnoremap あ a
nnoremap い i" split windows
nnoremap s <Nop>
nnoremap sj <C-w>j
nnoremap sk <C-w>k
nnoremap sl<C-w>l
nnoremap sh<C-w>h
nnoremap sJ <C-w>J
nnoremap sK <C-w>K
nnoremap sL <C-w>L
nnoremap sH <C-w>H
nnoremap sn gt
nnoremap sp gT
nnoremap sr<C-w>r
nnoremap s=<C-w>=
nnoremap sw<C-w>w
nnoremap so<C-w>_<C-w>|
nnoremap sO <C-w>=
nnoremap sN:<C-u>bn<CR>
nnoremap sP :<C-u>bp<CR>
nnoremap st:<C-u>tabnew<CR>
nnoremap sT :<C-u>Unite tab<CR>
nnoremap ss :<C-u>sp<CR>
nnoremap sv:<C-u>vs<CR>
nnoremap sq :<C-u>q<CR>
nnoremap sQ :<C-u>bd<CR>
nnoremap sb:<C-u>Unite buffer_tab -buffer-name=file<CR>
nnoremap sB :<C-u>Unite buffer -buffer-name=file<CR>
othermap.init.vim
scriptencoding utf-8" nerdtree
map <C-n>:NERDTreeToggle<CR>" insert mode
inoremap <silent><C-f><right>
inoremap <silent><C-b><left>" 括弧補完
inoremap (()<left>" 上の例外処理: の後に続けて)を押したとき
inoremap <expr>)  strpart(getline('.'),col('.')-1,1)==")" ? "\<Right>":")"" 括弧補完
inoremap [[]<left>" 上の例外処理: の後に続けて)を押したとき
inoremap <expr>]  strpart(getline('.'),col('.')-1,1)=="]" ? "\<Right>":"]"" quotation補完
inoremap " ""<left>
inoremap ' ''<left>

augroup FolowFile
    autocmd!
    autocmd BufRead,BufNewFile *.c    inoremap {<enter>{}<left><cr><cr><up><tab>
    autocmd BufRead,BufNewFile *.dart inoremap {<enter>{}<left><cr><cr><up><tab>
    autocmd BufRead,BufNewFile *.cpp  inoremap {<enter>{}<left><cr><cr><up><tab>
    autocmd BufRead,BufNewFile *.rs   inoremap {<enter>{}<left><cr><cr><up><tab>
    autocmd BufRead,BufNewFile *.go   inoremap {<enter>{}<left><cr><cr><up><tab>
augroup END

" terminal mode
tnoremap <silent><esc><C-\><C-n>
plugin_install.init.vim
scriptencoding utf-8" update plugins ->" :PlugInstall" :UpdateRemotePluginscall plug#begin()
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'kana/vim-submode'        " resize split windows

" differences
Plug 'brooth/Far.vim'" git
Plug 'tpope/vim-fugitive'" indent guides
Plug 'Yggdroot/indentLine'" colorlise status line" Plug 'itchyny/lightline.vim'" Plug 'Cassin01/neoline.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'" syntastic
Plug 'vim-syntastic/syntastic'" pathogen for syntastic
Plug 'tpope/vim-pathogen'" haskell
Plug 'eagletmt/neco-ghc'                " completion
Plug 'neovimhaskell/haskell-vim'        " syntax
Plug 'dag/vim2hs'                       " syntax, indent

" python3
Plug 'davidhalter/jedi-vim'             " completion

" c++
Plug 'octol/vim-cpp-enhanced-highlight' " syntax highlight
Plug 'justmao945/vim-clang'             " completion

" Ruby
Plug 'vim-ruby/vim-ruby'" Rust
Plug 'rust-lang/rust.vim'              " completion

" Dart
Plug 'dart-lang/dart-vim-plugin'" toml
Plug 'cespare/vim-toml'"markdown"Plug 'godlygeek/tabular'"Plug 'plasticboy/vim-markdown'" :Unite colorscheme -auto-preview
Plug 'Shougo/unite.vim'
Plug 'ujihisa/unite-colorscheme'" colorschemes
Plug 'altercation/vim-colors-solarized'   " solarized
Plug 'croaker/mustang-vim'                " mustang
Plug 'jeffreyiacono/vim-colors-wombat'    " wombat
Plug 'nanotech/jellybeans.vim'            " jellybeans
Plug 'vim-scripts/Lucius'                 " lucius
Plug 'vim-scripts/Zenburn'                " zenburn
Plug 'mrkn/mrkn256.vim'                   " mrkn256
Plug 'jpo/vim-railscasts-theme'           " railscasts
Plug 'therubymug/vim-pyte'                " pyte
Plug 'tomasr/molokai'                     " molokai
Plug 'chriskempson/vim-tomorrow-theme'    " tomorrow night
Plug 'vim-scripts/twilight'               " twilight
Plug 'w0ng/vim-hybrid'                    " hybrid
Plug 'freeo/vim-kalisi'                   " kalisi
Plug 'morhetz/gruvbox'                    " gruvbox
Plug 'toupeira/vim-desertink'             " desertink
Plug 'sjl/badwolf'                        " badwolf
Plug 'itchyny/landscape.vim'              " landscape
Plug 'joshdick/onedark.vim'               " onedark in atom
Plug 'gosukiwi/vim-atom-dark'             " atom-dark
Plug 'liuchengxu/space-vim-dark'          " space-vim-dark-> recommended 'hi Comment cterm=italic'
Plug 'kristijanhusak/vim-hybrid-material' "hybrid_material
Plug 'drewtempelmeyer/palenight.vim'      " palenight

" others
Plug 'scrooloose/nerdtree'
Plug 'Shougo/deoplete.nvim'               " auto completion
call plug#end()
plugin_settings.init.vim
scriptencoding utf-8" indent-guides"let g:indent_guides_enable_on_vim_startup=1 " enable indent-guides let g:indent_guides_guide_size =1letg:indent_guides_start_level=1letg:indent_guides_auto_colors=0 " enable auto colorsletg:indent_guides_exclude_filetypes=['help','nerdtree']
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd   ctermbg=237
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven  ctermbg=237" indentLineletg:indentLine_enabled=0 " disable by default
letg:indentLine_char='⎸'" fugitive.vimset statusline+=%{FugitiveStatusline()}" syntasicset statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}set statusline+=%*
letg:syntastic_always_populate_loc_list=1letg:syntastic_auto_loc_list=1letg:syntastic_check_on_open=1letg:syntastic_check_on_wq=0letg:syntastic_mode_map={      \'mode':'passive',      \'active_filetypes':['c','cpp','python3']      \}letg:syntastic_cpp_compiler='clang++'letg:syntastic_cpp_compiler_options=' -std=c++11 -stdlib=libc++'" submodecall submode#enter_with('bufmove','n','','s>','<C-w>>')call submode#enter_with('bufmove','n','','s<','<C-w><')call submode#enter_with('bufmove','n','','s+','<C-w>+')call submode#enter_with('bufmove','n','','s-','<C-w>-')call submode#map('bufmove','n','','>','<C-w>>')call submode#map('bufmove','n','','<','<C-w><')call submode#map('bufmove','n','','+','<C-w>+')call submode#map('bufmove','n','','-','<C-w>-')" lightline" let g:lightline = {"      \ 'colorscheme': 'onedark',"      \ }" vim-airlineset laststatus=2letg:airline_powerline_fonts=1letg:airline#extensions#tabline#enabled =1letg:airline#extensions#tabline#buffer_idx_mode =1letg:airline#extensions#whitespace#mixed_indent_algo =1"let g:airline_theme = 'tomorrow'if!exists('g:airline_symbols')letg:airline_symbols={}endif" unicode symbolsletg:airline_left_sep='»'letg:airline_left_sep='▶'letg:airline_right_sep='«'letg:airline_right_sep='◀'letg:airline_symbols.crypt ='🔒'letg:airline_symbols.linenr ='☰'letg:airline_symbols.linenr ='␊'letg:airline_symbols.linenr ='␤'letg:airline_symbols.linenr ='¶'letg:airline_symbols.maxlinenr =''letg:airline_symbols.maxlinenr ='㏑'letg:airline_symbols.branch ='⎇'letg:airline_symbols.paste ='ρ'letg:airline_symbols.paste ='Þ'letg:airline_symbols.paste ='∥'letg:airline_symbols.spell='Ꞩ'letg:airline_symbols.notexists ='∄'letg:airline_symbols.whitespace ='Ξ'" powerline symbolsletg:airline_left_sep=''letg:airline_left_alt_sep=''letg:airline_right_sep=''letg:airline_right_alt_sep=''letg:airline_symbols.branch =''letg:airline_symbols.readonly =''letg:airline_symbols.linenr ='☰'letg:airline_symbols.maxlinenr =''"vim-clangletg:clang_c_options='-std=gnu11'letg:clang_cpp_options='-std=c++11 -stdlib=libc++' " c++11" disable auto completion for vim-clangletg:clang_auto=0" deoplate" let g:deoplete#enable_at_startup = 1"------------------------------------------"           -- colorschemes --"------------------------------------------

Viewing all articles
Browse latest Browse all 5608

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>