Skip to content

Instantly share code, notes, and snippets.

@greister
Created December 16, 2017 16:31
Show Gist options
  • Select an option

  • Save greister/067e94041b8b027dd1e9d9fc6844a7d1 to your computer and use it in GitHub Desktop.

Select an option

Save greister/067e94041b8b027dd1e9d9fc6844a7d1 to your computer and use it in GitHub Desktop.
neovim configuration
" vim:foldmethod=marker:foldlevel=0
" Vundle {{{
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.nvim/bundle/Vundle.vim
call vundle#begin('~/.nvim/bundle')
" alternatively, pass a path where Vundle should install plugin
"call vundle#begin('~/some/path/here')
Plugin 'gmarik/Vundle.vim' " let Vundle manage Vundle, required
" color scheme
Plugin 'chriskempson/base16-vim'
" syntax highlighting
Plugin 'peterhoeg/vim-qml'
Plugin 'artoj/qmake-syntax-vim'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'rust-lang/rust.vim'
Plugin 'tikhomirov/vim-glsl'
" auto complete
Plugin 'Valloric/YouCompleteMe'
"Plugin 'rdnetto/YCM-Generator'
Plugin 'fatih/vim-go'
Plugin 'davidhalter/jedi-vim'
Plugin 'ervandew/supertab'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'phildawes/racer'
" navigation/search file
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'rking/ag.vim'
Plugin 'dkprice/vim-easygrep'
" editing
Plugin 'scrooloose/nerdcommenter'
Plugin 'tpope/vim-surround'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-repeat'
" better statusline
Plugin 'bling/vim-airline'
" git management plugin
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" }}} Vundle
" Colors {{{
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
syntax enable " enable syntax processing
colorscheme base16-ocean
set background=dark
" }}} Colors
" Spaces & Tabs {{{
set tabstop=4 " number of visual spaces per TAB
set softtabstop=4 " number of spaces in tab when editing
set shiftwidth=4 " number of spaces to use for autoindent
set expandtab " tabs are space
set autoindent
set copyindent " copy indent from the previous line
" }}} Spaces & Tabs
" UI Config {{{
set hidden
set number " show line number
set showcmd " show command in bottom bar
set cursorline " highlight current line
set wildmenu " visual autocomplete for command menu
set showmatch " highlight matching brace
set laststatus=2 " window will always have a status line
set nobackup
set noswapfile
let &colorcolumn="80,".join(range(100,999),",")
" }}} UI Config
" Search {{{
set incsearch " search as characters are entered
set hlsearch " highlight matche
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is lower case
" case-sensitive otherwise
" set Ag as the grep command
if executable('ag')
" Note we extract the column as well as the file and line number
set grepprg=ag\ --nogroup\ --nocolor\ --column
set grepformat=%f:%l:%c%m
endif
" }}} Search
" Folding {{{
set foldenable
set foldlevelstart=10 " default folding level when buffer is opened
set foldnestmax=10 " maximum nested fold
set foldmethod=syntax " fold based on indentation
" }}} Folding
" Leader & Mappings {{{
let mapleader="," " leader is comma
" edit/reload vimrc
nmap <leader>ev :e $MYVIMRC<CR>
nmap <leader>sv :so $MYVIMRC<CR>
" better ESC
inoremap jj <esc>
" fast save and close
nmap <leader>w :w<CR>
nmap <leader>x :x<CR>
nmap <leader>q :q<CR>
" insert blank line before current line without leaving insert mode
imap <leader>o <c-o><s-o>
" move up/down consider wrapped lines
nnoremap j gj
nnoremap k gk
" fix indentation
nnoremap <leader>i mzgg=G`z<CR>
" turn off search highlights
nnoremap <leader><space> :nohlsearch<CR>
" move through grep results
nmap <silent> <right> :cnext<CR>
nmap <silent> <left> :cprev<CR>
" buffers
nnoremap <tab> :bn<CR>
nnoremap <s-tab> :bp<CR>
nnoremap <leader>bd :bd<CR>
" split navigation
nnoremap <c-j> <c-w><c-j>
nnoremap <c-k> <c-w><c-k>
nnoremap <c-l> <c-w><c-l>
nnoremap <c-h> <c-w><c-h>
" fast header source switch
map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
" NERDTree mappings {{{
map <C-n> :NERDTreeToggle<CR>
" }}}
" YCM mappings {{{
nnoremap <leader>g :YcmCompleter GoTo<CR>
" }}}
" }}}
" NERDTree {{{
let NERDTreeShowHidden=1
let NERDTreeIgnore = ['\.pyc$', '__pycache__']
" }}}
" Cpp Enhanced Highlighting {{{
let g:cpp_class_scope_highlight = 1
" }}}
" Airline {{{
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
" }}}
" YCM {{{
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
let g:ycm_filetype_blacklist = {
\ 'python': 1
\}
let g:ycm_filetype_specific_completion_to_disable = {
\ 'gitcommit': 1
\}
" }}}
" Racer {{{
let $RUST_SRC_PATH="/home/synasius/workspace/rust/src/"
" }}}
" Functions {{{
" trailing whitespace
match ErrorMsg '\s\+$'
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
autocmd BufWritePre * :call TrimWhiteSpace()
" }}}
" vim:foldmethod=marker:foldlevel=0
" Vundle {{{
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugin
"call vundle#begin('~/some/path/here')
Plugin 'gmarik/Vundle.vim' " let Vundle manage Vundle, required
" color scheme
Plugin 'chriskempson/base16-vim'
" syntax highlighting
Plugin 'peterhoeg/vim-qml'
Plugin 'artoj/qmake-syntax-vim'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'rust-lang/rust.vim'
Plugin 'tikhomirov/vim-glsl'
" auto complete
Plugin 'Valloric/YouCompleteMe'
Plugin 'rdnetto/YCM-Generator'
"Plugin 'davidhalter/jedi-vim'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'phildawes/racer'
" navigation/search file
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'rking/ag.vim'
Plugin 'dkprice/vim-easygrep'
" editing
Plugin 'scrooloose/nerdcommenter'
Plugin 'tpope/vim-surround'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-repeat'
" better statusline
Plugin 'bling/vim-airline'
" git management plugin
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
" notes
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-notes'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" }}} Vundle
" Colors {{{
syntax enable " enable syntax processing
set background=dark
colorscheme base16-default
let base16colorspace=256
set t_Co=256
" }}} Colors
" Spaces & Tabs {{{
set tabstop=4 " number of visual spaces per TAB
set softtabstop=4 " number of spaces in tab when editing
set shiftwidth=4 " number of spaces to use for autoindent
set expandtab " tabs are space
set autoindent
set copyindent " copy indent from the previous line
" }}} Spaces & Tabs
" UI Config {{{
set hidden
set number " show line number
set showcmd " show command in bottom bar
set cursorline " highlight current line
set wildmenu " visual autocomplete for command menu
set showmatch " highlight matching brace
set laststatus=2 " window will always have a status line
set nobackup
set noswapfile
" }}} UI Config
" Search {{{
set incsearch " search as characters are entered
set hlsearch " highlight matche
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is lower case
" case-sensitive otherwise
" set Ag as the grep command
if executable('ag')
" Note we extract the column as well as the file and line number
set grepprg=ag\ --nogroup\ --nocolor\ --column
set grepformat=%f:%l:%c%m
endif
" }}} Search
" Folding {{{
set foldenable
set foldlevelstart=10 " default folding level when buffer is opened
set foldnestmax=10 " maximum nested fold
set foldmethod=syntax " fold based on indentation
" }}} Folding
" Leader & Mappings {{{
let mapleader="," " leader is comma
" edit/reload vimrc
nmap <leader>ev :e $MYVIMRC<CR>
nmap <leader>sv :so $MYVIMRC<CR>
" better ESC
inoremap jj <esc>
" fast save and close
nmap <leader>w :w<CR>
nmap <leader>x :x<CR>
nmap <leader>q :q<CR>
" insert blank line before current line without leaving insert mode
imap <leader>o <c-o><s-o>
" move up/down consider wrapped lines
nnoremap j gj
nnoremap k gk
" fix indentation
nnoremap <leader>i mzgg=G`z<CR>
" turn off search highlights
nnoremap <leader><space> :nohlsearch<CR>
" move through grep results
nmap <silent> <right> :cnext<CR>
nmap <silent> <left> :cprev<CR>
" buffers
nnoremap <tab> :bn<CR>
nnoremap <s-tab> :bp<CR>
nnoremap <leader>bd :bd<CR>
" split navigation
nnoremap <c-j> <c-w><c-j>
nnoremap <c-k> <c-w><c-k>
nnoremap <c-l> <c-w><c-l>
nnoremap <c-h> <c-w><c-h>
" fast header source switch
map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
" YCM mappings {{{
nnoremap <leader>g :YcmCompleter GoTo<CR>
" }}}
" NERDTree mappings {{{
map <C-n> :NERDTreeToggle<CR>
" }}}
" }}}
" NERDTree {{{
let NERDTreeShowHidden=1
let NERDTreeIgnore = ['\.pyc$', '__pycache__']
" }}}
" YCM {{{
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
let g:ycm_filetype_specific_completion_to_disable = {
\ 'gitcommit': 1
\}
" }}}
" UltiSnips {{{
let g:UltiSnipsExpandTrigger="<leader>e"
let g:UltiSnipsJumpForwardTrigger="<leader>b"
let g:UltiSnipsJumpBackwardTrigger="<leader>z"
" }}}
" Cpp Enhanced Highlighting {{{
let g:cpp_class_scope_highlight = 1
" }}}
" Airline {{{
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
" }}}
" Racer {{{
let $RUST_SRC_PATH="/home/synasius/workspace/rust/src/"
" }}}
" Functions {{{
" trailing whitespace
match ErrorMsg '\s\+$'
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
autocmd BufWritePre * :call TrimWhiteSpace()
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment