Skip to content

Instantly share code, notes, and snippets.

@codyjroberts
Last active June 5, 2017 12:38
Show Gist options
  • Save codyjroberts/2b873ee0bdb27e8192aa1e5836761f3b to your computer and use it in GitHub Desktop.
Save codyjroberts/2b873ee0bdb27e8192aa1e5836761f3b to your computer and use it in GitHub Desktop.
Example nvim config
" Bundles
call plug#begin('~/.config/nvim/pluggable')
Plug 'unblevable/quick-scope'
Plug 'Lokaltog/vim-easymotion'
Plug 'itchyny/lightline.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'Yggdroot/indentLine'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'vim-scripts/tComment'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-unimpaired'
Plug 'junegunn/limelight.vim'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/vim-github-dashboard'
Plug 'mhinz/vim-signify'
Plug 'ap/vim-css-color'
Plug 'powerman/vim-plugin-AnsiEsc'
Plug 'honza/vim-snippets'
Plug 'SirVer/ultisnips'
Plug 'michaeljsmith/vim-indent-object'
" Fuzzy Search
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" Neovim
if has('nvim')
Plug 'kassio/neoterm'
Plug 'neomake/neomake'
function! DoRemote(arg)
UpdateRemotePlugins
endfunction
Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') }
Plug 'zchee/deoplete-go', { 'do': 'make', 'for': 'go'}
Plug 'zchee/deoplete-jedi', { 'for': 'python' }
endif
" Git
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
" C++
Plug 'octol/vim-cpp-enhanced-highlight', { 'for': 'cpp' }
" Rust
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
" Go
Plug 'fatih/vim-go', { 'for': 'go' }
" Java
Plug 'artur-shaik/vim-javacomplete2', { 'for': 'java' }
" Scala
Plug 'derekwyatt/vim-scala', { 'for': 'scala' }
" Ruby
Plug 'kana/vim-textobj-user', { 'for': 'ruby' }
Plug 'nelstrom/vim-textobj-rubyblock', { 'for': 'ruby' }
Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
Plug 'tpope/vim-rails', { 'for': 'ruby' }
Plug 'tpope/vim-rake', { 'for': 'ruby' }
Plug 'tpope/vim-bundler', { 'for': 'ruby' }
Plug 'hwartig/vim-seeing-is-believing', { 'for': 'ruby' }
" Elixir
Plug 'elixir-lang/vim-elixir', { 'for': 'elixir' }
Plug 'slashmili/alchemist.vim', { 'for': 'elixir' }
" JS
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
" Themes
Plug 'junegunn/seoul256.vim'
call plug#end()
let mapleader = ","
set autoindent
set autoread
set formatoptions=""
set ignorecase
set mouse=""
set showmatch
set smartcase
set title
set ttimeout
set ttimeoutlen=100
set undolevels=1000
set visualbell
set wildmenu
set nowrap
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
syntax enable
colorscheme seoul256
" 80char limit highlight
hi OverFlow ctermfg=red guifg=red
match OverFlow /\%>79v.*\%<81v/
" Always use vertical diffs
set diffopt+=vertical
" Softtabs, 2 spaces
autocmd FileType * set tabstop=2|set shiftwidth=2|set shiftround|set expandtab
" jk | Escaping!
inoremap jk <Esc>
xnoremap jk <Esc>
cnoremap jk <C-c>
" Display extra whitespace
autocmd FileType * set list listchars=tab:»·,trail:·,nbsp:·
autocmd FileType go set nolist
" Use one space, not two, after punctuation.
set nojoinspaces
" Numbers
set relativenumber
set numberwidth=2
" 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>
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
filetype plugin indent on
augroup vimrcEx
autocmd!
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd BufRead,BufNewFile .{jscs,jshint,eslint}rc set filetype=json
augroup END
" Set spellfile to location that is guaranteed to exist, can be symlinked to
" Dropbox or kept in Git and managed outside of thoughtbot/dotfiles using rcm.
" set spellfile=$HOME/.vim-spell-en.utf-8.add
" Autocomplete with dictionary words when spell check is on
set complete+=kspell
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Bindings "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>ff :FZF<CR>
nnoremap <leader>fg :GFiles<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Other Settings "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ----------------------------------------------------------------------------
" Neovim Terminal
" ----------------------------------------------------------------------------
highlight TermCursor ctermfg=red guifg=red
au BufEnter * if &buftype == 'terminal' | :startinsert | endif
tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-h> <C-\><C-n><C-w>h
tnoremap <C-k> <C-\><C-n><C-w>k
tnoremap <C-l> <C-\><C-n><C-w>l
" ----------------------------------------------------------------------------
" FZF
" ----------------------------------------------------------------------------
" let g:fzf_layout = { 'down': '30%' }
function! s:fzf_statusline()
" Override statusline as you like
highlight fzf1 ctermfg=161 ctermbg=251
highlight fzf2 ctermfg=23 ctermbg=251
highlight fzf3 ctermfg=237 ctermbg=251
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction
autocmd! User FzfStatusLine call <SID>fzf_statusline()
if has('nvim')
let $FZF_DEFAULT_OPTS .= ' --inline-info'
"let $NVIM_TUI_ENABLE_TRUE_COLOR = 1
endif
" ----------------------------------------------------------------------------
" Markdown
" ----------------------------------------------------------------------------
let g:markdown_fenced_languages = ['css', 'javascript', 'js=javascript', 'json=javascript', 'ruby', 'go', 'c']
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Functions! "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment