" __ ___ _ ___ " / |/ /_ _| | / (_)___ ___ __________ " / /|_/ / / / / | / / / __ `__ \/ ___/ ___/ " / / / / /_/ /| |/ / / / / / / / / / /__ " /_/ /_/\__, / |___/_/_/ /_/ /_/_/ \___/ " /____/ " //////////////////////////////////////////////////////////////////////// " Encoding set encoding=utf-8 scriptencoding utf-8 " Desable sound set belloff=all " Docs ----------------------------------- {{{ " helpの言語を日本語に set helplang=ja,en " }}} " File ----------------------------------- {{{ "set nobackup "set noswapfile "set noundofile set autoread set hidden " }}} " Key bindings --------------------------- {{{ Leader " let mapleader = '\' map " Normal mode nnoremap H ^ nnoremap L $ nnoremap J nnoremap K " Not save noname register with `x` and `s` command nnoremap x "_x "nnoremap s "_s " Insert mode " BackSpace set backspace=indent,eol,start inoremap jj inoremap inoremap inoremap inoremap inoremap inoremap inoremap inoremap inoremap inoremap :set nohlsearch! " Brackets nnoremap % vnoremap % "inoremap { {} "inoremap {} {} "inoremap { {}O "inoremap ' '' "inoremap '' '' "inoremap "" "" "inoremap () () " Replace nnoremap :%s___cg " Window --------------------------------- {{{ "let g:window_leader_key = 's' nnoremap s " Move nnoremap sh h nnoremap sj j nnoremap sk k nnoremap sl l nnoremap sH H nnoremap sJ J nnoremap sK K nnoremap sL L " Resize nnoremap 2+ nnoremap 2- nnoremap 10< nnoremap 10> nnoremap ss nnoremap s+ 2+ nnoremap s- 2- nnoremap s= = nnoremap s< 5< nnoremap s> 5> " }}} " New buffer nnoremap sn :new nnoremap se :edit nnoremap sE :tabedit " Tab nnoremap st :tabnew nnoremap :tabnext nnoremap :tabprevious nnoremap s[ :tabprevious nnoremap s] :tabnext nnoremap s{ :tabmove - nnoremap s} :tabmove + nnoremap s0 :tablast nnoremap s1 :tabnext1 nnoremap s2 :tabnext2 nnoremap s3 :tabnext3 nnoremap s4 :tabnext4 nnoremap s5 :tabnext5 nnoremap s6 :tabnext6 nnoremap s7 :tabnext7 nnoremap s8 :tabnext8 nnoremap s9 :tabnext9 " To command mode nnoremap w :w nnoremap ; : nnoremap s; : nnoremap s: : nnoremap sx :! nnoremap sX :read! " nnoremap s_ :hide " Write nnoremap sw :w nnoremap sW :wq " Quit/Close nnoremap sq :quit nnoremap sQ :quit! nnoremap sc :close nnoremap sC :close! nnoremap so :only " Buffer "nnoremap sb :buffer "nnoremap sB :ls "nnoremap s. :bnext "nnoremap s, :bprev " Clipboards nnoremap sa :append! nnoremap si :insert! " Yank/Cut/Paste nmap Y "+y nnoremap YY "+yy nnoremap sy "+y nnoremap sd "+d nnoremap sp "+gp nnoremap sP "+gP vmap y "+y vmap Y "+y vmap d "+d vmap p "+gp vmap P "+gP " Other commands " nnoremap s/ :%s///cg nnoremap sr :read! nnoremap sT :terminal nnoremap sN :setlocal relativenumber! nnoremap s? :help nnoremap sf :set filetype= " Vimrc " nnoremap sR :source $MYVIMRC " nnoremap sV :edit $MYVIMRC " Split nnoremap sS :new nnoremap sv :vnew " " Scroll nnoremap J nnoremap K nnoremap nnoremap " nnoremap " nnoremap set scrolloff=5 " EX mode(Q) <-> Format the lines(gq) nnoremap Q gq nnoremap gQ Q " }}} " Indent --------------------------------- {{{ set tabstop=4 set shiftwidth=4 set expandtab set autoindent set list listchars=tab:\|\_,trail:→,eol:↲,extends:»,precedes:«,nbsp:% " }}} " Number --------------------------------- {{{ set number set norelativenumber " }}} " Search --------------------------------- {{{ set incsearch " set smartcase set ignorecase set hlsearch " Toggle highlight search nnoremap :set nohlsearch! " Redraw console and toggle highlight search nnoremap :set nohlsearch! " Search from clipboard text nnoremap g/ /\V=join(map(getreg(v:register,1,1),{k,v->escape(v,'\/')}),'\n') " }}} " Appearance----------------------------- {{{ set nocursorcolumn set cursorline " Always show tabline set showtabline=2 " Empty space at the bottom at gVim " }}} " Command Mode -------------------------- {{{ set wildmenu " Emacs/readline like bindings cnoremap cnoremap cnoremap cnoremap cnoremap " }}} " Visual Mode -------------------------- {{{ " vv -> visual select to line end vnoremap v $h vnoremap > >gv vnoremap < tnoremap " }}} " Dein Scripts ======================================================== {{{ if &compatible set nocompatible " Be iMproved endif " Required: set runtimepath+=$HOME/.cache/dein/repos/github.com/Shougo/dein.vim " Required: if dein#load_state('$HOME/.cache/dein') call dein#begin('$HOME/.cache/dein') " Let dein manage dein " Required: call dein#add('$HOME/.cache/dein/repos/github.com/Shougo/dein.vim') " Add or remove your plugins here: ===================================== " {{{ " Docs call dein#add('vim-jp/vimdoc-ja') " Colorscheme call dein#add('cocopon/iceberg.vim') call dein#add('arcticicestudio/nord-vim') call dein#add('altercation/vim-colors-solarized') call dein#add('fcpg/vim-orbital') call dein#add('morhetz/gruvbox') " Color preview " call dein#add('gorodinskiy/vim-coloresque') " Status Line call dein#add('itchyny/lightline.vim') call dein#add('gkeep/iceberg-dark') " Text Edit call dein#add('tpope/vim-surround') " Move cursor quickly call dein#add('easymotion/vim-easymotion') " Interface "call dein#add('Shougo/unite.vim') " call dein#add('junegunn/fzf.vim') call dein#add('ctrlpvim/ctrlp.vim') call dein#add('mattn/ctrlp-ghq') " File Manager "call dein#add('preservim/nerdtree') call dein#add('lambdalisue/fern.vim') " call dein#add('Shougo/defx.nvim') " if !has('nvim') " call dein#add('roxma/nvim-yarp') " call dein#add('roxma/vim-hug-neovim-rpc') " endif " i3-wm call dein#add('mboughaba/i3config.vim') " Python call dein#add('davidhalter/jedi-vim') " Go call dein#add('fatih/vim-go') " bash call dein#add('itspriddle/vim-shellcheck') call dein#add('z0mbix/vim-shfmt') " fish call dein#add('dag/vim-fish') " PowerShell call dein#add('zigford/vim-powershell') " Complete call dein#add('Shougo/deoplete.nvim') " Auto close brackets call dein#add('cohama/lexima.vim') " Git call dein#add('lambdalisue/gina.vim') " Translate call dein#add('koron/codic-vim') " HTML/CSS call dein#add('mattn/emmet-vim') " }}} " ====================================================================== " You can specify revision/branch/tag. call dein#add('Shougo/deol.nvim', { 'rev': '01203d4c9' }) " Required: call dein#end() call dein#save_state() endif " Required: filetype plugin indent on syntax enable " If you want to install not installed plugins on startup. if dein#check_install() call dein#install() endif " End Dein Scripts ======================================================== " }}} " Dein ----------------------------------- {{{ cabbrev dinstall call dein#install() cabbrev dupdate call dein#update() " }}} " Lightline ------------------------------ {{{ set laststatus=2 set noshowmode let g:lightline = { \ 'colorscheme': 'icebergDark', \ 'component': { \ 'lineinfo': ' %3l:%-2v', \ }, \ 'component_function': { \ 'readonly': 'LightlineReadonly', \ 'fugitive': 'LightlineFugitive' \ }, \ 'separator': { 'left': '', 'right': '' }, \ 'subseparator': { 'left': '', 'right': '' } \ } function! LightlineReadonly() return &readonly ? '' : '' endfunction function! LightlineFugitive() if exists('*FugitiveHead') let branch = FugitiveHead() return branch !=# '' ? ''.branch : '' endif return '' endfunction " }}} " Appearance ----------------------------- {{{ " Colorsceme colorscheme iceberg set background=dark if has('gui_running') " Fullscreen "autocmd GUIEnter * simalt ~x " Hide GUI elements set guioptions-=T set guioptions-=l set guioptions-=r set guioptions-=L set guioptions-=R set guioptions-=m set guioptions-=e " Window size set lines=40 set columns=150 " GUI fonts if has('win32') || has('win64') "set guifont=HackGen\ Console\ for\ Powerline:h12:cDEFAULT set guifont=HackGenNerd:h12:cDEFAULT elseif has('unix') "set guifont=HackGenNerd\ 10 "set guifontwide=HackGenNerd\ 10 set guifont=Sarasa\ Term\ J\ 11 set guifontwide=Sarasa\ Term\ J\ 11 endif " set ambiwidth=double set cursorline set guiheadroom=0 else colorscheme iceberg autocmd ColorScheme * highlight Normal ctermbg=none autocmd ColorScheme * highlight LineNr ctermbg=none endif " }}} " NERDTree --------------------------------- {{{ " nnoremap t :NERDTreeToggle " }}} " Fern ------------------------------------ {{{ nnoremap f :Fern . nnoremap t :Fern . -drawer -toggle -reveral=% " }}} " gina.vim ------------------------------------ {{{ nnoremap gs :Gina status nnoremap gc :Gina commit nnoremap gd :Gina diff nnoremap gl :Gina log nnoremap gp :Gina push nnoremap gh :Gina show cabbrev gstatus Ginastatus cabbrev gcommit Ginacommit cabbrev glog Ginalog cabbrev ggrep Ginagrep cabbrev gls Ginals cabbrev gdiff Ginadiff cabbrev gshow Ginashow " }}} " ctrlp.vim nnoremap cb :CtrlPBuffer nnoremap sb :CtrlPBuffer nnoremap cg :CtrlPGhq nnoremap cr :CtrlPRoot nnoremap cm :CtrlPMRU nnoremap sm :CtrlPMRU nnoremap cl :CtrlPLastMode " surround.vim ---------------------------- {{{ nmap S ys " }}} " vim-go ---------------------------- {{{ let g:go_highlight_types = 1 let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 let g:go_highlight_operators = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_build_constraints = 1 let g:go_textobj_enabled = 1 let g:go_auto_type_info = 1 " :GoInfo let g:go_auto_sameids = 0 " :GoSameIds let g:go_def_mode='gopls' let g:go_info_mode='gopls' let g:go_list_type = "quickfix" let g:go_fmt_command = "goimports" let g:syntastic_go_checkers = ['go', 'golint', 'govet', 'errcheck'] " type :A in normal mode autocmd Filetype go command! -bang A call go#alternate#Switch(0, 'edit') autocmd Filetype go command! -bang AV call go#alternate#Switch(0, 'vsplit') autocmd Filetype go command! -bang AS call go#alternate#Switch(0, 'split') autocmd Filetype go command! -bang AT call go#alternate#Switch(0, 'tabe') autocmd Filetype go command! -bang GD execute ":GoDecls" autocmd Filetype go command! -bang GDD execute ":GoDeclsDir" " :GoInfo " :GoImplements " :GoDescribe " :GoWhicherrs " :GoChannelPeers " :GoCallers " :GoRename setlocal omnifunc=go#complete#Complete " }}} " Unite ------------------------------------ {{{ " TODO: fix more good keybindings " nnoremap ub :Unitebuffer " nnoremap uc :Unitecommand " nnoremap ud :Unitedein " nnoremap ff :Unitefile " nnoremap fn :Unitefile/new " nnoremap uj :Unitejump " nnoremap ul :Unitelauncher " nnoremap ur :Uniteregister " nnoremap us :Unitesource " }}} " " i3-config.vim ------------------------------ {{{ augroup i3config_ft_detection autocmd! autocmd BufNewFile,BufRead ~/.config/i3/config set filetype=i3config augroup end " }}} " Rofi config file syntax " autocmd BufNewFile,BufRead /*.rasi setfiletype css " Auto mkdir " https://vim-jp.org/vim-users-jp/2011/02/20/Hack-202.html augroup vimrc-auto-mkdir " {{{ autocmd! autocmd BufWritePre * call s:auto_mkdir(expand(':p:h'), v:cmdbang) function! s:auto_mkdir(dir, force) " {{{ if !isdirectory(a:dir) && (a:force || \ input(printf('"%s" does not exist. Create? [y/N]', a:dir)) =~? '^y\%[es]$') call mkdir(iconv(a:dir, &encoding, &termencoding), 'p') endif endfunction " }}} augroup END " }}} " End of Vimrc ///////////////////////////////////////////////////////////