├── .vimrc ├── LICENSE └── README.md /.vimrc: -------------------------------------------------------------------------------- 1 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 2 | " _ 3 | " __ _(_)_ __ ___ _ __ ___ 4 | " \ \ / / | '_ ` _ \| '__/ __| 5 | " \ V /| | | | | | | | | (__ 6 | " \_/ |_|_| |_| |_|_| \___| 7 | " 8 | " Created by Gokul Srinivas 9 | " https://github.com/GokulSrinivas 10 | " 11 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 12 | 13 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 14 | " Make sure you're using ViM 15 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 16 | set nocompatible " be iMproved, required 17 | filetype off " required 18 | set re=2 19 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 20 | " Install all plugins and load them only when required. 21 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 22 | call plug#begin('~/.vim/plugged') 23 | 24 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 25 | " Emmet for vim. Use it only for html and php files. 26 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 27 | Plug 'mattn/emmet-vim', { 'for': ['html','php'] } 28 | 29 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 30 | " Auto-completion for brackets and pairs. 31 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 32 | Plug 'jiangmiao/auto-pairs' 33 | 34 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 35 | " Use a good colorscheme that is easy on the eyes. 36 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 37 | Plug 'dracula/vim' 38 | 39 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 40 | " Awesome tree explorer. Load it only when needed. 41 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 42 | Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } 43 | 44 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 45 | " Lean and mean statusbar. 46 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 47 | Plug 'vim-airline/vim-airline' 48 | 49 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 50 | " Fuzzy finder for vim. 51 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 52 | Plug 'ctrlpvim/ctrlp.vim' 53 | 54 | call plug#end() 55 | 56 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 57 | " Access colors present in 256 colorspace 58 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 59 | let base16colorspace=256 60 | 61 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 62 | " Turn on filetype detection, indentation and load filetype plugins 63 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 64 | filetype plugin indent on 65 | syntax enable 66 | 67 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 68 | " Set dark background. 69 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 70 | set background=dark 71 | 72 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 73 | " Use utf-8 encoding. 74 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 75 | set encoding=utf-8 76 | 77 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 78 | " Color Scheme 79 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 80 | color dracula 81 | 82 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 83 | " Mapping f8 for c++ compiling and executing 84 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 85 | map :!g++ % && ./a.out 86 | 87 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 88 | " Setting Tab and indent Widths 89 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 90 | set tabstop=4 softtabstop=0 expandtab shiftwidth=4 91 | set smarttab 92 | set expandtab 93 | set title 94 | set autoindent 95 | set smartindent 96 | set backspace=indent,eol,start 97 | 98 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 99 | " Highlight search results 100 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 101 | set hlsearch 102 | 103 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 104 | " Show current Position 105 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 106 | set ruler 107 | 108 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 109 | " Better Search settings 110 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 111 | set incsearch 112 | 113 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 114 | " Set Encoding 115 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 116 | set encoding=utf8 117 | 118 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 119 | " Completion for vim commands 120 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 121 | set wildmenu 122 | 123 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 124 | " Navigate buffers without saving 125 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 126 | set hidden 127 | 128 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 129 | " For Line numbers 130 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 131 | set number 132 | 133 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 134 | " Show matching braces 135 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 136 | set showmatch 137 | 138 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 139 | " Highlighting current line 140 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 141 | set cursorline 142 | highlight CursorLine cterm=bold ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE 143 | 144 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 145 | " Set No backups, live life on the edge 146 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 147 | set nobackup 148 | set nowb 149 | set noswapfile 150 | 151 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 152 | " Set backups, play it safe 153 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 154 | "set backupdir=~/.vim_backup 155 | 156 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 157 | " Function to swap two lines at n1 and n2 158 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 159 | function! s:swap_lines(n1, n2) 160 | let line1 = getline(a:n1) 161 | let line2 = getline(a:n2) 162 | call setline(a:n1, line2) 163 | call setline(a:n2, line1) 164 | endfunction 165 | 166 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 167 | " Function to swap line and line above 168 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 169 | function! s:swap_up() 170 | let n = line('.') 171 | if n == 1 172 | return 173 | endif 174 | 175 | call s:swap_lines(n, n - 1) 176 | exec n - 1 177 | endfunction 178 | 179 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 180 | " Function to swap line and line below 181 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 182 | function! s:swap_down() 183 | let n = line('.') 184 | if n == line('$') 185 | return 186 | endif 187 | 188 | call s:swap_lines(n, n + 1) 189 | exec n + 1 190 | endfunction 191 | 192 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 193 | " Mapping for moving lines 194 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 195 | noremap :call swap_up() 196 | noremap :call swap_down() 197 | 198 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 199 | " Common typos 200 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 201 | :command WQ wq 202 | :command Wq wq 203 | :command W w 204 | :command Q q 205 | 206 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 207 | " This unsets the "last search pattern" register by hitting return 208 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 209 | nnoremap :noh 210 | 211 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 212 | " Toggle NERDTree file explorer 213 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 214 | map :NERDTreeToggle 215 | 216 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 217 | " Always show the statusbar 218 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 219 | set laststatus=2 220 | 221 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 222 | " Enable the list of buffers 223 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 224 | let g:airline#extensions#tabline#enabled = 1 225 | 226 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 227 | " Show just the filename 228 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 229 | let g:airline#extensions#tabline#fnamemod = ':t' 230 | 231 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 232 | " Set some sane defaults for the statusbar 233 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 234 | let g:airline_theme='dark' 235 | let g:airline_powerline_fonts = 1 236 | let g:airline_skip_empty_sections = 1 237 | 238 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 239 | " Blazing fast vim 240 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 241 | set ttimeoutlen=0 242 | 243 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 244 | " Define separators and characters for the statusbar 245 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 246 | let g:airline_left_sep="" 247 | let g:airline_left_alt_sep="" 248 | let g:airline_right_sep="" 249 | let g:airline_right_alt_sep="" 250 | if !exists('g:airline_symbols') 251 | " Symbols for Unicode terminals 252 | if &encoding==?'utf-8' 253 | let g:airline_symbols= { 254 | \ 'paste': 'PASTE', 255 | \ 'spell': 'SPELL', 256 | \ 'readonly': "\u229D", 257 | \ 'whitespace': "\u2632", 258 | \ 'linenr': "\u2630", 259 | \ 'maxlinenr': "\u33D1", 260 | \ 'branch': "\u16A0", 261 | \ 'notexists': "\u0246", 262 | \ 'modified': '+', 263 | \ 'space': ' ', 264 | \ 'crypt': "\xf0\x9f\x94\x92", 265 | \} 266 | else 267 | " Symbols for ASCII terminals 268 | let g:airline_symbols={ 269 | \ 'paste': 'PASTE', 270 | \ 'spell': 'SPELL', 271 | \ 'readonly': 'RO', 272 | \ 'whitespace': '!', 273 | \ 'linenr': 'ln', 274 | \ 'maxlinenr': ':', 275 | \ 'branch': '', 276 | \ 'notexists': '?', 277 | \ 'modified': '+', 278 | \ 'space': ' ', 279 | \ 'crypt': 'cr', 280 | \ } 281 | endif 282 | endif 283 | 284 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 285 | " Navigate buffers using pageup and pagedown 286 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 287 | nnoremap :bprevious 288 | nnoremap :bnext 289 | 290 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 291 | " Show only files tracked by git in CtrlP 292 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 293 | let g:ctrlp_user_command = [ 294 | \ '.git', 295 | \ 'cd %s && git ls-files . -co --exclude-standard', 296 | \ 'find %s -type f' 297 | \] 298 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Gokul Srinivas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vimrc 2 | 3 | My slim and powerful vimrc. 4 | 5 | ## Installation 6 | 7 | To install, simply run the following command. 8 | 9 | Bash : 10 | ```sh 11 | bash <(curl -s https://gist.githubusercontent.com/nym3r0s/40fadf2e94ec1f164d3c/raw/3d4515f92a95e95e30f0bb693cfdcf47bdffdad7/install_vim.sh) 12 | ``` 13 | Zsh : 14 | ```sh 15 | zsh <(curl -s https://gist.githubusercontent.com/nym3r0s/40fadf2e94ec1f164d3c/raw/3d4515f92a95e95e30f0bb693cfdcf47bdffdad7/install_vim.sh) 16 | ``` 17 | 18 | ## Special Keybindings 19 | 20 | In normal mode, 21 | * `Ctrl + k` - Move current line up 22 | * `Ctrl + j` - Move current line down 23 | * `Ctrl + n` - Open the file finder 24 | * `Ctrl + p` - Open fuzzy finder 25 | * `PageUp` - Previous Buffer 26 | * `PageDown` - Next Buffer 27 | 28 | ## Uses: 29 | 30 | * [emmet-vim](https://github.com/mattn/emmet-vim) 31 | * [auto-pairs](https://github.com/jiangmiao/auto-pairs) 32 | * [supertab](https://github.com/ervandew/supertab) 33 | * [vim-easymotion](https://github.com/easymotion/vim-easymotion) 34 | * [dracula](https://github.com/dracula/vim) 35 | * [nerdtree](https://github.com/scrooloose/nerdtree) 36 | * [vim-go](https://github.com/fatih/vim-go) 37 | * [fugitive](https://github.com/tpope/vim-fugitive) 38 | * [vim-airline](https://github.com/vim-airline/vim-airline) 39 | * [ctrlp](https://github.com/ctrlpvim/ctrlp.vim) 40 | 41 | ## Manual Installation 42 | 43 | * Install [vim-plug](https://github.com/junegunn/vim-plug) 44 | * Place the .vimrc in your `$HOME` directory. Do a `cd ~` if you do not know where it is. 45 | * Open vim and type `:PlugInstall` 46 | * Re-open vim and enjoy! 47 | 48 | ## License 49 | 50 | [MIT](https://github.com/GokulSrinivas/vimrc/blob/master/LICENSE) 51 | 52 | © 2021 Gokul Srinivas 53 | --------------------------------------------------------------------------------