Skip to content

Instantly share code, notes, and snippets.

@emiflake
Created March 25, 2019 00:15
Show Gist options
  • Save emiflake/c0ce590c018b44dad787ed1fb6678785 to your computer and use it in GitHub Desktop.
Save emiflake/c0ce590c018b44dad787ed1fb6678785 to your computer and use it in GitHub Desktop.
" show line numbers
set number
" enable mouse support
set mouse=a
" enable ruler
set ruler
" set tabs to 4 spaces
set ts=4
set softtabstop=0 noexpandtab
set shiftwidth=4
" have a distinguishing cursor line
set cursorline
" clipboard support
set clipboard=unnamedplus
" terminal
tnoremap <Esc> <C-\><C-n>
let mapleader=","
imap <C-c> <Esc>
nmap <C-c> :w<CR>
call plug#begin("~/.local/share/nvim/plugged")
Plug 'vim-airline/vim-airline'
Plug 'flazz/vim-colorschemes'
Plug 'vim-airline/vim-airline-themes'
let g:airline#extensions#tabline#enabled = 1
"Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
"Plug 'zchee/deoplete-clang'
Plug 'kien/ctrlp.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'scrooloose/nerdcommenter'
Plug 'ntpeters/vim-better-whitespace'
nmap <Leader>f :StripWhitespace<CR>
Plug 'airblade/vim-gitgutter'
Plug 'machakann/vim-highlightedyank'
" LSP + Autocomplete
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-vim-lsp'
Plug 'aurieh/discord.nvim', { 'do': ':UpdateRemotePlugins'}
call plug#end()
" colourschemes for nivm + airline
colorscheme molokai
set termguicolors
let g:airline_theme='molokai'
" make undos available throughout saves
set undofile
set undodir=/tmp
set autoindent
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
au CursorMoved * match OverLength /\%81v.\+/
" sort alpha
vnoremap <Leader>s :'<,'>!sort -f<CR>
" make commands
nnoremap <Leader>m :let &makeprg=""<left>
nnoremap <silent> <Leader>b :cclose<CR>:silent !clear<CR>:make<CR>
" lsp stuff
autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone,noselect
nmap <Leader>r :LspRename<CR>
nmap <Leader>d :LspDefinition<CR>
nmap <Leader>g :LspImplementation<CR>
" tmux-like split bindings
nmap <C-a>\| :vsp<CR>
nmap <C-a>- :sp<CR>
" C support with Clang
if executable('clangd')
au User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': {server_info->['clangd']},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
\ })
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment