Skip to content

Instantly share code, notes, and snippets.

@jserpapinto
Created August 9, 2019 14:30
Show Gist options
  • Save jserpapinto/fa52dc07501d4cb1ba3e9b7f94180002 to your computer and use it in GitHub Desktop.
Save jserpapinto/fa52dc07501d4cb1ba3e9b7f94180002 to your computer and use it in GitHub Desktop.
NeoVim ~/.config/nvim/init.vim with vim-plug
let mapleader=" "
nnoremap <SPACE> <Nop>
set nocompatible " be iMproved, required
filetype off " required
call plug#begin()
Plug 'scrooloose/nerdTree'
nmap <C-n> :NERDTreeToggle<CR>
Plug 'tpope/vim-surround'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'bling/vim-airline'
Plug 'hashivim/vim-terraform' " terraform
Plug 'tpope/vim-fugitive' " git plugin
Plug 'hashivim/vim-terraform' " terraform
Plug 'vim-syntastic/syntastic' " vim-terraform-completion dependency
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
Plug 'juliosueiras/vim-terraform-completion' " terraform completion
Plug 'junegunn/fzf' " fuzzy finder
Plug 'junegunn/fzf.vim' " fuzzy finder
nmap ; :Buffers<CR>
nmap <Leader>f :Files<CR>
nmap <Leader>t :Tags<CR>
Plug 'itchyny/lightline.vim' " colors for modes
set laststatus=2
Plug 'scrooloose/nerdtree' " NERDTree
map <Leader>n :NERDTreeToggle<CR>
Plug 'airblade/vim-gitgutter' " also for git
set updatetime=500
Plug 'pearofducks/ansible-vim'
au BufRead,BufNewFile */{playbooks,plays}/*.yml set filetype=yaml.ansible
au BufRead,BufNewFile */templates/* set filetype=ruby.jinja2
Plug 'vim-scripts/indentpython.vim' " Python
Plug 'Valloric/YouCompleteMe'
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
Plug 'nvie/vim-flake8'
call plug#end()
" As seen here: https://dougblack.io/words/a-good-vimrc.html
colorscheme badwolf " awesome colorscheme
syntax enable " enable syntax processing
set tabstop=2 shiftwidth=2 expandtab " number of visual spaces per TAB
set softtabstop=2 " number of spaces in tab when editing
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab " Get the 2-space YAML as the default when hit carriage return after the colon
set nu rnu " show line numbers
set showcmd " show command in bottom bar
set cursorline " highlight current line
filetype indent on " load filetype-specific indent files
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when we need to.
set showmatch " highlight matching [{()}]
set incsearch " search as characters are entered
set hlsearch " highlight matches
" turn off search highlight
nnoremap <leader><space> :nohlsearch<CR>
" move vertically by visual line
nnoremap j gj
nnoremap k gk
" highlight last inserted text
nnoremap gV `[v`]
set mouse=a
" Python
au BufNewFile,BufRead *.py
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79
\ set expandtab
\ set autoindent
\ set fileformat=unix
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/<Paste>
set encoding=utf-8
" python with virtualenv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
let python_highlight_all=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment