- 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

@@ -8,8 +8,7 @@
"extensions.ignoreRecommendations": true, "extensions.ignoreRecommendations": true,
// Editor // Editor
"editor.fontSize": 21, // Increase the Editor's font to offset "editor.fontSize": 21, // Reduces the Activity Bar size
"window.zoomLevel": -1, // Reduces the Activity Bar size
"editor.cursorWidth": 4, "editor.cursorWidth": 4,
"editor.minimap.enabled": false, "editor.minimap.enabled": false,
"editor.wordWrap": "on", "editor.wordWrap": "on",

View File

@@ -0,0 +1,3 @@
#trl
Ctrl
youtube

Binary file not shown.

View File

@@ -3,10 +3,14 @@
" Examples to map IDE actions to IdeaVim -- https://jb.gg/abva4t " Examples to map IDE actions to IdeaVim -- https://jb.gg/abva4t
" Enable IdeaVim plugins https://jb.gg/ideavim-plugins " Enable IdeaVim plugins https://jb.gg/ideavim-plugins
" Source .vimrc
"source ~/.vimrc "source ~/.vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set Tabs to 4 characters
set expandtab
set tabstop=4
set shiftwidth=4
" Searches " Searches
set hlsearch " highlight search occurrences set hlsearch " highlight search occurrences
set ignorecase " ignore case in search patterns 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 incsearch " show search results while typing
set wrapscan " searches wrap around the end of the file 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 gdefault " substitute all occurrences in line
set history=10000 " command line history set history=10000 " command line history
set scrolloff=5 sidescrolloff=10 " Keep some line before and after the cursor visible 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 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 = " " let mapleader = " "
" Don't use Ex mode, use Q for formatting " Don't use Ex mode, use Q for formatting
@@ -36,24 +58,50 @@ map Q gq
nnoremap <C-d> <C-d>zz nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>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> nnoremap <leader>/ :nohls<return><esc>
" code navigations " Find/Open file
nmap <leader>e :action GotoFile<CR> nmap <leader>of :action GotoFile<CR>
nmap <leader>a :action FindInPath<CR> nmap <leader>or :action RecentFiles<CR>
nmap gr :action ShowUsages<CR>
nmap gi :action GotoImplementation<CR> " Find/Navigate to different parts of code
nmap gs :action GotoSuperMethod<CR> 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>tn :action NextTab<CR>
nmap <leader>tp :action PreviousTab<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> nmap <C-p> :action ParameterInfo<CR>
imap <C-p> <C-o>:action ParameterInfo<CR> imap <C-p> <C-o>:action ParameterInfo<CR>
nmap <leader>n :action GotoNextError<CR> nmap <leader>n :action GotoNextError<CR>
map gh <Action>(ShowErrorDescription) map gh <Action>(ShowErrorDescription)
" code refactoring " Code refactoring
nmap <leader>ri :action Inline<CR> nmap <leader>ri :action Inline<CR>
nmap <leader>rr :action RenameElement<CR> nmap <leader>rr :action RenameElement<CR>
nmap <leader>rev :action IntroduceVariable<CR> nmap <leader>rev :action IntroduceVariable<CR>
@@ -66,21 +114,6 @@ nmap <leader>rG :action Generate<CR>
nmap <leader>rf :action ReformatCode<CR> nmap <leader>rf :action ReformatCode<CR>
" Easy motion " Easy motion
map <leader>J <Plug>(easymotion-s) map <leader>j <Plug>(easymotion-s)
map <leader>j <Plug>(easymotion-f)
nmap <leader>gr :action Vcs.RollbackChangedLines<CR> 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

172
common/.vim/vimrc Normal file
View File

