Skip to content

Instantly share code, notes, and snippets.

@thosil
Created November 17, 2020 19:32
Show Gist options
  • Save thosil/574d07a00b0159a0e2cbd81b958cda09 to your computer and use it in GitHub Desktop.
Save thosil/574d07a00b0159a0e2cbd81b958cda09 to your computer and use it in GitHub Desktop.
my .virmc
" 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
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
"" Run PlugInstall if there are missing plugins
"if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
" autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
"endif
call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree'
Plug 'plasticboy/vim-markdown'
Plug 'tpope/vim-fugitive'
Plug 'sheerun/vim-polyglot'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'dense-analysis/ale'
Plug 'doums/darcula'
Plug 'itchyny/lightline.vim'
Plug 'airblade/vim-gitgutter'
call plug#end()
" Disallow detection of filetypes
filetype off
filetype plugin indent on " required
runtime macros/matchit.vim
syntax enable
if (has("termguicolors"))
set termguicolors
endif
" Stop concealing quotes in JSON
let g:vim_json_syntax_conceal = 0
" Enable JSX syntax highlighting in .js files
let g:jsx_ext_required = 0
" More natural split opening.
set splitbelow
set splitright
" Show leader key
set showcmd
" #TABS AND SPACES {{{
set expandtab " On pressing tab, insert 2 spaces
set tabstop=2 " show existing tab with 2 spaces width
set softtabstop=2
set shiftwidth=2 " when indenting with '>', use 2 spaces width
"}}}
set number " Show line numbers
set noswapfile " No swap file
set nobackup
set nowritebackup
set textwidth=80
set formatoptions+=t
set colorcolumn=+1
set showmatch
set lazyredraw
set wildignore+=**/node_modules/**,**/dist/**,**_site/**,*.swp,*.png,*.jpg,*.gif,*.webp,*.jpeg,*.map
" Use the system register for all cut yank and paste operations
set clipboard=unnamedplus
"" Toggle Hybrid Numbers in insert and normal mode
":set number relativenumber
" Show Invisibles
"set list
set listchars=tab:→→,eol:¬,space:.
" Automatically hide buffer with unsaved changes without showing warning
set hidden
" Treat all numbers as decimal regardless of whether they are padded with zeros
set nrformats=
" Highlight matches when using :substitute
set hlsearch
" Predicts case sensitivity intentions
set smartcase
" Jump to match when searching
set incsearch
set updatetime=300
" mostly from https://github.com/ayoisaiah/dotfiles/blob/master/vim/general.vim
nnoremap <C-left> :tabprevious<CR>
nnoremap <C-right> :tabnext<CR>
nnoremap <C-t> :tabnew<CR>
nnoremap <leader>w :tabclose<CR>
nnoremap n nzz
nnoremap N Nzz
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
nnoremap <C-n> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
colorscheme darcula
set mouse=a
let g:lightline = { 'colorscheme': 'darculaOriginal' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment