Skip to content

Instantly share code, notes, and snippets.

@salbito
Created June 18, 2020 16:58
Show Gist options
  • Save salbito/edb48221e0a721409f20982883da3675 to your computer and use it in GitHub Desktop.
Save salbito/edb48221e0a721409f20982883da3675 to your computer and use it in GitHub Desktop.
call plug#begin('~/.config/nvim/plugged')
" Airline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Ale
" Plug 'w0rp/ale'
" Colorscheme
Plug 'iCyMind/NeoSolarized'
" CrtlP
Plug 'ctrlpvim/ctrlp.vim'
" FZF Search
" Plug 'junegunn/fzf', { 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" CoC
Plug 'neoclide/coc.nvim', {'branch': 'release'}
hi! default link CocErrorHighlight SpellBad
hi link CocFloating Visual
hi link CocErrorFloat Visual
hi link CocWarningFloat Visual
hi link CocInfoFloat Visual
" Python
Plug 'tell-k/vim-autopep8'
" Rust
Plug 'rust-lang/rust.vim'
" Nerdtree
Plug 'scrooloose/nerdtree', { 'on': 'NERDTree' }
" Polyglot
Plug 'sheerun/vim-polyglot'
call plug#end()
" Airline Configuration
let g:airline_theme='solarized'
let g:airline_powerline_fonts=1
" Fuzzy Search
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" nmap <c-p> :GFiles<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 --literal --files-with-matches --nocolor --hidden -g "" %s'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
if !exists(":Ag")
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag<SPACE>
endif
endif
" Rust Formatting
let g:rustfmt_autosave = 1
" suppress the annoying 'match x of y', 'The only match' and 'Pattern not
" found' messages
set shortmess+=c
" CTRL-C doesn't trigger the InsertLeave autocmd . map to <ESC> instead.
inoremap <c-c> <ESC>
" When the <Enter> key is pressed while the popup menu is visible, it only
" hides the menu. Use this mapping to close the menu and also start a new
" line.
inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
" Use <TAB> to select the popup menu:
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" VIM CONFIGURATION
" enable autoread to reload any files from files when checktime is called and the file is changed
set autoread
function! Checktime() abort
let l:winview = winsaveview()
checktime
call winrestview(l:winview)
endfunction
augroup Autoread
autocmd!
autocmd CursorHold,FocusGained,BufEnter * call Checktime()
augroup END
" Encoding
set encoding=UTF-8
" Turn Recording Off
map q <Nop>
" Set Syntax
syntax on
" set termguicolors
set background=dark
colorscheme NeoSolarized
filetype plugin indent on
set relativenumber number
set noshowmode
" Set Tabs
set tabstop=2
set shiftwidth=2
set expandtab
" Don't Display Start Message
set shortmess+=I
" No Swapfiles
set noswapfile
" No Bells
set noerrorbells
set visualbell
" Highlight Line Under Cursor
set cursorline
" Y yanks from cursor to the end of the line
nnoremap Y y$
" Set Focus On Split Window
nnoremap <C-w>s <C-w>s<C-w>w
nnoremap <C-w>v <C-w>v<C-w>w
" NerdCommenter
nnoremap <Leader>/ :call NERDCommenterToggle(0, "toggle")<CR>
" Folds
set foldmethod=syntax
set foldlevelstart=1
set foldnestmax=1
set nofoldenable
" Mouse
set mouse=a
set nocompatible
set nosmarttab
" Line Limit
set colorcolumn=121
" Shell
set shell=/usr/bin/zsh
" Tmux Fix
set t_8f=^[[38;2;%lu;%lu;%lum " Needed in tmux
set t_8b=^[[48;2;%lu;%lu;%lum " Ditto
let NERDTreeShowHidden=1
hi Normal guibg=NONE ctermbg=NONE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment