From b85fe9763068078b622baf22ee98b54b5e008385 Mon Sep 17 00:00:00 2001 From: neodarz Date: Thu, 5 Sep 2019 09:17:07 +0200 Subject: Add nvim config --- README.md | 1 + config.yaml | 4 + dotfiles/config/nvim/init.vim | 526 ++++++++++++++++++++++++++++++++++++++++++ install.sh | 12 + 4 files changed, 543 insertions(+) create mode 100644 dotfiles/config/nvim/init.vim diff --git a/README.md b/README.md index 0a9cd9e..860ea0f 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ msmtp > smtp client config newsboat > rss feeds client config notmuch > notmuch mail system config + nvim > neovim config scripts > misc scripts systemd > user services for differents application ``` diff --git a/config.yaml b/config.yaml index 4246b0d..652c9c9 100644 --- a/config.yaml +++ b/config.yaml @@ -48,6 +48,9 @@ dotfiles: f_notmuch-config: src: notmuch-config dst: ~/.notmuch-config + f_init.vim: + src: config/nvim/init.vim + dst: ~/.config/nvim/init.vim profiles: unicorn: dotfiles: @@ -66,6 +69,7 @@ profiles: - f_muttrc - d_newsboat - f_notmuch-config + - f_init.vim fenec: dotfiles: - d_i3pystatus diff --git a/dotfiles/config/nvim/init.vim b/dotfiles/config/nvim/init.vim new file mode 100644 index 0000000..f45a03c --- /dev/null +++ b/dotfiles/config/nvim/init.vim @@ -0,0 +1,526 @@ +let g:python_host_prog='/usr/bin/python' + + +""""""" Plugin management stuff """"""" +set nocompatible +filetype off + +set rtp+=~/.config/nvim/bundle/Vundle.vim +call vundle#begin('~/.config/nvim/bundle') + +" Plugin manager +Plugin 'VundleVim/Vundle.vim' + +" Custom plugins... +" EasyMotion - Allows (b|e) to jump to (b)eginning or (end) +" of words. +"Plugin 'easymotion/vim-easymotion' +" Ctrl-P - Fuzzy file search +"Plugin 'kien/ctrlp.vim' +" Neomake build tool (mapped below to ) +"Plugin 'benekastah/neomake' + +" Autocomplete for python +"Plugin 'davidhalter/jedi-vim' +" Remove extraneous whitespace when edit mode is exited +"Plugin 'thirtythreeforty/lessspace.vim' + +" Screen splitter. Cool, but doesn't work with nvim. +"Plugin 'ervandew/screen' + +" LaTeX editing +Plugin 'LaTeX-Box-Team/LaTeX-Box' + +" Status bar mods +Plugin 'bling/vim-airline' +Plugin 'airblade/vim-gitgutter' + +" Tab completion +Plugin 'ervandew/supertab' + +" Syntax for openscad files +Plugin 'sirtaj/vim-openscad' + +" NERDtree plugin +Plugin 'scrooloose/nerdtree' + +" NERDTree git plugin +Plugin 'Xuyuanp/nerdtree-git-plugin' + +" Global Auto Completion +"Plugin 'ajh17/VimCompletesMe' + +" Plugin for complete like an IDE +Plugin 'Valloric/YouCompleteMe' + +" Use this plugin if use YouCompleteMe +" Autoclose thnings like brackets +Plugin 'Raimondi/delimitMate' + +" PHP Auto Completion +"Plugin 'shawncplus/phpcomplete.vim' + +" Better syntax and highlighting +Plugin 'pangloss/vim-javascript' + +" Syntax checker +Plugin 'scrooloose/syntastic' + +" Git command managament from nvim +"Plugin 'tpope/vim-fugitive' +Plugin 'lambdalisue/gina.vim' + +" Git plugin of fugitive plugin for view log of git +Plugin 'gregsexton/gitv' + +" View tree of the file historic +Plugin 'mbbill/undotree' + +" Ack search tool +" Read more here : https://github.com/mileszs/ack.vim#can-i-use-ag-the-silver-searcher-with-this +Plugin 'mileszs/ack.vim' + +" matchit +"Plugin 'isa/vim-matchit' + +" Unicode completion + Plugin 'chrisbra/unicode.vim' + +" Colorize text for exemple #fff +Plugin 'chrisbra/Colorizer' + +" html5 syntax +Plugin 'othree/html5.vim' + +" Markdon hightlighting +"Plugin 'gabrielelana/vim-markdown' + +" Autoformat +"Plugin 'Chiel92/vim-autoformat' + +" Quicly form javascript, html and css tool +Plugin 'maksimr/vim-jsbeautify' + +" reStructuredText syntax +Plugin 'marshallward/vim-restructuredtext' + +" Java complete tool +Plugin 'artur-shaik/vim-javacomplete2' + +" TypeScript syntac +Plugin 'leafgarland/typescript-vim' + +" TypeScript IDE +Plugin 'Quramy/tsuquyomi' + +" Linter for TypeScript +"Plugin 'palantir/tslint' + +"Plugin 'FredKSchott/CoVim' + +" Collaborative vim tool +"Plugin 'makerforceio/CoVim' + +" Twig syntax for vim +Plugin 'lumiliet/vim-twig' + +" Expanding abbreviations similar to emmet +Plugin 'mattn/emmet-vim' + +" Scss syntax for vim +Plugin 'cakebaker/scss-syntax.vim' + +" Silver searcher for vim +Plugin 'gabesoft/vim-ags' + +" Tool for fix PHP coding standards issues +"Plugin 'stephpy/vim-php-cs-fixer' + +" French Correction tool +Plugin 'dpelle/vim-Grammalecte' + +" Search file in folder +Plugin 'https://github.com/ctrlpvim/ctrlp.vim.git' + +" Browse tags of the current file +Plugin 'majutsushi/tagbar' + +" CakePHP vim support +"Plugin 'ndreynolds/vim-cakephp' + +" Auto convert rtf, rtfd, doc or wordml to plain text +Plugin 'vim-scripts/textutil.vim' + +" Multiple cursors +Plugin 'terryma/vim-multiple-cursors' + +" Syntax for TOML +Plugin 'cespare/vim-toml' + +" Some icons for NerdTree or other +Plugin 'ryanoasis/vim-devicons' + +" Vim linter +"Plugin 'Kuniwak/vint' + +" fuck this shit +" Plugin Asynchronous Lint Engine (linter) +" Check https://github.com/w0rp/ale#supported-languages for more info +Plugin 'w0rp/ale' + +" Latex plugin for writting documents +"Plugin 'lervag/vimtex' + +" Start plugin +"Plugin 'mhinz/vim-startify' + + +" Autocompletion framework +Plugin 'Shougo/deoplete.nvim' + +" Use snippet +"Plugin 'Shougo/neosnippet.vim' + +" snippets +"Plugin 'Shougo/neosnippet-snippets' + +" Depedence for other plugin +"Plugin 'Shougo/unite.vim' + +" File explorer +"Plugin 'Shougo/vimfiler' + +" Open terminal +"Plugin 'Shougo/deol.nvim' + +" Use sudo in vim +"Plugin 'lambdalisue/suda.vim' + +" fzf plugin for vim +Plugin 'junegunn/fzf.vim' + +"Plugin 'Glench/Vim-Jinja2-Syntax' + +" Maven (JAVA) +Plugin 'mikelue/vim-maven-plugin' + +" auto detect indentation style +Plugin 'tpope/vim-sleuth' + +" Indentation for working on salt files +Plugin 'saltstack/salt-vim' + +" Workspace manager +Plugin 'andreyorst/SimpleWorkspaces.vim' + +" markdown prev +" https://github.com/iamcco/markdown-preview.nvim/issues/43 +" Vundle don't support plugin hook so need to run :call mkdp#util#install() +Plugin 'iamcco/markdown-preview.nvim' + + +" After all plugins... +call vundle#end() +filetype plugin indent on + +""""""" Jedi-VIM """"""" +" Don't mess up undo history +"let g:jedi#show_call_signatures = "0" + + +""""""" SuperTab configuration """"""" +"let g:SuperTabDefaultCompletionType = "" +function! Completefunc(findstart, base) + return "\\" +endfunction + +"call SuperTabChain(Completefunc, '') + +"let g:SuperTabCompletionContexts = ['g:ContextText2'] + + +""""""" General coding stuff """"""" +" Highlight 80th column +set colorcolumn=80 +" Always show status bar +set laststatus=2 +" Let plugins show effects after 500ms, not 4s +set updatetime=500 +" Disable mouse click to go to position +set mouse-=a +" Don't let autocomplete affect usual typing habits +set completeopt=menuone,preview,noinsert +" Let vim-gitgutter do its thing on large files +let g:gitgutter_max_signs=10000 + +" If your terminal's background is white (light theme), uncomment the following +" to make EasyMotion's cues much easier to read. +" hi link EasyMotionTarget String +" hi link EasyMotionShade Comment +" hi link EasyMotionTarget2First String +" hi link EasyMotionTarget2Second Statement + + +""""""" Python stuff """"""" +syntax enable +set number showmatch +set shiftwidth=4 tabstop=4 softtabstop=4 expandtab autoindent +set tabstop=4 +let python_highlight_all = 1 +set list +set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:< + + +""""""" Keybindings """"""" +" Set up leaders +let mapleader="," +let maplocalleader="\\" + +" Mac OS X option-left / right +noremap â b +noremap æ e +inoremap â b +inoremap æ e +" Note - this required binding in preferences (Cmd-,) option+backspace to +" escape+z. +" Why this one is complicated - at end of line moves cursor by one +" character, which means a trailing character could be left. +inoremap ú col('.')>1 ? 'Tdb' : 'Tdb' +" Requires binding option+forward delete to escape +inoremap ø dw + +" Linux / windows ctrl+backspace ctrl+delete +" Note that ctrl+backspace doesn't work in Linux, so ctrl+\ is also available +imap ú +imap ú +imap ø + +" Arrow keys up/down move visually up and down rather than by whole lines. In +" other words, wrapped lines will take longer to scroll through, but better +" control in long bodies of text. +" NOTE - Disabled since w|e|b works well with easymotion +"noremap gk +"noremap gj + +" Neomake and other build commands (ctrl-b) +nnoremap :w:Neomake + +autocmd BufNewFile,BufRead *.tex,*.bib noremap :w:newr !make:setlocal buftype=nofile:setlocal bufhidden=hide:setlocal noswapfile +autocmd BufNewFile,BufRead *.tex,*.bib imap + +" NERDTree keybinding +map :NERDTreeToggle +autocmd StdinReadPre * let s:std_in=1 +"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif + + +function! NERDTreeToggleInCurDir() + " If NERDTree is open in the current buffer + if (exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1) + exe ":NERDTreeClose" + else + if (expand("%:t") != '') + exe ":NERDTreeFind" + else + exe ":NERDTreeCWD" + endif + endif +endfunction + +" nnoremap nf :NERDTreeFind +nnoremap :call NERDTreeToggleInCurDir() + +" NERDTress File highlighting +function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) + exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg + exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' +endfunction + +call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') +call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515') +call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') +call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515') +call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515') +call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') +call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') +call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515') +call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') +call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') +call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') +call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') +call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') + +" Autoformat conf +noremap :Autoformat +let g:autoformat_autoindent = 0 +let g:autoformat_retab = 0 +let g:autoformat_remove_trailing_spaces = 0 + +autocmd Filetype java set makeprg=javac\ % +set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C%.%# +map :make:copen +map :cprevious +map :cnext + +map :call CompileRunGcc() +func! CompileRunGcc() + exec "w" + if &filetype == 'c' + exec "!gcc % -o %<" + exec "!time ./%<" + elseif &filetype == 'cpp' + exec "!g++ % -o %<" + exec "!time ./%<" + elseif &filetype == 'java' + exec "!time java -cp %:p:h %:t:r" + elseif &filetype == 'sh' + exec "!time bash %" + elseif &filetype == 'python' + exec "!time python2.7 %" + elseif &filetype == 'html' + exec "!firefox % &" + elseif &filetype == 'go' + exec "!go build %<" + exec "!time go run %" + elseif &filetype == 'mkd' + exec "!~/.vim/markdown.pl % > %.html &" + exec "!firefox %.html &" + endif +endfunc + +set textwidth=0 wrapmargin=5 + +let g:ags_agexe = 'ag' +let g:ags_enable_async = 1 +let g:ags_results_per_tab = 0 + +"php-cs-fixer +let g:php_cs_fixer_rules = "@PSR2" + +let g:php_cs_fixer_php_path = "php" " Path to PHP +let g:php_cs_fixer_enable_default_mapping = 1 " Enable the mapping by default (pcd) +let g:php_cs_fixer_dry_run = 0 " Call command with dry-run option +let g:php_cs_fixer_verbose = 0 " Return the output of command if 1, else an inline information. + +let g:grammalecte_cli_py='/usr/bin/grammalecte-cli' + +nmap :TagbarToggle + +" Controller -> Component +map t yiw:tag /^" +" View -> Helper +map h yiw:tag /^"Helper + + + +let g:ctrlp_map = '' +let g:ctrlp_cmd = 'CtrlP' + +set encoding=UTF-8 + +nnoremap :UndotreeToggle + +:let g:colorizer_auto_filetype='css,html' + +"let g:deoplete#enable_at_startup = 1 + +" Plugin key-mappings. +" Note: It must be "imap" and "smap". It uses mappings. +imap (neosnippet_expand_or_jump) +smap (neosnippet_expand_or_jump) +xmap (neosnippet_expand_target) + +" SuperTab like snippets behavior. +" Note: It must be "imap" and "smap". It uses mappings. +"imap +" \ pumvisible() ? "\" : +" \ neosnippet#expandable_or_jumpable() ? +" \ "\(neosnippet_expand_or_jump)" : "\" +smap neosnippet#expandable_or_jumpable() ? +\ "\(neosnippet_expand_or_jump)" : "\" + + +" This do bullshit with '"' char +" For conceal markers. +"if has('conceal') +" set conceallevel=2 concealcursor=niv +"endif + +"use for completion +function! TabWrap() + if pumvisible() + return "\" + elseif strpart( getline('.'), 0, col('.') - 1 ) =~ '^\s*$' + return "\" + elseif &omnifunc !~ '' + return "\\" + else + return "\" + endif +endfunction + +" power tab +imap TabWrap() + +" Enter: complete&close popup if visible (so next Enter works); else: break undo +inoremap pumvisible() ? + \ deoplete#mappings#close_popup() : "u" + +" Ctrl-Space: summon FULL (synced) autocompletion +inoremap deoplete#mappings#manual_complete() + +" Escape: exit autocompletion, go to Normal mode +inoremap pumvisible() ? "" : "" + +set enc=utf-8 + +" === fzf plugin conf === + +" This is the default extra key bindings +let g:fzf_action = { + \ 'ctrl-t': 'tab split', + \ 'ctrl-x': 'split', + \ 'ctrl-v': 'vsplit' } + +" Default fzf layout +" - down / up / left / right +let g:fzf_layout = { 'down': '~40%' } + +" In Neovim, you can set up fzf window using a Vim command +let g:fzf_layout = { 'window': 'enew' } +let g:fzf_layout = { 'window': '-tabnew' } +let g:fzf_layout = { 'window': '10split enew' } + +" Customize fzf colors to match your color scheme +let g:fzf_colors = +\ { 'fg': ['fg', 'Normal'], + \ 'bg': ['bg', 'Normal'], + \ 'hl': ['fg', 'Comment'], + \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], + \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], + \ 'hl+': ['fg', 'Statement'], + \ 'info': ['fg', 'PreProc'], + \ 'border': ['fg', 'Ignore'], + \ 'prompt': ['fg', 'Conditional'], + \ 'pointer': ['fg', 'Exception'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', 'Label'], + \ 'header': ['fg', 'Comment'] } + +" Enable per-command history. +" CTRL-N and CTRL-P will be automatically bound to next-history and +" previous-history instead of down and up. If you don't like the change, +" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS. +let g:fzf_history_dir = '~/.local/share/fzf-history' + +" [Buffers] Jump to the existing window if possible +let g:fzf_buffers_jump = 1 + +" [[B]Commits] Customize the options used by 'git log': +let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' + +" [Tags] Command to generate tags file +let g:fzf_tags_command = 'ctags -R' + +" [Commands] --expect expression for directly executing the command +let g:fzf_commands_expect = 'alt-enter,ctrl-x' diff --git a/install.sh b/install.sh index dccbcd9..f0af9a7 100644 --- a/install.sh +++ b/install.sh @@ -128,4 +128,16 @@ #sudo pacman -S notmuch +## nvim + +#sudo pacman -S python-neovim python-twisted + # install dotfiles + +# post install dotfile + +## nvim + +#git clone https://github.com/vundlevim/vundle.vim.git ~/.config/nvim/bundle/Vundle.vim + +#nvim +PluginInstall +qall -- cgit v1.2.1