Skip to content

Instantly share code, notes, and snippets.

@spikensbror
Last active December 29, 2018 01:14
Show Gist options
  • Save spikensbror/0a3b0af8eaaa1449234e140b7e965b94 to your computer and use it in GitHub Desktop.
Save spikensbror/0a3b0af8eaaa1449234e140b7e965b94 to your computer and use it in GitHub Desktop.
Neovim configuration file
" About
" The movement keys have been remapped so that they respond to JKLÖ instead of HJKL, this
" goes for window navigation as well (ctrl+w).
" :call SetupWorkspace() can be invoked to setup a terminal on the bottom as well as two
" vertical splits on top.
" ctrl+r can be used instead of F5 in ctrlp.
" ctrl+f can be used to invoke YCM's FixIt function.
" :terminal can be escaped using the escape key and uses powershell.
" :Vex and :Sex (haha...) opens a configured netrw file browser.
" Plugins
call plug#begin('~/vim-plugins')
" Windows:
" Install Node with npm and make sure it is added to the PATH.
" Install CMake and make sure it is added to the PATH.
" Install Visual Studio Community edition with C++ support.
" Install Python3 along with pip and make sure it is added to the PATH.
" General
" npm install -g neovim
" pip3 install neovim
" TypeScript
" npm install -g typescript
" npm install -g tslint
" npm install -g typescript-tslint-plugin (See project page for this for info on how to setup for project.)
" Utilities
Plug 'kien/ctrlp.vim'
Plug 'qpkorr/vim-bufkill'
Plug 'Valloric/YouCompleteMe'
"Plug 'w0rp/ale'
" Javascript
Plug 'pangloss/vim-javascript'
Plug 'elzr/vim-json'
" Markdown
Plug 'plasticboy/vim-markdown'
" HTML
Plug 'othree/html5.vim'
" Color schemes
Plug 'morhetz/gruvbox'
" Typescript
Plug 'HerringtonDarkholme/yats.vim'
call plug#end()
" Navigation
noremap h <NOP>
noremap j <Left>
noremap k <Down>
noremap l <Up>
noremap <Char-0x00F6> <Right>
" Window operations
nnoremap <C-w>h <NOP>
nnoremap <C-w>j <C-w><C-h>
nnoremap <C-w>k <C-w><C-j>
nnoremap <C-w>l <C-w><C-k>
nnoremap <C-w><Char-0x00F6> <C-w><C-l>
nnoremap <C-w>J <C-w><
nnoremap <C-w>K <C-w>-
nnoremap <C-w>L <C-w>+
nnoremap <C-w><Char-0x00D6> <C-w>>
" Terminal
tnoremap <Esc> <C-\><C-n> " Escape from terminal mode
" Text
set number
set encoding=utf-8
set backspace=2
set expandtab
set smartindent
set shiftwidth=2
set softtabstop=2
set colorcolumn=80
set nowrap
set clipboard=unnamedplus
" ALE
" ALE has been removed as it does nothing that YCM won't do. AKA I didn't get it to work,
" it might work fine if I use it exclusively without YCM.
"let g:ale_linters = {
" \ 'javascript': ['eslint'],
" \ 'typescript': ['eslint', 'tsserver'],
" \}
"let g:ale_history_log_output = 1
" Autocompletion
filetype plugin on
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_collect_identifiers_from_tags_files = 1
noremap <C-f> :YcmCompleter FixIt<CR>
" File browsing
let g:ctrlp_prompt_mappings = {
\ 'PrtClearCache()': ['<F5>', '<C-r>'],
\}
let g:ctrlp_custom_ignore = 'node_modules\|git'
let g:netrw_liststyle = 0
let g:netrw_banner = 0
let g:netrw_browse_split = 4
let g:netrw_winsize = 25
" Syntax highlighting
syntax on
set termguicolors
colors gruvbox
set bg=dark
" Shell
set shell=powershell
" Setup workspace for 1920x1080 fullscreen.
function SwitchWindow(dir)
let this = winnr()
if '+' == a:dir
execute "normal \<c-w>k"
elseif '-' == a:dir
execute "normal \<c-w>j"
elseif '>' == a:dir
execute "normal \<c-w>l"
elseif '<' == a:dir
execute "normal \<c-w>h"
else
echo "oops. check your ~/.vimrc"
return ""
endif
endfunction
function SetupWorkspace()
45spl
vspl
"Vex
call SwitchWindow('+')
terminal
call SwitchWindow('>')
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment