Skip to content

Instantly share code, notes, and snippets.

@YuanLiou
Last active January 11, 2025 02:03
Show Gist options
  • Save YuanLiou/60b10105b97145cf63dc2955507a8fcf to your computer and use it in GitHub Desktop.
Save YuanLiou/60b10105b97145cf63dc2955507a8fcf to your computer and use it in GitHub Desktop.
Ray's Ideavim Settings 1.6
let mapleader = "\<space>"
" set clipboard=unnamed
" set clipboard=unnamedplus
" set clipboard=unnamed,unnamedplus
" Plugins
set highlightedyank
set NERDTree
set surround
set peekaboo
set quickscope
" 標記關鍵字。
set hls
" 顯示行號。
set number
" 顯示相對行號。
set relativenumber
" 搜尋不分大小寫。
set ic
" 捲動時保留底下 5 行。
set scrolloff=5
" 關閉嗶嗶聲
set visualbell
set noerrorbells
let g:highlightedyank_highlight_color = "rgba(252, 186, 3, 155)"
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] " For quickscope
" Custom mapping
nnoremap <leader>hrr :source ~/.ideavimrc<CR>
nnoremap <leader>l1 :set number relativenumber<CR>
nnoremap <leader>l2 :set number norelativenumber<CR>
nnoremap <leader>. :action GotoFile<CR>
nnoremap <leader>s :action SaveAll<CR>
nnoremap <leader>a :action ToggleBookmark<CR>
nnoremap <leader>wv :action SplitVertically<CR>
nnoremap <leader>ws :action SplitHorizontally<CR>
nnoremap <leader>wc :action Unsplit<CR>
nnoremap <leader>ww :action NextSplitter<CR>
nnoremap <leader>fr :action RecentFiles<CR>
nnoremap <leader>rr :action Refresh<CR>
nnoremap <leader>q :action KJumpAction.Word1<cr>
nnoremap <leader>i :action Generate<cr>
nnoremap <leader>/ :action ShowErrorDescription<cr>
nnoremap <leader>g :action Git.Menu<cr>
nnoremap <leader>e :action RecentFiles<cr>
nnoremap <leader>b :action Git.Branches<cr>
map <Leader>pf <action>(com.mituuz.fuzzier.Fuzzier)
map <Leader>mf <action>(com.mituuz.fuzzier.FuzzyMover)
map <Leader>gf <action>(com.mituuz.fuzzier.FuzzierVCS)
map <Leader>; <action>(flash.search)
" Press * to search for the term under the cursor or a visual selection and
" then press a key below to replace all instances of it in the current file.
nnoremap <Leader>r :%s///g<Left><Left>
nnoremap <Leader>rc :%s///gc<Left><Left><Left>
" The same as above but instead of acting on the whole file it will be
" restricted to the previously visually selected range. You can do that by
" pressing *, visually selecting the range you want it to apply to and then
" press a key below to replace all instances of it in the current selection.
xnoremap <Leader>r :s///g<Left><Left>
xnoremap <Leader>rc :s///gc<Left><Left><Left>
" Cut, Copy and Paste
noremap <Leader><Leader>x "*x
noremap <Leader><Leader>y "*y
noremap <Leader><Leader>p "*p
noremap <Leader><Leader>P "*P
noremap <Leader>x "+x
noremap <Leader>y "+y
noremap <Leader>p "+p
noremap <Leader>P "+P
xnoremap <Leader><Leader>x "*x
xnoremap <Leader><Leader>y "*y
xnoremap <Leader><Leader>p "*p
xnoremap <Leader><Leader>P "*P
xnoremap <Leader>y "+y
xnoremap <Leader>x "+x
xnoremap <Leader>p "+p
" Paste without cleanup paste buffer (paste register
xnoremap <leader>P "\"_dP"
" Fix cursor position to center when doing page jumping
nnoremap <C-d> <C-d>zz<CR>
nnoremap <C-u> <C-u>zz<CR>
" Delete a word backwards
nnoremap <leader>dw vb_d<CR>
" Select all
nnoremap <leader><leader>a gg<S-v>G<CR>
" Nerd Tree
let g:NERDTreeMapActivateNode='l'
let g:NERDTreeMapJumpParent='h'
" Surround
vmap s S
" Remove Search Highlight
nnoremap <silent> <cr> :noh<cr><cr>
" set clipboard+=ideaput
set ideajoin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment