Skip to content

Instantly share code, notes, and snippets.

@jasonknebel
Created April 25, 2022 16:54
Show Gist options
  • Save jasonknebel/844aa6758cb54fca0b3dd509c7cc68fa to your computer and use it in GitHub Desktop.
Save jasonknebel/844aa6758cb54fca0b3dd509c7cc68fa to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'jpo/vim-railscasts-theme'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-airline/vim-airline'
" Plugin 'vim-airline/vim-airline-themes'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'scrooloose/nerdcommenter'
Plugin 'tpope/vim-endwise'
Plugin 'gabesoft/vim-ags'
Plugin 'ctrlpvim/ctrlp.vim'
" Plugin 'mattn/emmet-vim'
" TO INSTALL WHEN GITHUB AUTH IS FIXED
" Plugin 'junegunn/goto'
" Plugin 'junegunn/limelight'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-haml'
Plugin 'fatih/vim-go'
Plugin 'pangloss/vim-javascript'
Plugin 'maxmellon/vim-jsx-pretty'
Plugin 'leafgarland/typescript-vim'
Plugin 'quramy/tsuquyomi'
Plugin 'instant-markdown/vim-instant-markdown', {'rtp': 'after'}
Plugin 'dense-analysis/ale'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" 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
" Leader
let mapleader = " "
set backupdir=~/.vimtmp
set directory=~/.vimtmp
" ------ from railscasts
set t_Co=256
colorscheme railscasts
" ------ from railscasts
" ------ from base16
" Plugin 'chriskempson/base16-vim'
" if filereadable(expand("~/.vimrc_background"))
" let base16colorspace=256
" source ~/.vimrc_background
" endif
" colorscheme base16-default-dark
" let base16colorspace=256 " Access colors present in 256 colorspace
" colorscheme base16-tomorrow-night
" set termguicolors
" ------ from base16
syntax on
" Auto-reload changed files
" https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044
set autoread
au CursorHold,CursorHoldI * checktime
au FocusGained,BufEnter * :checktime
" Add next line to tmux?
" set -g focus-events on
hi TabLineFill ctermfg=235 ctermbg=235
set number
set relativenumber
" set incsearch " highlight search results
" set hlsearch " set incremental search
" Set indents to spaces
set tabstop=2
set shiftwidth=2
set expandtab
set cursorline " Highlight current line
" python3 from powerline.vim import setup as powerline_setup
" python3 powerline_setup()
" python3 del powerline_setup
" Airline
let g:airline_powerline_fonts = 1
" let g:airline_theme='powerlineish'
set encoding=utf8
set laststatus=2
map <C-n> :NERDTreeToggle<CR>
" Ctrl-P
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" Ag - The Silver Searcher
" let g:ackprg = 'ag --nogroup --nocolor --column'
" https://thoughtbot.com/blog/faster-grepping-in-vim
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" More natural vim splits
" Ctrl+[direction keys] to move between splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" Display extra whitespace
" set list listchars=tab:»·,trail:·
" Remove trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
" Make `jj` and `jk` throw you into normal mode
inoremap jj <esc>
inoremap jk <esc>
set foldmethod=indent
set nofoldenable " disable folding
" Use system clipboard
set clipboard=unnamedplus
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
" let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Fold highlights
hi Folded ctermbg=233
" Persist undo history between Vim sessions.
set undofile
set undodir=~/.vim/tmp/undo
" Go to the last cursor location when opening a file.
augroup jump
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\| exe 'normal! g`"'
\| endif
augroup end
let g:user_emmet_leader_key='<Tab>'
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
" ALE Config
let g:ale_fixers = {
\ 'javascript': ['prettier'],
\ 'typescript': ['eslint', 'prettier'],
\ 'css': ['prettier'],
\}
let g:ale_linters_explicit = 1
let g:ale_fix_on_save = 1
func! WordProcessor()
map j gj
map k gk
setlocal formatoptions=1
setlocal noexpandtab
setlocal wrap
setlocal linebreak
setlocal spell spelllang=en_us
" set thesaurus+=/home/test/.vim/thesaurus/mthesaur.txt
" set complete+=s
endfunc
com! WP call WordProcessor()
" INSTANT MARKDOWN CONFIG
"Uncomment to override defaults:
"let g:instant_markdown_slow = 1
"let g:instant_markdown_autostart = 0
"let g:instant_markdown_open_to_the_world = 1
"let g:instant_markdown_allow_unsafe_content = 1
"let g:instant_markdown_allow_external_content = 0
"let g:instant_markdown_mathjax = 1
"let g:instant_markdown_mermaid = 1
"let g:instant_markdown_logfile = '/tmp/instant_markdown.log'
let g:instant_markdown_autoscroll = 0
"let g:instant_markdown_port = 8888
"let g:instant_markdown_python = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment