-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ideavimrc
111 lines (93 loc) · 3.04 KB
/
.ideavimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
" .ideavimrc is a configuration file for IdeaVim plugin. It uses
" the same commands as the original .vimrc configuration.
" You can find a list of commands here: https://jb.gg/h38q75
" Find more examples here: https://jb.gg/share-ideavimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
set relativenumber
" Do incremental searching.
set incsearch
set hlsearch
set smartcase
set ignorecase
" allow to hold down keypress and repeat it
defaults write -g ApplePressAndHoldEnabled 0
" Which key
set which-key
set timeoutlen=5000
set showmode
set showcmd
set visualbell
set clipboard+=unnamed
""" Plugin setup
" enable nerdtree, plugin to navigate files using vim
set NERDtree
set ideajoin
set surround
" Don't use Ex mode, use Q for formatting.
map Q gq
" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins
" Highlight copied text
Plug 'machakann/vim-highlightedyank'
" Commentary plugin
Plug 'tpope/vim-commentary'
Plug 'preservim/nerdtree'
Plug 'tpope/vim-surround'
"" The leader key
let mapleader = " "
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
map <leader>f <Action>(ReformatCode)
"" Map <leader>d to start debug
"map <leader>d <Action>(Debug)
" Map \b to toggle the breakpoint on the current line
"map \b <Action>(ToggleLineBreakpoint)
" Tab navigation
nnoremap <A-n> :tabnext<CR>
nnoremap <A-p> :tabprev<CR>\
" Refactoring
map <leader>rn <Action>(RenameElement)
map <leader>ra <Action>(Refactorings.QuickListPopupAction)
" Not really the best mappings as you need to constantly perform the motion
" however the c-w= seems useful.
nmap <C-w>= <Action>(MaximizeEditorInSplit)
nmap <C-w><Down> <Action>(StretchSplitToBottom)
nmap <C-w><Left> <Action>(StretchSplitToLeft)
nmap <C-w><Right> <Action>(StretchSplitToRight)
nmap <C-w><Up> <Action>(StretchSplitToTop)
""" Navigation
map <leader>wu <Action>(Unsplit)
""" LSP Code like.
nmap <leader>gd <Action>(GotoDeclaration)
nmap <leader>gy <Action>(GotoTypeDeclaration)
nmap <leader>gI <Action>(GotoImplementation)
nmap <leader>gr <Action>(ShowUsages)
nmap <leader>ds <Action>(FileStructurePopup)
" custom LSP-like
nmap <leader>gt <Action>(GotoTest)
nmap <leader>gf <Action>(Forward)
nmap <leader>gb <Action>(Back)
" a.k.a workspace symbols
map <leader>ws <Action>(GotoSymbol)
" Display options
map <leader>dd <Action>(ToggleDistractionFreeMode)
map <leader>dz <Action>(ToggleZenMode)
map <leader>df <Action>(ToggleFullScreen)
" File navigation
" Telescope like functionality. [S]earch
map <leader>sf <Action>(GotoFile)
map <leader>s. <Action>(RecentFiles)
map <leader>sg <Action>(FindInPath)
map <leader><leader> <Action>(RecentFiles)
map <leader>sl <Action>(RecentLocations)
map <leader>sc <Action>(GotoClass)
map <leader>fn <Action>(NewScratchFile)
""" Jump between methods
map [[ <Action>(MethodDown)
map ]] <Action>(MethodUp)
""" other
map <leader>x :NERDTreeToggle<CR>
nnoremap <leader>n :NERDTreeFocus<CR>
map <leader>v <Action>(MoveTabRight)