Skip to content

Instantly share code, notes, and snippets.

@simics-ja
Last active June 18, 2021 17:26
Show Gist options
  • Save simics-ja/41e549ab5343fb1db7c7d55c54c21d5d to your computer and use it in GitHub Desktop.
Save simics-ja/41e549ab5343fb1db7c7d55c54c21d5d to your computer and use it in GitHub Desktop.
[vim config] #vim #config
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-default branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'
" Initialize plugin system
call plug#end()
set number " 行番号
set cursorline " 行番号のハイライト
syntax enable " シンタックスハイライト
set hlsearch " 検索結果のハイライト
set incsearch " インクリメンタルサーチ
set smartindent " 自動インデント
set clipboard+=unnamed " クリップボード
set laststatus=2 " ステータスラインの表示
set wildmenu " ステータスラインにコマンドラインの候補を表示
" インデントのスペース化
set expandtab
set tabstop=2
set shiftwidth=2
" 入力モードでのカーソル移動
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-h> <Left>
inoremap <C-l> <Right>
" jjでエスケープ
inoremap <silent> jj <ESC>
" 日本語入力で”っj”と入力してもEnterキーで確定させればインサートモードを抜ける
inoremap <silent> っj <ESC>
inoremap <silent> っj <ESC>
" ESCで日本語入力から抜けて半角英数入力に
function! Fcitx2en()
let s:input_status = system("fcitx-remote")
if s:input_status == 2
let l:a = system("fcitx-remote -c")
endif
endfunction
set ttimeoutlen=150
autocmd InsertLeave * call Fcitx2en()
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'jistr/vim-nerdtree-tabs'
Plug 'tpope/vim-commentary'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive'
call plug#end()
" plugin settings
" scrooloose/nerdtree
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") && v:this_session == "" | NERDTree | endif
" autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" let g:nerdtree_tabs_open_on_console_startup=1
" let NERDTreeShowHidden = 1
autocmd vimenter * NERDTreeToggle
autocmd vimenter * NERDTreeTabsToggle
autocmd vimenter * NERDTreeTabsToggle
" 'vim-airline/vim-airline'
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme = 'papercolor'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
"左側に使用されるセパレータ
let g:airline_left_sep = '⮀'
let g:airline_left_alt_sep = '⮁'
"右側に使用されるセパレータ
let g:airline_right_alt_sep = '⮃'
let g:airline_symbols.crypt = '🔒' "暗号化されたファイル
let g:airline_symbols.branch = '' "gitブランチ
let g:airline_symbols.whitespace = 'Ξ' "空白の警告(余分な空白など)
let g:airline#extensions#branch#enabled = 1
" General
set number
set clipboard=unnamed
set linebreak
set showbreak=+++
set textwidth=100
set showmatch
set visualbell
set hlsearch
set smartcase
set ignorecase
set incsearch
set autoindent
set shiftwidth=2
set smartindent
set smarttab
set softtabstop=4
" Advanced
set ruler
set undolevels=1000
set backspace=indent,eol,start
" Key map
" plugin settings
nnoremap <silent><C-n> :NERDTreeTabsToggle<CR>
nnoremap <silent><C-e> :NERDTreeFocusToggle<CR>
" General
" move cursor in insert mode
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-h> <Left>
inoremap <C-l> <Right>
" inline move
nnoremap <Down> gj
nnoremap <Up> gk
" escape alternative > jj
inoremap <silent> jj <ESC>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment