Skip to content

Instantly share code, notes, and snippets.

@jsonnull
Created June 25, 2018 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsonnull/5e033926984640fb8e3965708c69f5f9 to your computer and use it in GitHub Desktop.
Save jsonnull/5e033926984640fb8e3965708c69f5f9 to your computer and use it in GitHub Desktop.
" pathogen plugin management
" execute pathogen#infect('~/.config/nvim/bundle/{}')
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" file and window management
Plugin 'scrooloose/nerdtree'
Plugin 'bling/vim-bufferline'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plugin 'junegunn/fzf.vim'
" git
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-rhubarb'
Plugin 'shumphrey/fugitive-gitlab.vim'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'airblade/vim-gitgutter'
" syntax
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/syntastic'
Plugin 'sbdchd/neoformat'
" languages
Plugin 'rust-lang/rust.vim'
Plugin 'tpope/vim-haml'
Plugin 'pangloss/vim-javascript'
Plugin 'tikhomirov/vim-glsl'
Plugin 'flowtype/vim-flow'
Plugin 'mxw/vim-jsx'
Plugin 'HerringtonDarkholme/yats.vim'
"Plugin 'mhartington/nvim-typescript'
"Plugin 'fleischie/vim-styled-components'
Plugin 'tpope/vim-markdown'
Plugin 'groenewege/vim-less'
Plugin 'raichoo/purescript-vim'
" colors
"Plugin 'altercation/vim-colors-solarized'
"Plugin 'chriskempson/base16-vim'
" editing
Plugin 'sirver/ultisnips'
Plugin 'godlygeek/tabular'
Plugin 'ervandew/supertab'
Plugin 'reedes/vim-pencil'
Plugin 'dbmrq/vim-ditto'
" 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
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"
" Basic Options
"
syntax on
set autoindent
set ai
set number
set expandtab
set tabstop=2
set shiftwidth=2
set laststatus=2
set hidden
" Custom invisibles
set listchars=eol:¬,tab:->,trail:~,extends:>,precedes:< ",space:·
set list
set colorcolumn=80
set background=light
set backspace=2
" set termguicolors " enable true colors support
" colorscheme typo
" colorscheme solarized
" colorscheme base16-google-dark
" This tells vim how to write the file so that webpack can detect it
set backupcopy=yes
"
" Syntax helper function
"
function! SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
"
" NERDTRee
"
let NERDTreeIgnore = ['node_modules', '.git$', 'coverage', 'flow-typed']
let g:NERDTreeMinimalUI = 1
" Open NERDTree automatically when vim starts up
autocmd vimenter * NERDTree
" Open NERDTree automatically when vim starts up if no files were specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Toggle NERDTree with CTRL-n
map <C-n> :NERDTreeToggle<CR>
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
" call NERDTreeHighlightFile('css', 'red', 'none', 'red', '#151515')
" call NERDTreeHighlightFile('js', 'blue', 'none', 'blue', '#151515')
" call NERDTreeHighlightFile('ts', 'blue', 'none', 'blue', '#151515')
" call NERDTreeHighlightFile('json', 'cyan', 'none', 'cyan', '#151515')
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "*",
\ "Staged" : "+",
\ "Untracked" : "++",
\ "Renamed" : "->",
\ "Unmerged" : "==",
\ "Deleted" : "X",
\ "Dirty" : "!",
\ "Clean" : "√",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
"
" BufferLine
"
let g:bufferline_echo = 0
autocmd VimEnter *
\ let &statusline='%{bufferline#refresh_status()}'
\ .bufferline#get_status_string()
" Configuration for Find command
"
" --column: Show column number
" --line-number: Show line number
" --no-heading: Do not show file headings in results
" --fixed-strings: Search term as a literal string
" --ignore-case: Case insensitive search
" --no-ignore: Do not respect .gitignore, etc...
" --hidden: Search hidden files and folders
" --follow: Follow symlinks
" --glob: Additional conditions for search (in this case ignore everything in the .git/ folder)
" --color: Search color options
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0)
"
" Specify file types for certain extensions
"
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
autocmd BufNewFile,BufReadPost *.jess set filetype=javascript
autocmd BufNewFile,BufReadPost *.pegjs set filetype=javascript
autocmd BufNewFile,BufReadPost *.flow set filetype=javascript
autocmd BufNewFile,BufReadPost *.babelrc set filetype=json
autocmd BufNewFile,BufReadPost *.hbs set filetype=mustache
autocmd BufNewFile,BufReadPost *.prettierrc set filetype=yaml
autocmd FileType javascript let b:syntastic_skip_checks=1
" Prevent bad highlighting in CSS3 properties with dashes
augroup VimCSS3Syntax
autocmd!
autocmd FileType css setlocal iskeyword+=-
augroup END
"
" Plain text and markdown configuration
"
"augroup pencil
" autocmd!
" autocmd FileType markdown,mkd call pencil#init({'wrap': 'hard', 'autoformat': 1})
" autocmd FileType text call pencil#init()
"augroup END
" Ditto
au FileType markdown,text DittoOn
nmap <leader>di <Plug>ToogleDitto
" Set the textwidth for pencil enabled files
let g:pencil#textwidth = 80
" Ctrl+K key suspends autoformat for next insert
" nnoremap K <NOP>
let g:pencil#map#suspend_af = 'K' " default is no mapping
let g:pencil#autoformat_config = {
\ 'markdown': {
\ 'black': [
\ 'htmlH[0-9]',
\ 'markdown(Code|H[0-9]|Url|IdDeclaration|Link|Rule|Highlight[A-Za-z0-9]+)',
\ 'markdown(FencedCodeBlock|InlineCode)',
\ 'mkd(Code|Rule|Delimiter|Link|ListItem|IndentCode)',
\ 'mmdTable[A-Za-z0-9]*',
\ ],
\ 'white': [
\ 'markdown(Code|Link)',
\ ],
\ },
\ }
" Conceal-level helps for markdown documents
set conceallevel=3
" I specified a manual color for indent guides
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors = 0
"
" NERDCommenter
"
" Tell nerdcommenter to insert space after comments
let g:NERDSpaceDelims = 1
"
" Syntastic
"
" let g:syntastic_always_populate_loc_list = 0
" let g:syntastic_auto_loc_list = 0
" let g:syntastic_check_on_open = 1
" let g:syntastic_check_on_wq = 0
let g:syntastic_rust_rustc_exe = 'cargo check'
let g:syntastic_rust_rustc_fname = ''
let g:syntastic_rust_rustc_args = '--'
let g:syntastic_rust_checkers = ['rustc']
let g:syntastic_javascript_checkers = ['eslint']
"
" Javascript
"
let g:flow#enable = 0
let g:javascript_plugin_flow = 1
let g:jsx_ext_required = 0
let g:neoformat_enabled_javascript = ['prettier']
let g:neoformat_enabled_typescript = ['prettier']
let g:neoformat_enabled_markdown = ['prettier']
autocmd BufWritePre *.js Neoformat
autocmd BufWritePre *.ts Neoformat
autocmd BufWritePre *.md Neoformat
" let g:neoformat_enabled_php = ['phpcsfixer']
" autocmd BufWritePre *.php Neoformat
"
" Rust
"
let g:rustfmt_autosave = 1
let g:rustfmt_command = "rustup run nightly rustfmt"
" let g:neoformat_enabled_rust = ['rustfmt']
" autocmd BufWritePre,TextChanged,InsertLeave *.rs Neoformat
"
" UltiSnips
"
let g:UltiSnipsSnippetsDir = $HOME . '/.vim/UltiSnips/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment