syntax enable filetype plugin indent on if has('gui_running') set guioptions-=tT set guioptions-=m set guioptions-=rL set guioptions-=e set guifont=Cica\ 14 else let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" if has('vim_starting') " 挿入モード時に非点滅の縦棒タイプのカーソル let &t_SI .= "\e[6 q" " ノーマルモード時に非点滅のブロックタイプのカーソル let &t_EI .= "\e[2 q" " 置換モード時に非点滅の下線タイプのカーソル let &t_SR .= "\e[4 q" endif endif augroup MyAutoCmd autocmd! augroup END " netrw settings let g:netrw_preview=1 autocmd MyAutoCmd FileType netrw call s:netrw_my_settings() function! s:netrw_my_settings() nmap l nmap h - endfunction nnoremap d (&filetype=='vim') ? ':w :source %' : ':wa' set title set updatetime=500 set hidden set laststatus=2 set signcolumn=yes set backspace=indent,eol,start set expandtab set tabstop=2 set shiftwidth=0 set smartindent set wildmenu set incsearch set hlsearch set termguicolors set clipboard=unnamedplus set ignorecase set smartcase set showmatch set matchpairs+=<:> set completeopt-=preview set splitright set helplang=en,ja language en_US.utf8 if filereadable(expand('/usr/share/dict/words')) set dictionary=/usr/share/dict/words endif if exists('&inccommand') set inccommand=nosplit endif if exists('&pumblend') set pumblend=30 endif if exists('&winblend') set winblend=10 endif " Don't show too many items set pumheight=15 set mouse=nv inoremap jj nnoremap m wa make nnoremap h nnoremap j nnoremap k nnoremap l " resize window using arrow key nnoremap (win_screenpos(win_getid())[0] < 3) ? \":wincmd -" : ":wincmd +" nnoremap (win_screenpos(win_getid())[0] < 3) ? \":wincmd +" : ":wincmd -" nnoremap (win_screenpos(win_getid())[1] < 3) ? \":wincmd >" : ":wincmd <" nnoremap (win_screenpos(win_getid())[1] < 3) ? \":wincmd <" : ":wincmd >" nnoremap (win_screenpos(win_getid())[0] < 3) ? \":5wincmd -" : ":5wincmd +" nnoremap (win_screenpos(win_getid())[0] < 3) ? \":5wincmd +" : ":5wincmd -" nnoremap (win_screenpos(win_getid())[1] < 3) ? \":10wincmd >" : ":10wincmd <" nnoremap (win_screenpos(win_getid())[1] < 3) ? \":10wincmd <" : ":10wincmd >" nnoremap ; : xnoremap ; : " move around tabpages nnoremap gT nnoremap gt nnoremap tabmove - nnoremap tabmove + nnoremap t tabe " stop highlighting for search nnoremap nohlsearch " improved G nnoremap G Gzz7 "change local directory nnoremap cd tcd %:h " viml formatting function! s:format_viml() let tmp = winsaveview() normal! ggVG= call winrestview(tmp) endfunction nnoremap f call format_viml() " from nelstrom/vim-visual-star-search function! s:VSetSearch(cmdtype) let temp = @" norm! y let @/ = '\V' . substitute(escape(@", a:cmdtype.'\'), '\n', '\\n', 'g') let @" = temp endfunction xnoremap * call VSetSearch('/')/=@/ xnoremap # call VSetSearch('?')?=@/ nnoremap j gj nnoremap k gk xnoremap j gj xnoremap k gk " for repeating indentation xnoremap > >call improved_indent()gv xnoremap < <call improved_indent()gv function! s:improved_indent() augroup my_indent autocmd cursormoved * call s:exit_indent_mode() augroup END let s:moved = v:false endfunction function! s:exit_indent_mode() if s:moved execute "normal! \" autocmd! my_indent let s:moved = v:false else let s:moved = v:true endif endfunction " insert parent directory of current file cnoremap %% getcmdtype() == ':' ? expand('%:p:h').'/' : '%%' cnoremap cnoremap cnoremap cnoremap cnoremap * cnoremap cnoremap