@@ -0,0 +1,172 @@
" Load the plugins
" This being the 1st line in the config file,
" makes it possible to configure plugins any place in the file.
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive' "Fugitive Vim GitHub Wrapper
Plug 'tpope/vim-surround' "Surround Plugin
Plug 'tpope/vim-repeat' "Repeat for the surround plugin
Plug 'tpope/vim-commentary' "Surround Plugin
Plug 'tpope/vim-sensible' "Sensible options
Plug 'rstacruz/vim-closer' "Auto-close brackets
Plug 'machakann/vim-highlightedyank' "Highlight Yank
Plug 'dbakker/vim-paragraph-motion' "Paragraph Motion
Plug 'airblade/vim-gitgutter' "Git in the left-side gutter
Plug 'junegunn/rainbow_parentheses.vim' "Rainbow parenthesis
Plug 'easymotion/vim-easymotion' "Easy Motion to quickly jump across the buffer
Plug 'preservim/nerdtree' "Nerd Tree
Plug 'kshenoy/vim-signature' "Show gutter icons for Vim marks
" Plug 'unblevable/quick-scope' "Quick Scope
" Plug 'bronson/vim-trailing-whitespace' "Highlight trailing spaces, remove them all with :FixWhitespace
"------------Style Plugins------------"
" Status Styles
Plug 'itchyny/lightline.vim'
Plug 'challenger-deep-theme/vim', { 'as': 'challenger-deep' } "ColorScheme - Challenger-deep
Plug 'cocopon/iceberg.vim' "Color Scheme - Iceberg
Plug 'whatyouhide/vim-gotham' "Color Scheme - Gotham
Plug 'tyrannicaltoucan/vim-deep-space' "Color Scheme - Deep-space
call plug#end()
" ------- Look and Feel ----------------
" let g:lightline = { 'colorscheme': 'gotham'}
let g:lightline = { 'colorscheme': 'deepspace'}
colorscheme deep-space
" Set color
if !has('gui_running')
set t_Co=256
set termguicolors
hi LineNr ctermbg=NONE guibg=NONE
endif
" ------- Making Vim an IDE ----------------
" Better autocompletes
filetype plugin indent on
set omnifunc=syntaxcomplete#Complete
set complete+=kspell
" Comments in Grey color and italic
hi Comment guifg=#5C6370 ctermfg=50 cterm=italic
" Highlight and remove trailing blank spaces on save
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWritePre * %s/\s\+$//e
" Turn on syntax highlighting.
syntax on
" Highlight matching pairs of [] {} ()
set showmatch
" Make sure tabs are 4 character wide
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set autoindent
set smartindent
" ------- Vim Related ----------------
" Auto reload .vimrc
autocmd! bufwritepost ~/.vim/.vimrc source %
" Show line numbers
set number
" Relative line numbers
set relativenumber
" Wrap text
set wrap
" Status bar
" set laststatus=2
" set noshowmode
" Encoding
set encoding=utf-8
" Unbind some useless/annoying default key bindings.
nmap Q <Nop> " 'Q' in normal mode enters Ex mode. You almost never want this.
" Vim is based on Vi. Setting `nocompatible` switches from the default
" Vi-compatibility mode and enables useful Vim functionality. This
" configuration option turns out not to be necessary for the file named
" '~/.vimrc', because Vim automatically enters nocompatible mode if that file
" is present. But we're including it here just in case this config file is
" loaded some other way (e.g. saved as `foo`, and then Vim started with
" `vim -u foo`).
set nocompatible
" Disable the default Vim startup message.
set shortmess+=I
" Normally, backspace works only if you have made an edit. This fixes that.
set backspace=indent,eol,start
" A line to specify 80 column limit
" setlocal colorcolumn=80
" Vim, by default, won't let you jump to a different file without saving the
" current one. With the below, unsaved files are just hidden.
set hidden
" This setting makes search case-insensitive when all characters in the string
" being searched are lowercase. However, the search becomes case-sensitive if
" it contains any capital letters. This makes searching more convenient.
set ignorecase
set smartcase
" Enable searching as you type, rather than waiting till you press enter.
set incsearch
" Highlight search pattern
set hlsearch
" Disable audible bell because it's annoying.
set noerrorbells visualbell t_vb=
" Enable mouse support. You should avoid relying on this too much, but it can
" sometimes be convenient.
set mouse+=a
" No header spam in netrw
let g:netrw_banner=0
" Display directory in tree style in netrw
let g:netrw_liststyle=3
" Sync vim clipboard with system clipboard
" Works across Linux, MacOS & Windows
set clipboard^=unnamed,unnamedplus
" ------- Remap Keybindings ----------------
" Disable left, right, up and down keys
" In normal mode...
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" ...and in insert mode
inoremap <Left> <ESC>:echoe "Use h"<CR>
inoremap <Right> <ESC>:echoe "Use l"<CR>
inoremap <Up> <ESC>:echoe "Use k"<CR>
inoremap <Down> <ESC>:echoe "Use j"<CR>
" Center the cursor when moving through file
nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>zz
nnoremap g; g;zz
nnoremap g, g,zz
nnoremap <C-o> <C-o>zz
nnoremap <C-i> <C-i>zz
nnoremap ]s ]szz
" Make space-bar the leader-key
let mapleader = " "
" Map easymotion Plugin to <Leader>j
map <leader>j <Plug>(easymotion-s)
" Map nerdtree to <Leader>e
map <leader>e :NERDTreeToggle<CR>

View File

