Skip to content

Instantly share code, notes, and snippets.

@tgroshon
Last active February 10, 2022 16:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgroshon/211db5954a34f266275d022526b7679d to your computer and use it in GitHub Desktop.
Save tgroshon/211db5954a34f266275d022526b7679d to your computer and use it in GitHub Desktop.
Vim Settings (requires Vundle)
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim' " required
Plugin 'mileszs/ack.vim'
Plugin 'dense-analysis/ale'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-vinegar'
Plugin 'easymotion/vim-easymotion'
Plugin 'othree/html5.vim'
Plugin 'mattn/emmet-vim'
Plugin 'colepeters/spacemacs-theme.vim'
Plugin 'tomtom/tcomment_vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'pangloss/vim-javascript'
Plugin 'leafgarland/typescript-vim'
Plugin 'sheerun/vim-polyglot'
Plugin 'elzr/vim-json'
Plugin 'preservim/nerdtree'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"
if (has("termguicolors"))
set termguicolors
endif
syntax on
set background=dark
colorscheme spacemacs-theme
" Set ctrlp working directory
let g:ctrlp_working_path_mode = 'ra'
" Use silver searcher if available
if executable('ag')
let g:ackprg = 'ag --vimgrep'
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
endif
" New Escape Key
imap fd <Esc>
map fd <Esc>
" Leader Key
let mapleader = " "
let g:mapleader = " "
" ALE linting and formatters
let g:ale_fix_on_save = 1
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['prettier', 'eslint'],
\ 'typescript': ['prettier', 'eslint'],
\ 'css': ['prettier'],
\}
" Nerdtree key mappings
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <leader>t :NERDTreeToggle<CR>
" Start NERDTree when Vim is started without file arguments.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
" Basic Settings and Behaviors
set encoding=utf8
set relativenumber
set history=1000
set autoread
set expandtab
set smarttab
set shiftwidth=2
set tabstop=2
set ai "Auto indent
set si "Smart indent
set wildmenu " Turn on the WiLd menu
set wildignore=*.o,*~,*.pyc " Ignore Compiled files
set ruler " Show current Position
set cmdheight=1 " Height of the command bar
set hid " A buffer becomes hidden when it is abandoned
set backspace=eol,start,indent " Configure backspace so it acts as it should act
set whichwrap+=<,>,h,l
set nowrap
set ignorecase " Ignore case when searching
set smartcase " When searching try to be smart about cases
set hlsearch " Highlight search results
set incsearch " Makes search act like search in modern browsers
set lazyredraw " Don't redraw while executing macros (good performance config)
set magic " For regular expressions turn magic on
set showmatch " Show matching brackets when text indicator is over them
set mat=2 " How many tenths of a second to blink when matching brackets
set ffs=unix,dos,mac " Use Unix as the standard file type
set autoread
" Turn backup and Swap off
set nobackup
set nowb
set noswapfile
" Sounds and Bells
set noerrorbells
set novisualbell
set t_vb=
set tm=500
@tgroshon
Copy link
Author

tgroshon commented May 13, 2020

New machine setup:

  1. Copy gist to local vimrc
  2. Download Vundle
  3. Install vundle plugins
curl -LJ -o ~/.vimrc https://gist.github.com/tgroshon/211db5954a34f266275d022526b7679d/raw/f8c0bf8df91f97b697d49c779bc16161b300a51f/.vimrc.vim
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment