- Ideavimrc - organized the settings

- vimrc - Moved the plugins into the main file
- vimrc - Organized the settings into logical blocks
- vimrc - Moved the file into .vim/vimrc file
This commit is contained in:
Pratik Tripathy
2023-12-19 14:15:52 +05:30
parent 76bd4806ed
commit 1e97adef39
7 changed files with 236 additions and 200 deletions

View File

@@ -3,10 +3,14 @@
" Examples to map IDE actions to IdeaVim -- https://jb.gg/abva4t
" Enable IdeaVim plugins https://jb.gg/ideavim-plugins
" Source .vimrc
"source ~/.vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set Tabs to 4 characters
set expandtab
set tabstop=4
set shiftwidth=4
" Searches
set hlsearch " highlight search occurrences
set ignorecase " ignore case in search patterns
@@ -14,14 +18,32 @@ set smartcase " no ignore case when pattern is uppercase
set incsearch " show search results while typing
set wrapscan " searches wrap around the end of the file
" common settings
" Common settings
set number " Show current line number
set relativenumber " Show relative line numbers
set gdefault " substitute all occurrences in line
set history=10000 " command line history
set scrolloff=5 sidescrolloff=10 " Keep some line before and after the cursor visible
set clipboard^=unnamed,unnamedplus,ideaput " Copy to and from system clipboard
set nrfomats+=alpha,bin,octal,hex " Useful for auto incrementing
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"keymaps
" Enabled plugins
set ideajoin
Plug 'easymotion/vim-easymotion' " <leader>j or J [2 characters]
Plug 'preservim/nerdtree' " <leader>e
Plug 'tpope/vim-surround' " ys or cs or ds [motion]
Plug 'tpope/vim-commentary' " gc [motion]
Plug 'machakann/vim-highlightedyank'
Plug 'dbakker/vim-paragraph-motion'
Plug 'chrisbra/matchit'
Plug 'tpope/vim-repeat' " Repeat for Surround
" Plug 'terryma/vim-multiple-cursors' " mc (selects), mx (skips), mp (previous)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" To see a list of all available :actions -> :actionlist
" Or select "IdeaVim: Track Action Ids" -> Copy the action id required
" Keymaps
let mapleader = " "
" Don't use Ex mode, use Q for formatting
@@ -36,24 +58,50 @@ map Q gq
nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>zz
" clear search highlighting
" Multiple Cursors
map mc <A-n>
map mx <A-x>
map mp <A-p>
" Clear search highlighting
nnoremap <leader>/ :nohls<return><esc>
" code navigations
nmap <leader>e :action GotoFile<CR>
nmap <leader>a :action FindInPath<CR>
nmap gr :action ShowUsages<CR>
nmap gi :action GotoImplementation<CR>
nmap gs :action GotoSuperMethod<CR>
" Find/Open file
nmap <leader>of :action GotoFile<CR>
nmap <leader>or :action RecentFiles<CR>
" Find/Navigate to different parts of code
nmap <leader>gf :action FindInPath<CR>
nmap <leader>gr :action ShowUsages<CR>
nmap <leader>gi :action GotoImplementation<CR>
nmap <leader>gs :action GotoSuperMethod<CR>
" Tabs
nmap <leader>tn :action NextTab<CR>
nmap <leader>tp :action PreviousTab<CR>
" NerdTree
nmap <leader>e :NERDTreeToggle<CR>
" When in the tree use the below default keybindings
" j, k - To go down and up
" p - Go to the parent directory
" P - Go the root directory
" s - open file in vertical split
" i - open in horizontal split
" t - open in a new tab
" o - Open the selected file or Expand the selected directory.
" - Also collapse the same directory.
" - Moves the cursor to the file.
" go - Opens the file but keeps the cursor on the file tree
" A - expand the file tree
" x - close the file tree
nmap <C-p> :action ParameterInfo<CR>
imap <C-p> <C-o>:action ParameterInfo<CR>
nmap <leader>n :action GotoNextError<CR>
map gh <Action>(ShowErrorDescription)
" code refactoring
" Code refactoring
nmap <leader>ri :action Inline<CR>
nmap <leader>rr :action RenameElement<CR>
nmap <leader>rev :action IntroduceVariable<CR>
@@ -66,21 +114,6 @@ nmap <leader>rG :action Generate<CR>
nmap <leader>rf :action ReformatCode<CR>
" Easy motion
map <leader>J <Plug>(easymotion-s)
map <leader>j <Plug>(easymotion-f)
map <leader>j <Plug>(easymotion-s)
nmap <leader>gr :action Vcs.RollbackChangedLines<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enabled plugins
set ideajoin
Plug 'easymotion/vim-easymotion'
Plug 'preservim/NERDTree'
Plug 'tpope/surround'
Plug 'tpope/commentary'
Plug 'machakann/highlightedyank'
Plug 'dbakker/vim-paragraph-motion'
Plug 'chrisbra/matchit'
Plug 'tpope/vim-repeat' " Repeat for Surround
Plug 'airblade/vim-gitgutter' " Git gutter icons
Plug 'mg979/vim-visual-multi' " Multi Line Editing