From 754429ebc1177c36a6c3a19a70969cdde2f7b467 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Wed, 26 Oct 2016 11:59:39 +0200 Subject: [PATCH] use nvim --- .bash_exports | 3 +- .config/nvim/colors/dln-light.vim | 39 ++++ .config/nvim/init.vim | 337 ++++++++++++++++++++++++++++++ 3 files changed, 378 insertions(+), 1 deletion(-) create mode 100644 .config/nvim/colors/dln-light.vim create mode 100644 .config/nvim/init.vim diff --git a/.bash_exports b/.bash_exports index ecd97c2..e28da62 100644 --- a/.bash_exports +++ b/.bash_exports @@ -13,7 +13,8 @@ export LANG=en_US.UTF-8 export HISTCONTROL=ignoreboth export HISTSIZE=3000 export WORDCHARS='*?_[]~=&;!#$%^(){}' -export EDITOR=vim +export EDITOR=nvim +export VISUAL=nvim # ssh export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock diff --git a/.config/nvim/colors/dln-light.vim b/.config/nvim/colors/dln-light.vim new file mode 100644 index 0000000..4f372b0 --- /dev/null +++ b/.config/nvim/colors/dln-light.vim @@ -0,0 +1,39 @@ +" Vim color file +" Maintainer: Daniel Lundin +" Last Change: Mon Oct 17 13:18:58 CEST 2016 + +" Set 'background' back to the default. The value can't always be estimated +" and is then guessed. +hi clear Normal +set bg& + +" Remove all existing highlighting and set the defaults. +hi clear + +" Load the syntax highlighting defaults, if it's enabled. +if exists("syntax_on") + syntax reset +endif + +let colors_name = "dln-light" + +hi LineNr ctermfg=252 cterm=italic +hi Visual ctermbg=220 +hi Search ctermbg=226 + +hi CursorLine ctermbg=255 cterm=NONE +hi CursorLineNr ctermfg=245 ctermbg=255 cterm=italic + +hi Type ctermfg=5 cterm=NONE +" hi Comment ctermfg=243 cterm=italic +hi Comment ctermfg=1 cterm=italic +hi String ctermfg=2 cterm=italic +" hi Statement ctermfg=4 cterm=NONE +hi Statement ctermfg=17 cterm=bold +hi Constant ctermfg=6 cterm=NONE +hi PreProc ctermfg=25 cterm=bold + +hi rustFuncName ctermfg=124 cterm=bold +hi rustCommentLineDoc ctermfg=137 cterm=italic +hi rustModPath ctermfg=4 cterm=NONE +" vim: sw=2 diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..425a1d5 --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,337 @@ +"" Vundle +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() + +" Plugins +Plugin 'VundleVim/Vundle.vim' +" Plugin 'bling/vim-airline' +Plugin 'chriskempson/base16-vim' +Plugin 'ctrlpvim/ctrlp.vim' +Plugin 'ervandew/supertab' +Plugin 'itchyny/lightline.vim' +Plugin 'NLKNguyen/papercolor-theme' +Plugin 'rust-lang/rust.vim' +Plugin 'scrooloose/syntastic' +Plugin 'tomtom/tcomment_vim' +Plugin 'Valloric/YouCompleteMe' + +call vundle#end() + +set timeoutlen=250 +set ttimeoutlen=200 + +filetype on " detect the type of file +filetype plugin indent on " load filetype plugins +syntax on + +set history=1000 " How many lines of history to remember +set viminfo='100,!,f1,\"100,:40,%,n~/.config/nvim/viminfo + +set isk+=_,$,@,%,#,- " none of these should be word dividers, so make them not be +set hidden +set tabstop=2 +set shiftwidth=2 +set smarttab +set expandtab +set softtabstop=2 +set autoindent +set copyindent +set smartindent " Don't mess with comments +set nojoinspaces + +set autochdir +set nofoldenable " disable folding + +" Wordwrap +" set formatoptions=l +" formatoptions: +" c - autowrap COMMENTS using textwidth +" r - insert comment leader (?) on +" o - insert comment leader on 'o' or 'O' +" q - gq formats comments (?) +" n - recon numbered lists +" v - wrap on blanks +" t - autowrap TEXT using textwidth +set fo=croqnvt + +set lbr +set backspace=eol,start,indent +"Backspace and cursor keys wrap to +set whichwrap+=<,>,h,l +set wrap + +"" GUI +set novisualbell +set noerrorbells +set ruler +set number " line numbers +set numberwidth=6 +set lz " lazy redraw +set so=7 "scope +set sidescroll=1 +set scrolloff=10 +set mouse=a +set switchbuf=usetab +set showtabline=1 +set selection=exclusive +set shortmess=atI +set wildmenu +set wildmode=list:longest +set wildignore=*.swp,*.bak,*.pyc,*.class +set splitbelow " Preview window + +"" Session +let g:session_autosave = 'no' + +"" Fancy status line. +set laststatus=2 + +"" Powerline +"set rtp+=/home/dln/.vim/bundle/powerline/powerline/bindings/vim + +"" Markers / Signature +let g:SignatureMarkTextHL="Bookmark" + +"" Minibuffer +let g:miniBufExplModSelTarget = 1 +let g:miniBufExplorerMoreThanOne = 0 +let g:miniBufExplModSelTarget = 0 +let g:miniBufExplUseSingleClick = 1 +let g:miniBufExplMapWindowNavVim = 1 +let g:miniBufExplVSplit = 25 +let g:miniBufExplSplitBelow=1 + +"" X clipboard copy paste +map ,v :r!xclip -o + + +"" Searching +set showmatch +set incsearch +set ignorecase +set smartcase +set hlsearch + +"" Use ack for grepping +set grepprg=ag +let g:ackprg='ag -H --nocolor --nogroup' + +"" Bookmarks +let g:showmarks_enable=1 +let g:showmarks_include="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +" Errormarker +let errormarker_errorgroup = "ErrorMsg" +let errormarker_warninggroup = "Todo" + +"" Highlighting +map ,H :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' + \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" + \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + +"" Hide some files +let g:explHideFiles='^\.,.*\.class$,.*\.swp$,.*\.pyc$,.*\.swo$,\.DS_Store$,/tmp/v\d\d*' +let g:explDetailedHelp=1 + +"" Backup +set backup +set backupdir=~/.vim/backup,~/.tmp,~/tmp,/var/tmp,/tmp" +set directory=~/.vim/backup,~/.tmp,~/tmp,/var/tmp,/tmp" +let myvar = strftime("%y%m%d-%H%M") +let myvar = "set backupext=_". myvar +execute myvar +au BufWritePre * let &backupext = substitute(expand("%:p"), "\/", "_", "g") + +"" CtrlP +let g:ctrlp_match_window = 'top' +" let g:ctrlp_custom_ignore = '\v[\/](.DS_Store|.sass-cache|.bundle|.git|.hg|.svn|node_modules|vendor|bower_components)$' +" let g:ctrlp_custom_ignore = '\v[\/]\.(DS_Storegit|hg|svn|optimized|compiled|node_modules|bower_components)$' + +set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.class,*/target/*,*/.git/*" +" let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' +let g:ctrlp_custom_ignore = 'node_modules$\|.lock$\|.gitkeep$\|tmp/\|bower_components$\|dist$' + + +let g:ctrlp_working_path_mode = 'ra' + +map :CtrlPBuffer +map ,` :CtrlPBuffer +map ,; :CtrlPChange +map ,e :CtrlPRoot +map ,d :CtrlPCurWD +map ,f :CtrlPMRUFiles +map ,g :CtrlPLine +map ,q :CtrlPQuickfix +map ,/ :CtrlPLine +map ,m :CtrlPBookmarkDir +map , :CtrlPBookmarkDirAdd + +"" Key bindings +imap  +inoremap :wa +nnoremap :wa + + +" C-Left, C-right +map [1;5D +map [1;5C +nnoremap b +vnoremap b +nnoremap ghb +inoremap ghb +nnoremap w +vnoremap w +nnoremap ghw +inoremap ghw + +"" Comments +map :TComment +imap + +"" SCM Stuff +let g:SCMDiffCommand = "git" +let VCSCommandDeleteOnHide = 1 +let g:git_branch_status_nogit="" +let g:git_branch_status_around="[]" +let g:git_branch_status_text="" +let g:git_branch_status_head_current=1 + +"" Buffer navigation +map ` :b# + + +"" "Turn off search highlight +map :noh +nmap ,/ :let @/="" + +"" +"" File types +"" + +au BufNewFile,BufRead manifest setlocal ft=json +au BufNewFile,BufRead *.aurora set filetype=python +au BufNewFile,BufRead *.avdl setlocal ft=avro-idl +au BufNewFile,BufRead *.avpr setlocal ft=json +au BufNewFile,BufRead *.cql set syntax=cql +au BufNewFile,BufRead *.go setlocal ft=go +au BufNewFile,BufRead *.g setlocal ft=antlr +au BufNewFile,BufRead *.js set ft=javascript +au BufNewFile,BufRead *.json setfiletype json +au BufNewFile,BufRead *.pig set filetype=pig syntax=pig +au BufNewFile,BufRead *.template setfiletype json +au BufNewFile,BufRead *.thrift setlocal ft=thrift +au BufNewFile,BufRead *.upstart set filetype=upstart +au BufNewFile,BufRead *.upstart.conf set filetype=upstart +au BufNewFile,BufRead SCons* set filetype=python + +"" JavaScript, Json +let g:vim_json_syntax_conceal = 0 + +"" Scala +autocmd BufNewFile,BufAdd,BufRead build.sbt setlocal ft=scala +autocmd BufNewFile,BufAdd,BufRead *.scala setlocal ft=scala +autocmd FileType scala setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2 + +"" Rust +autocmd FileType rust setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 + +"" Clojure +let g:paredit_mode=0 +let g:clj_highlight_builtins=1 " Highlight Clojure's builtins +let g:clj_paren_rainbow=1 " Rainbow parentheses'! + +"" Python +au FileType python + \ setlocal efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m | + \ setlocal makeprg=python\ % | + \ setlocal tabstop=4 softtabstop=4 shiftwidth=4 | + \ setlocal nosmartindent cinwords=if,elif,else,for,while,try,except,finally,def,class +autocmd BufWritePre *.py normal m`:%s/\s\+$//e `` +autocmd FileType python set omnifunc=pythoncomplete#Complete + +" pydoc integration +let g:pydoc_highlight = 0 +let python_highlight_all = 1 +let g:pcs_check_when_saving = 0 +let g:pymode_lint = 0 +let g:pymode_lint_checker = "pyflakes" + + +" YouCompleteMe +set completefunc=youcompleteme#Complete +set completeopt=preview,menuone + +" tags +set tags=./tags;/ + +" C++ + +" Add highlighting for function definition in C++ +function! EnhanceCppSyntax() + syn match cppFuncDef "::\~\?\zs\h\w*\ze([^)]*\()\s*\(const\)\?\)\?$" + hi def link cppFuncDef Special +endfunction +autocmd Syntax cpp call EnhanceCppSyntax() +autocmd FileType cpp setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2 + +" HTML +au FileType html + \ set makeprg=tidy\ -qe\ -access\ 3\ % | + \ set errorformat=line\ %l\ column\ %c\ \-\ %m +" let g:html_indent_tags .= '\|p' +" let g:html_indent_tags .= '\|li' + + +au FileType xml + \ set makeprg=tidy\ -qe\ -access\ 3\ % | + \ set errorformat=line\ %l\ column\ %c\ \-\ %m + +"" +"" Color theme +"" +if $TERM =~ '^xterm' + set t_Co=256 +elseif $TERM =~ '^screen' + set t_Co=256 " just guessing +elseif $TERM =~ '^rxvt' + set t_Co=256 +elseif $TERM =~ '^linux' + set t_Co=8 +else + set t_Co=16 +endif + +if &term =~ "xterm" || &term =~ "screen" || &term == "screen" + set t_Co=256 + if has("terminfo") + let &t_Sf=nr2char(27).'[3%p1%dm' + let &t_Sb=nr2char(27).'[4%p1%dm' + else + let &t_Sf=nr2char(27).'[3%dm' + let &t_Sb=nr2char(27).'[4%dm' + endif +endif + +" Show syntax highlight group in the status bar +map ,h :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' +\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" +\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + +set background=light +let g:PaperColor_Light_Override = { 'Background' : '#fefe00' } + +let g:lightline = { + \ 'colorscheme': 'seoul256', + \ } + +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +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 + +color dln-light +