Skip to content

Instantly share code, notes, and snippets.

@riccardosven
Last active January 12, 2018 13:16
Show Gist options
  • Select an option

  • Save riccardosven/4b68a01ab6079006a267 to your computer and use it in GitHub Desktop.

Select an option

Save riccardosven/4b68a01ab6079006a267 to your computer and use it in GitHub Desktop.
My nvim.init file
" vim: fdm=marker
" An example for a vimrc file.
"
" To use it, copy it to
" for Unix: $XDG_CONFIG_HOME/nvim/init.vim
" for Windows: %LOCALAPPDATA%\nvim\init.vim
" Dein: {{{
if &compatible
set nocompatible
endif
"set runtimepath^=$XDG_CONFIG_HOME/nvim/dein/repos/github.com/Shougo/dein.vim
set runtimepath^=$XDG_CONFIG_HOME/nvim/dein/repos/github.com/Shougo/dein.vim
call dein#begin(expand('$XDG_CONFIG_HOME/nvim/dein'))
call dein#add('Shougo/dein.vim')
call dein#add('Shougo/neosnippet.vim')
call dein#add('Shougo/neosnippet-snippets')
"call dein#add('Shougo/deoplete.nvim')
call dein#add('haya14busa/incsearch.vim')
call dein#add('haya14busa/dein-command.vim')
call dein#add('JuliaEditorSupport/julia-vim')
"call dein#add('mhartington/oceanic-next')
call dein#add('jpo/vim-railscasts-theme')
call dein#add('vim-airline/vim-airline')
call dein#add('vim-airline/vim-airline-themes')
call dein#add('altercation/vim-colors-solarized')
call dein#add('scrooloose/syntastic')
call dein#add('lervag/vimtex')
"call dein#add('gerw/vim-latex-suite',{'on_ft': ['tex']})
" Finish off dein stuff
call dein#end()
" }}}
" Editor: {{{
syntax on
filetype plugin indent on
let mapleader=','
let maplocalleader=','
set scrolloff=10
set dir=/tmp
set mouse=a " Do not select linenumbers with mouse
set equalalways " Equalize spilts
set iskeyword+=:,- " For vim-latex suite???
set ruler laststatus=2 showcmd showmode number
set relativenumber " Lazy
set whichwrap=hl " Wrap with left and right
set columns=80 " End of lines...
set colorcolumn=80 " ...with highlight
set cursorline " Highlight cursor row
set cursorcolumn " Highlight cursor column
set backup " keep a backup file (restore to previous version)
set backupdir=/tmp
set undofile " keep an undo file (undo changes after closing)
set undodir=$XDG_CONFIG_HOME/.nvim/undo
set undolevels=1000
set undoreload=20000
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set formatoptions=o " Autocomment on 'o'
set formatoptions+=r " Autocomments on newline
set formatoptions+=j " Remove comment on join
set formatoptions+=c " Break comments on 'textwidth'
set formatoptions+=q " Format comments with gq
set formatoptions+=t " Break text on 'textwidth' (consider moving to ft)
set formatoptions+=2 " Autoindent on second line of paragraph
command W :w " Writesudo
command Wsudo :w !sudo tee %
"}}}
" Keyboard Mappings: {{{
nnoremap <space> za
" }}}
" Vimtex: {{{
call vimtex#imaps#add_map({'lhs':'/','rhs':'\frac','wrapper':'vimtex#imaps#wrap_math'})
let g:tex_flavor = 'latex'
let g:vimtex_view_method='zathura'
let g:vimtex_latexmk_progname='nvr'
let vimtex_view_zathura_options=''
nnoremap <localleader>wc :VimtexWordCount<cr>
"
"}}}
" Incsearch: {{{
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" automatic nohlsearch
set hlsearch
let g:incsearch#auto_nohlsearch = 1
let g:incsearch#consistent_n_direction = 1
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)
" }}}
" Syntastic: {{{
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_tex_checkers = ['chktex']
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
"}}}
" Vim Airline: {{{
:let g:airline_powerline_fonts = 1
:let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_symbols = get(g:, 'airline_symbols', {})
let g:airline_symbols.space = "\ua0"
"}}}
" Theme {{{
syntax enable
"set background=dark
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
"colorscheme OceanicNext
colorscheme railscasts
let g:airline_theme='murmur'
" }}}
" Neosnippets:{{{
" let g:neosnippet#enable_snipmate_compatibility = 1
let g:neosnippet#snippets_directory = '$XDG_CONFIG_HOME/nvim/snippets'
" Plugin key-mappings.
"imap <C-k> <Plug>(neosnippet_expand_or_jump)
"smap <C-k> <Plug>(neosnippet_expand_or_jump)
"xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
imap <expr><TAB>
\ pumvisible() ? "\<C-n>" :
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" inoremap <silent><expr> EEQ neosnippet#expand('equation')
" inoremap <silent><expr> EES neosnippet#expand('equation*')
" inoremap <silent><expr> EFI neosnippet#expand('figure')
" inoremap <silent><expr> SSE neosnippet#expand('section')
" inoremap <silent><expr> SSS neosnippet#expand('subsection')
" }}}
" Autocmd: {{{
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
autocmd!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") |
\ execute "normal! g`\"" |
\ endif
augroup END
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
" }}}
" Deoplete:{{{
"set runtimepath+=$XDG_CONFIG_HOME/nvim/dein_home/repos/github.com/Shougo/deoplete.vim
let g:deoplete#enable_at_startup = 1
" }}}
" Python{{{
let g:python_host_prog="/usr/bin/python2.7"
let g:python3_host_prog="/usr/bin/python3"
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment