Skip to content

Commit

Permalink
fix .vimrc
Browse files Browse the repository at this point in the history
  • Loading branch information
cning112 committed Jul 1, 2024
1 parent 319b901 commit 55e0c39
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 49 deletions.
12 changes: 0 additions & 12 deletions .common_vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,5 @@ set smartindent " 智能缩进
" 设置 leader 键,例如将 \ 设置为 ,
let mapleader = ","

" EasyMotion 配置
" move to any 2 characters within the current line
map <Leader>s <Plug>(easymotion-s2)
" move to any word within the current file
map <Leader>w <Plug>(easymotion-w)
" move to any character within the current file
map <Leader>f <Plug>(easymotion-f)
" move to the beginning of a line within the current file
map <Leader>l <Plug>(easymotion-lineforward)
" move to the beginning of a line backward within the current file
map <Leader>h <Plug>(easymotion-linebackward)


" 其他通用配置...
38 changes: 4 additions & 34 deletions .ideavimrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
" IdeaVim 专用配置

" 加载通用配置文件
if filereadable(expand("~/.common_vimrc"))
source ~/.common_vimrc
endif

" 由IDE处理快捷键
sethandler i:ide

source ~/.common_vimrc

" Refer to https://gist.github.com/AlexPl292/50a3ff4cef1badcbb23436b22cbd3cf4
""" Plugins --------------------------------
set easymotion
set surround
set multiple-cursors
set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister
set exchange
Expand All @@ -25,33 +19,9 @@ Plug 'machakann/vim-highlightedyank'
""" Plugin settings -------------------------
let g:argtextobj_pairs="[:],(:),<:>"

" <C-n> seems to me as a better solution than <M-n>,
" but we should finally support vim-visual-multi because vim-multiple-cursors is deprecated now
map <C-n> <Plug>NextWholeOccurrence

""" Idea specific settings ------------------
set ideajoin
set ideastatusicon=gray

""" My Mappings -----------------------------
map <leader>r <Action>(RenameElement)

" Reformat the current line only
map <leader>l V<Action>(ReformatCode)

map <leader>b <Action>(ToggleLineBreakpoint)
map <leader>o <Action>(FileStructurePopup)

map <leader>J Ji <ESC>

" Just makes me nervous
map H h

" Toggle case and start typing. E.g. `<leader>iget`: `property` -> `getProperty`
map <leader>i ~hi
" Remove selection and toggle case. E.g. `v2l<leader>u`: `getProperty` -> `property`
vmap <leader>u d~h

" I think it's a better solution
map U <C-R>

" 由IDE处理快捷键
sethandler i:ide
14 changes: 11 additions & 3 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ endif

" 使用 vim-plug 管理插件
call plug#begin('~/.vim/plugged')

" 安装 surround 插件
Plug 'tpope/vim-surround'

" 安装 easymotion 插件
Plug 'easymotion/vim-easymotion'

call plug#end()


" EasyMotion 配置
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
" These `n` & `N` mappings are options. You do not have to map `n` & `N` to EasyMotion.
" Without these mappings, `n` & `N` works fine. (These mappings just provide
" different highlight method and have some other features )
map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)

0 comments on commit 55e0c39

Please sign in to comment.