@@ -1,116 +0,0 @@
" Show line numbers
set number
" This enables relative line numbering mode. With both number and
" relativenumber enabled, the current line shows the true line number, while
" all other lines (above and below) are numbered relative to the current line.
" This is useful because you can tell, at a glance, what count is needed to
" jump up or down to a particular line, by {count}k to go up or {count}j to go
" down.
set relativenumber
" Wrap text
set wrap
" Encoding
set encoding=utf-8
" Status bar
" set laststatus=2
" set noshowmode
" Set color
if !has('gui_running')
set t_Co=256
set termguicolors
hi LineNr ctermbg=NONE guibg=NONE
endif
" Comments in Grey color and italic
hi Comment guifg=#5C6370 ctermfg=50 cterm=italic
" Vim is based on Vi. Setting `nocompatible` switches from the default
" Vi-compatibility mode and enables useful Vim functionality. This
" configuration option turns out not to be necessary for the file named
" '~/.vimrc', because Vim automatically enters nocompatible mode if that file
" is present. But we're including it here just in case this config file is
" loaded some other way (e.g. saved as `foo`, and then Vim started with
" `vim -u foo`).
set nocompatible
" Turn on syntax highlighting.
syntax on
" Highlight matching pairs of [] {} ()
set showmatch
" Disable the default Vim startup message.
set shortmess+=I
" The backspace key has slightly unintuitive behavior by default. For example,
" by default, you can't backspace before the insertion point set with 'i'.
" This configuration makes backspace behave more reasonably, in that you can
" backspace over anything.
set backspace=indent,eol,start
" By default, Vim doesn't let you hide a buffer (i.e. have a buffer that isn't
" shown in any window) that has unsaved changes. This is to prevent you from "
" forgetting about unsaved changes and then quitting e.g. via `:qa!`. We find
" hidden buffers helpful enough to disable this protection. See `:help hidden`
" for more information on this.
set hidden
" This setting makes search case-insensitive when all characters in the string
" being searched are lowercase. However, the search becomes case-sensitive if
" it contains any capital letters. This makes searching more convenient.
set ignorecase
set smartcase
" Enable searching as you type, rather than waiting till you press enter.
set incsearch
" Highlight search pattern
set hlsearch
" Unbind some useless/annoying default key bindings.
nmap Q <Nop> " 'Q' in normal mode enters Ex mode. You almost never want this.
" Disable audible bell because it's annoying.
set noerrorbells visualbell t_vb=
" Enable mouse support. You should avoid relying on this too much, but it can
" sometimes be convenient.
set mouse+=a
" Sync vim clipboard with system clipboard
" Works across Linux, MacOS & Windows
set clipboard^=unnamed,unnamedplus
" Try to prevent bad habits like using the arrow keys for movement. This is
" not the only possible bad habit. For example, holding down the h/j/k/l keys
" for movement, rather than using more efficient movement commands, is also a
" bad habit. The former is enforceable through a .vimrc, while we don't know
" how to prevent the latter.
" Do this in normal mode...
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" ...and in insert mode
inoremap <Left> <ESC>:echoe "Use h"<CR>
inoremap <Right> <ESC>:echoe "Use l"<CR>
inoremap <Up> <ESC>:echoe "Use k"<CR>
inoremap <Down> <ESC>:echoe "Use j"<CR>
" Center the cursor when doing 1/2 page down and page up
nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>zz
" Call the .vimrc.plug file
if filereadable(expand("~/.vimrc.plug"))
source ~/.vimrc.plug
endif
" let g:lightline = { 'colorscheme': 'gotham'}
let g:lightline = { 'colorscheme': 'deepspace'}
colorscheme deep-space

View File

@@ -1,55 +0,0 @@
call plug#begin('~/.vim/plugged')
"Fugitive Vim Github Wrapper
Plug 'tpope/vim-fugitive'
" Surround Plugin
Plug 'tpope/vim-surround'
" Repeat for the surround plugin
Plug 'tpope/vim-repeat'
" Surround Plugin
Plug 'tpope/vim-commentary'
" Sensible options
Plug 'tpope/vim-sensible'
" Auto-close brackets
Plug 'rstacruz/vim-closer'
" Highlight Yank
Plug 'machakann/vim-highlightedyank'
" Paragraph Motion
Plug 'dbakker/vim-paragraph-motion'
" Quick Scope
" Plug 'unblevable/quick-scope'
" Git in the left-side gutter
Plug 'airblade/vim-gitgutter'
" Rainbow parenthesis
Plug 'junegunn/rainbow_parentheses.vim'
" Highlight trailing spaces - remove them all with :FixWhitespace
Plug 'bronson/vim-trailing-whitespace'
"------------Look and Feel------------"
" Status Styles
Plug 'itchyny/lightline.vim'
" ColorScheme - Challenger-deep
Plug 'challenger-deep-theme/vim', { 'as': 'challenger-deep' }
" Color Scheme - Iceberg
Plug 'cocopon/iceberg.vim'
" Color Scheme - Gotham
Plug 'whatyouhide/vim-gotham'
" Color Scheme - Deep-space
Plug 'tyrannicaltoucan/vim-deep-space'
call plug#end()