Skip to content

Instantly share code, notes, and snippets.

@turusuke
Last active January 14, 2019 16:48
Show Gist options
  • Save turusuke/4649d62a1f2d602a0c5ace097cee63a9 to your computer and use it in GitHub Desktop.
Save turusuke/4649d62a1f2d602a0c5ace097cee63a9 to your computer and use it in GitHub Desktop.
" =============================================================
" Global Configuration
" =============================================================
set surround
set multiple-cursors " vim-multiple-cursors と同等の機能を実現する
" =============================================================
" Clipboard
" =============================================================
" クリップボードと yank を同期させる
set clipboard=unnamed,unnamedplus
" ====================================================
" Bookmark
" =============================================================
nnoremap mm :action ToggleBookmark<CR>
nnoremap ma :action ShowBookmarks<CR>
" =============================================================
" Window
" =============================================================
nnoremap <,>s :action SplitHorizontally<CR>
nnoremap <,>v :action SplitVertically<CR>
nnoremap <C-W>j :action VimWindowDown<CR>
nnoremap <C-W>h :action VimWindowLeft<CR>
nnoremap <C-W>l :action VimWindowRight<CR>
nnoremap <C-W>k :action VimWindowUp<CR>
" =============================================================
" Editor control
" =============================================================
" normal mode
" ===============================
nnoremap Y y$ " 行末までコピー
" Reload .ideavimrc
nnoremap <,>r :source ~/.ideavimrc<CR>
nnoremap <Space>o :action GotoFile<CR>
nnoremap <Space>O :action GotoClass<CR>
" j, k による移動を折り返されたテキストでも自然に振る舞うように変更
nnoremap j gj
nnoremap k gk
" 前/次のメソッド定義へジャンプ
nnoremap [m :<C-u>action MethodUp<CR>
nnoremap ]m :<C-u>action MethodDown<CR>
" 現在のファイルの変更箇所(VCS)の前/次へジャンプ
nnoremap [c :<C-u>action VcsShowPrevChangeMarker<CR>
nnoremap ]c :<C-u>action VcsShowNextChangeMarker<CR>
" 変更箇所の前/次へジャンプ
nnoremap [g :<C-u>action JumpToLastChange<CR>
nnoremap ]g :<C-u>action JumpToNextChange<CR>
" エラー箇所の前/次へジャンプ
nnoremap [e :<C-u>action GotoPreviousError<CR>
nnoremap ]e :<C-u>action GotoNextError<CR>
" Refactor
nnoremap <Space>= :<C-u>action ReformatCode<CR>
nnoremap <Space>t :<C-u>action Refactorings.QuickListPopupAction<CR>
nnoremap <Space>p :<C-u>action ReformatWithPrettierAction<CR>
nnoremap <Space>P :<C-u>action ManageRecentProjects<CR>
nnoremap <Space>b :<C-u>action ToggleLineBreakpoint<CR>
nnoremap <Space>e :<C-u>action Javascript.Linters.EsLint.Fix<CR>
" insert mode
" ===============================
"インサートモードで bash 風キーマップ
inoremap <C-a> <C-o>^
inoremap <C-e> <C-o>$<Right>
inoremap <C-u> <C-o>d^
inoremap <C-w> <C-o>db
inoremap jj <esc> "jjでノーマルモード
" Visual mode
" ===============================
vnoremap v ^$h " vv で行末まで選択
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment