Skip to content

Instantly share code, notes, and snippets.

@HardeepAsrani
Last active March 5, 2024 08:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save HardeepAsrani/80361615220fe2ec55c6837c1d4f4dc9 to your computer and use it in GitHub Desktop.
Save HardeepAsrani/80361615220fe2ec55c6837c1d4f4dc9 to your computer and use it in GitHub Desktop.
Vim Configuration
" The Ultimate vimrc: https://github.com/amix/vimrc
" - Requires vim with python3 support. For Mac, you can install vim with Homebrew for python3 support
" - Make sure you use a Hack font on your terminal for icons to work properly.
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
" Install Plugins
call plug#begin('~/.vim/autoload/plugins')
Plug 'tomasiser/vim-code-dark'
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'mattn/emmet-vim'
Plug 'mhinz/vim-startify'
Plug 'ycm-core/YouCompleteMe'
Plug 'dyng/ctrlsf.vim',
Plug 'MattesGroeger/vim-bookmarks',
Plug 'skywind3000/vim-quickui',
Plug '907th/vim-auto-save'
if has('nvim') || has('patch-8.0.902')
Plug 'mhinz/vim-signify'
else
Plug 'mhinz/vim-signify', { 'branch': 'legacy' }
endif
call plug#end()
" Set Keybinding
map <C-n> :NERDTreeToggle<CR>
map ; :CtrlP<CR>
map <leader>s :CtrlSF
" Tabs Binding
map <leader>`` :tabnew<CR>
map <leader>` :tabclose<CR>
map tn :tabn<CR>
map tp :tabp<CR>
map 1 1gt
map 2 2gt
map 3 3gt
map 4 4gt
map 5 5gt
map 6 6gt
map 7 7gt
map 8 8gt
map 9 9gt
map 0 10gt
" Move Lines
nnoremap <C-d> :m .+1<CR>==
nnoremap <C-u> :m .-2<CR>==
inoremap <C-d> <Esc>:m .+1<CR>==gi
inoremap <C-u> <Esc>:m .-2<CR>==gi
vnoremap <C-d> :m '>+1<CR>gv=gv
vnoremap <C-u> :m '<-2<CR>gv=gv
" Editor Preferences
set encoding=UTF-8
set tabstop=4
set shiftwidth=4
set number nofoldenable autoindent noexpandtab cursorline
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" Theme & Ale Preferences
colorscheme codedark
let g:NERDTreeWinPos = 'left'
let g:airline_theme = 'codedark'
let g:ale_fixers = ['prettier', 'eslint']
let g:ale_sign_error = '✘'
let g:ale_sign_warning = '⚠'
let g:quickui_color_scheme = 'papercol dark'
highlight ALEErrorSign ctermbg=NONE ctermfg=red
highlight ALEWarningSign ctermbg=NONE ctermfg=yellow
" clear all the menus
call quickui#menu#reset()
" install a 'File' menu, use [text, command] to represent an item.
call quickui#menu#install('&File', [
\ [ '&Save', ':w' ],
\ [ '&Auto Save %{ g:auto_save ? "✔" : "" }', ':AutoSaveToggle' ],
\ [ '--', '' ],
\ [ 'E&xit', ':q' ],
\ ])
" install a 'Options' menu, use [text, command] to represent an item.
call quickui#menu#install('&Selection', [
\ [ 'Cl&ear Search', ':let @/ = ""' ],
\ ])
" install a 'View' menu, use [text, command] to represent an item.
call quickui#menu#install('&View', [
\ [ 'Toggle &Distraction Free Mode', ':Goyo'],
\ ])
" install a 'Bookmarks' menu, use [text, command] to represent an item.
call quickui#menu#install('&Bookmarks', [
\ [ "&Show All Bookmarks\tma", ':BookmarkShowAll' ],
\ [ "&Toggle Bookmark\tmm", ':BookmarkToggle' ],
\ [ "&Next Bookmark\tmn", ':BookmarkNext' ],
\ [ "&Previous Bookmark\tmp", ':BookmarkPrev' ],
\ [ '--', '' ],
\ [ "&Clear Bookmarks\tmc", ':BookmarkClear' ],
\ [ "Cl&ear All Bookmarks\tmx", ':BookmarkClearAll' ],
\ ])
" enable to display tips in the cmdline
let g:quickui_show_tip = 1
" hit space twice to open menu
noremap <space><space> :call quickui#menu#open()<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment