I use Vim for my daily work as a code editor as well as a text editor. It is a very good software, it already has a lot of functionality that everyone trying to get through extensions in code editor like VSCode, Atom, Sublime-Text,etc. enabled by default. You can also use it on any other OS that is available today.
Setting up Vim on Windows is little bit tricky but it works sometimes when you have your home/environment variable setup correctly, otherwise you need to do that manually.
This configuaration is mainly for linux user, or mac as well. I am using it on linux and it works just fine for me. There are also a lot you can do with Vim but I am happy with these config.
These are basically the default setting that everyone uses while working in vim.
The basic functionality of any command is also indicated there in the form of comment in the source code.
syntax on "Enables syntax highlighting set noerrorbells "Disable the sound on error set tabstop=4 softtabstop=4 "Insert 3 spaces for a tab set shiftwidth=4 "Changes the number of spaces chanracters inserted for indentation set smarttab "Makes tabbing smarter, it realize you have 2 vs 4 set expandtab "Converts tabs to spaces set smartindent "Enables smart indent set cmdheight=2 "More space for displaying messages set nu "Enables numberline set relativenumber "Enables relative number line set nowrap "Disable the wrapping of long line test it will be now on single line set smartcase "Only applies to search patterns that you type set mouse=a "Enables the mouse set splitbelow "Split horizontal window to below set splitright "Split the vertical window to the right set t_Co=256 "Support 256 colors set autoindent "Good auto indent set noswapfile "Disable the creation of swap file for every file opened in vim set nobackup "Disable the creation of backup file in vim set undodir=~/.vim/undodir "Save our undo action to a particular directory set undofile "Creates a undo file set incsearch "Enables increamental search set clipboard=unnamedplus "Enables the clipboard support in vim now it shares the clipboard of the windows set cursorline "Highlight the current line set formatoptions-=cro "Stop newline continuation of comments set colorcolumn=100 "Set the vertical color column after 100 character length highlight ColorColumn ctermbg=0 guibg=lightgrey
I am using Vim-plug as my plugin manager in vim. Below are the list of some of the plugins that I personally use. These all are really a life-saver to me.
call plug#begin('~/.vim/plugged')
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
Plug 'morhetz/gruvbox'
Plug 'jremmen/vim-ripgrep'
Plug 'tpope/vim-fugitive'
Plug 'preservim/nerdtree'
Plug 'leafgarland/typescript-vim'
Plug 'vim-utils/vim-man'
Plug 'lyuts/vim-rtags'
"Plug 'git@github.com:kien/ctrlp.vim.git'
"Plug 'git@github.com:Valloric/YouCompleteMe.git'
Plug 'ycm-core/YouCompleteMe'
Plug 'kien/ctrlp.vim'
Plug 'mbbill/undotree'
Plug 'jiangmiao/auto-pairs'
call plug#end() "End of vim-plug plugin listing
Using background color as dark, and color scheme is set to gruvbox. I imported gruvbox in the plugin section.
colorscheme gruvbox "Setting colorscheme to gruvbox set background=dark "Set background to dark
Listed below these are some of my fav keybindings that I use. My leader key is set to Space which is lot easier for me.
let mapleader = " " "Leader key set to space bar nnoremap <leader>h :wincmd h<CR> nnoremap <leader>j :wincmd j<CR> nnoremap <leader>k :wincmd k<CR> nnoremap <leader>l :wincmd l<CR> nnoremap <leader>u :UndotreeShow<CR> nnoremap <leader>pv :wincmd v<bar> :Ex <bar> :vertical resize 30<CR> nnoremap <Leader>ps :Rg<SPACE> nnoremap <silent> <Leader>+ :vertical resize +5<CR> nnoremap <silent> <Leader>- :vertical resize -5<CR> "Use alt + jklh key to resize window "nnoremap <M-j> :resize -2<CR> "nnoremap <M-k> :resize +2<CR> "nnoremap <M-h> :vertical resize -2<CR> "nnoremap <M-l> :vertical resize +2<CR> "Changing jk or kj to work or remap to work as escape key inoremap jk <Esc> inoremap kj <Esc> "Easy caps c stands for CTRL inoremap <c-u> <Esc>viwUi inoremap <c-u> viwU<Esc> nnoremap <silent> <Leader>gd :YcmCompleter GoTo<CR> nnoremap <silent> <Leader>gf :YcmCompleter FixIt<CR>
These are also some of the setting to be imported into the vimrc.
if executable('rg')
let g:rg_derive_root='true'
endif
"Setting path to ycm config where it is located in my system.
let g:ycm_global_ycm_extra_conf = "~/.vim/plugged/YouCompleteMe/.ycm_extra_conf.py"
"These set some of the directories/files to be ingnored by the ctrlp
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude standard']
let g:netrw_browse_split=2
let g:netrw_banner = 0
let g:netrw_winsize = 25
let g:ctrlp_use_caching = 0