Skip to content

Instantly share code, notes, and snippets.

@Linell

Linell/init.vim

Created Jul 28, 2020
Embed
What would you like to do?
" Plugin Setup
call plug#begin('~/.config/nvim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'cloudhead/neovim-fuzzy'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'junegunn/vim-easy-align'
Plug 'mattn/gist-vim'
Plug 'mattn/webapi-vim'
Plug 'mihaifm/bufstop'
Plug 'mileszs/ack.vim'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'vim-syntastic/syntastic'
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
Plug 'sheerun/vim-polyglot'
Plug 'vimwiki/vimwiki'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
Plug 'pechorin/any-jump.vim'
call plug#end()
set mouse=a
filetype plugin on
filetype plugin indent on
syntax on
filetype indent on
set autoindent
set autoread
set backspace=2
set clipboard=unnamed
set cursorline
set expandtab
set foldmethod=marker
set laststatus=2
set noinsertmode
set number
set ruler
set showcmd
set smartindent
set smarttab
set t_Co=256
set vb
" Split Switching
nnoremap <silent> <C-Right> <c-w>l
nnoremap <silent> <C-Left> <c-w>h
nnoremap <silent> <C-Up> <c-w>k
nnoremap <silent> <C-Down> <c-w>j
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
nnoremap <leader><space> :nohlsearch<CR>
nnoremap <CR> :noh<CR><CR>
" Big Boi Searching
nnoremap <C-p> :FuzzyOpen<CR>
" Color columns after 93 chars
set colorcolumn=93
" Actual Colorscheme Setup
color dracula
set background=dark
hi IndentGuidesOdd ctermbg=grey
hi IndentGuidesEven ctermbg=lightgrey
noremap <leader>ig :IndentGuidesToggle<CR>
" Sane code tabbing
set tabstop=2
set shiftwidth=2
" Persistent Undo
set undodir=~/.config/nvim/undodir
set undofile
" Better backups
set backupdir=~/.config/nvim/sessions
set dir=~/.config/nvim/sessions
" Session
set ssop-=options
" NERDTree
let NERDTreeChDirMode=2
let NerdTreeMinimalUI=1
noremap <leader>d :NERDTreeToggle<CR>
" ctrlp
let g:ctrlp_dont_split = 'nerdtree'
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
nmap ; :<C-u>CtrlP<cr>
nmap <leader>F :CtrlPClearAllCaches<CR>
nnoremap <C-]> :CtrlPtjump<cr>
" RipGrep / ACK
if executable('rg')
let g:ackprg = 'rg --vimgrep --no-heading'
endif
cnoreabbrev rg Ack
cnoreabbrev rG Ack
cnoreabbrev Rg Ack
cnoreabbrev RG Ack
nmap , :Rg<space>
" Syntastic
let g:syntastic_enable_balloons = 0
let g:syntastic_error_symbol=''
let g:syntastic_warning_symbol=''
let g:syntastic_stl_format='%E{💀 %fe (%e) ⮃}%W{ 💡 %fw (%w) }'
" Git Gutters
set signcolumn=yes
let g:gitgutter_eager = 0
let g:gitgutter_realtime = 0
let g:gitgutter_sign_added = ''
let g:gitgutter_sign_modified = ''
let g:gitgutter_sign_modified_removed = ''
let g:gitgutter_sign_removed = ''
" Comment Header Line
function! CommentHeader()
let times = 82 - col(".")
let line = getline(".")
let space = " "
exe ":normal A" . space . repeat("-", times)
endfunction
nnoremap <leader>- :call CommentHeader()<CR>o
" Markdown Date Insert
imap <F3> ## <C-R>=strftime("%m/%d/%Y")<CR>
" Indent Guides
let g:indent_guides_size = 1
" Easy Align
vnoremap <silent> <Enter> :EasyAlign<Enter>
" Gist-VIM
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:gist_show_privates = 1
let g:gist_post_privates = 1
let g:gist_clip_command = 'pbcopy'
" Buffer Switching
map <leader>b :Bufstop<CR>
" VimWiki Settings
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
command! Diary VimwikiDiaryIndex
"" Lame adaptation of Josh's buffer file here:
"" https://gist.github.com/dphase/1792d67b4ac06aea11a49ed801f18a7e
function! s:DScratch()
exe 'edit ~/vimwiki/Scratch Buffer.md'
endfunction
command! Scratch call s:DScratch(<f-args>)
" Remove Trailing Whitespace
" temp removed until everyone @ work can do the same
" autocmd FileType c,ruby,coffee,css,slim,scss,html,sml autocmd BufWritePre <buffer> :%s/\s\+$//e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.