Skip to content

Instantly share code, notes, and snippets.

@letmein
Created December 19, 2015 11:51
Show Gist options
  • Save letmein/ce087de78c01565b2011 to your computer and use it in GitHub Desktop.
Save letmein/ce087de78c01565b2011 to your computer and use it in GitHub Desktop.
neovim config
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
filetype plugin on
filetype indent on
syntax on
"set hlsearch
set tabstop=2
set expandtab
set list
set listchars=tab:>.
set sw=2
set background=dark
set number
set nowrap
set ruler
set noswapfile
set cursorline
colorscheme my
autocmd VimEnter * AirlineTheme lucius
autocmd BufNewFile,BufReadPost *.coffee setlocal sw=2 tabstop=2 expandtab
autocmd BufNewFile,BufReadPost *.slim setlocal sw=2 tabstop=2 expandtab
highlight ExtraWhitespace guibg=#660000
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
autocmd BufWinEnter *.rb,*.coffee,*.slim let w:m2=matchadd('ErrorMsg', '\%>100v.\+', -1)
" -------------------------------------------------------------------
" PLUGINS
" -------------------------------------------------------------------
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fugitive'
Plug 'junegunn/vim-easy-align'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'https://github.com/rking/ag.vim'
Plug 'https://github.com/kchmck/vim-coffee-script'
Plug 'https://github.com/digitaltoad/vim-jade'
Plug 'https://github.com/slim-template/vim-slim'
Plug 'bling/vim-airline'
Plug 'git://github.com/kana/vim-textobj-user.git'
Plug 'git://github.com/nelstrom/vim-textobj-rubyblock.git'
Plug 'https://github.com/Shougo/unite.vim'
Plug 'https://github.com/yuku-t/unite-git'
call plug#end()
" -------------------------------------------------------------------
" KEY MAPPINGS
" -------------------------------------------------------------------
" Toggle NerdTree
nnoremap <silent> <S-Tab> :NERDTreeToggle<CR>
" Open the buffer list
nnoremap <Leader>b :Unite -vertical buffer<CR>
" Search files
nnoremap <Leader>f :Unite -start-insert -vertical git_cached<CR>
" Turn off the search highlighting on enter
" still buggy in nvim, thus disabled
" nmap <CR> :noh<CR><CR>
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Show diff between 2 splits
nnoremap <silent> <Leader>d :call DiffToggle()<CR>
" The ! overwrites any existing definition by this name.
function! DiffToggle()
if &diff
windo diffoff
else
windo diffthis
endif
:endfunction
" Insert the current filename with full path
inoremap \fn <C-R>=expand("%:p")<CR>
" Search the selected text with Ag
vnoremap // y :Ag <C-R>"<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment