1. 程式人生 > 其它 >ideavim外掛配置檔案

ideavim外掛配置檔案

ideavim外掛配置


set scrolloff=3 " 3 lines above/below cursor when scrolling
" 突出顯示當前行
set cursorline
" 在狀態列顯示正在輸入的命令
set showcmd
" Emulated Plugins
set surround
" Use Idea to join lines smartly
set ideajoin
" Multiple cursors support
set multiple-cursors
" Vim 的預設暫存器和系統剪貼簿共享
set clipboard+=unnamed
set history=100000
" select模式下複製
if has("clipboard")
    vnoremap <C-C> "+y
endif

" 修改leader鍵
let mapleader = ' '
imap ,. <Esc>
vmap ,. <Esc>


" 設定文內智慧搜尋提示
" 高亮search命中的文字
set hlsearch
" 開啟增量搜尋模式,隨著鍵入即時搜尋
set incsearch
" 搜尋時忽略大小寫
set ignorecase
" 有一個或以上大寫字母時仍大小寫敏感
set smartcase
" 去掉搜尋高亮
nnoremap <leader>/ :nohls<CR>
" clear the highlighted search result
nnoremap <Leader>sc :nohlsearch<CR>


" These create newlines like o and O but stay in normal mode
nmap zj o<Esc>k
nmap zk O<Esc>j


" key bindings for quickly movign between windows 
" h left, l right, k up, j down
nmap <leader>h <c-w>h
nmap <leader>l <c-w>l
nmap <leader>k <c-w>k
nmap <leader>j <c-w>j

" Move half page faster
nnoremap <leader>d  <C-d>
nnoremap <leader>u  <C-u>
" Tab operation
nnoremap tn gt
nnoremap tp gT
" Closing tabs
nmap tx :action CloseContent<cr>
nmap tX :action ReopenClosedTab<cr>


" Move to the start of line
nnoremap H ^

" Move to the end of line
nnoremap L $

" Redo
nnoremap U <C-r>

" Yank to the end of line
nnoremap Y y$

nmap <leader>b :action Back<cr>
nmap <leader>f :action Forward<cr>
nmap <leader>c :action GotoClass<cr>
nmap <leader>sp  :action FileStructurePopup<cr>
nmap <leader>ed :action ShowErrorDescription<cr>
nmap == :action ReformatCode<cr>

" Switches between .cc and .h file!
nmap <leader>s :action GotoRelated<cr>

" Won't work in visual mode (with vmap) for some reason.
" Use default map of <c-/> for that.
nmap gcc :action CommentByLineComment<cr>
nmap ;; :action CommentByLineComment<cr>
nmap gzz :action CommentByBlockComment<CR>

" Terminal
nmap <leader>T :action ActivateTerminalToolWindow<cr>    


" Errors
nmap <leader>q :action GotoNextError<cr>
nmap <leader>Q :action GotoPreviousError<cr>


" 對映到idea快捷鍵
" 彈出輸入框,可以跳到指定類
nnoremap <Space>gc :action GotoClass<CR>
" 彈出輸入框,跳轉到指定操作
nnoremap <Space>ga :action GotoAction<CR>
" 跳轉到定義
nnoremap <Space>gd :action GotoDeclaration<CR>
" 跳轉到實現
nnoremap <Space>gi :action GotoImplementation<CR>
" 跳轉到指定的檔案
nnoremap <Space>gf :action GotoFile<CR>
" 跳轉到方法的宣告
nnoremap <Space>gs :action GotoSuperMethod<CR>
" 跳轉到測試
nnoremap <Space>gt :action GotoTest<CR>
" 跳轉到變數的宣告
nnoremap <Space>gS :action GotoSymbol<CR>

nnoremap <Leader>oi :action OptimizeImports<CR>


" 查詢使用
nnoremap <Space>fu :action FindUsages<CR>
" 顯示使用
nnoremap <Space>su :action ShowUsages<CR>
nnoremap  fsp :action FileStructurePopup<CR>
nnoremap <Leader>fp :action ShowFilePath<CR>
nnoremap <Leader>re :action RenameElement<CR>
nnoremap <Leader>rf :action RenameFile<CR>
nnoremap <Leader>se :action SearchEverywhere<CR>

nnoremap <Leader>su :action ShowUsages<CR>
nnoremap <Leader>pm :action ShowPopupMenu<CR>
nnoremap <Leader>tc :action CloseActiveTab<CR>
nnoremap <leader>th :action TypeHierarchy<CR>
nnoremap wt :action ActiveToolwindowGroup<CR>
nnoremap wj :action ActivateStructureToolWindow<CR>
nnoremap fip :action FindInPath<CR>
nnoremap <leader>nc :action NewClass<CR>
nnoremap <leader>np :action NewProject<CR>
nnoremap <leader>nm :action NewModule<CR>
nnoremap <leader>nf :action NewFile<CR>








" 前進,相當似於eclipse中的alt+方向右鍵
nnoremap gf :action Forward<CR>
" 後退,相當於eclipse中的alt+方向左鍵
nnoremap gb :action Back<CR>

" gh=go head, 對映vim中的^
nnoremap gh ^
" gl=go last,對映vim中的$
nnoremap gl $

" Window operation
nnoremap <Space>ww <C-W>w
nnoremap <Space>wc <C-W>c
nnoremap <Space>wj <C-W>j
nnoremap <Space>wk <C-W>k
nnoremap <Space>wh <C-W>h
nnoremap <Space>wl <C-W>l
nnoremap <Space>ws <C-W>s
nnoremap <Space>w- <C-W>-
nnoremap <Space>w+ <C-W>+
nnoremap <Space>w= <C-W>=

nnoremap <Space>wv <C-W>vf