Move to vim-plug

This commit is contained in:
Thomas Avé 2019-10-04 12:30:18 +02:00
parent 0aadeb0b38
commit 195964bc06
2 changed files with 127 additions and 121 deletions

212
.vimrc
View File

@ -1,39 +1,38 @@
let VIMHOME = split(&rtp, ",")[0]
" Vundle package managment
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'altercation/vim-colors-solarized'
Plugin 'cohama/lexima.vim'
Plugin 'gmarik/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'easymotion/vim-easymotion'
Plugin 'hdima/python-syntax'
Plugin 'scrooloose/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'kien/ctrlp.vim'
Plugin 'mattn/emmet-vim'
Plugin 'tomtom/tcomment_vim'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'nixprime/cpsm'
Plugin 'Valloric/YouCompleteMe'
Plugin 'rhysd/vim-clang-format'
Plugin 'tmux-plugins/vim-tmux'
Plugin 'tmux-plugins/vim-tmux-focus-events'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'Valloric/ListToggle'
Plugin 'jeetsukumaran/vim-buffergator'
call vundle#end()
let VIMHOME = split(&rtp, ",")[0]
let $VIMHOME = VIMHOME
set exrc
set secure
" vim-plug
call plug#begin(VIMHOME."/plugs")
Plug 'posva/vim-vue'
Plug 'neovimhaskell/haskell-vim'
Plug 'nvie/vim-flake8'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
Plug 'ConradIrwin/vim-bracketed-paste'
Plug 'Shougo/deoplete.nvim'
" Plug 'Valloric/YouCompleteMe'
Plug 'christoomey/vim-tmux-navigator'
Plug 'cohama/lexima.vim', {'do': 'sed -i \"s/has(.nvim.) && //\" autoload/lexima/insmode.vim'}
Plug 'editorconfig/editorconfig-vim'
Plug 'gmarik/Vundle.vim'
Plug 'hdima/python-syntax'
Plug 'jeetsukumaran/vim-buffergator'
Plug 'kien/ctrlp.vim'
Plug 'kristijanhusak/vim-hybrid-material'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'NLKNguyen/papercolor-theme'
Plug 'nixprime/cpsm', {'do': './install.sh'}
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'pangloss/vim-javascript'
Plug 'tmux-plugins/vim-tmux'
Plug 'tmux-plugins/vim-tmux-focus-events'
Plug 'tomtom/tcomment_vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
call plug#end()
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py'
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
let mapleader=","
@ -44,16 +43,6 @@ let mapleader=","
nnoremap j gj
nnoremap k gk
"python with virtualenv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" don't store .swp files in the file's own directory
" neither for .ext~ files
set directory=/home/billie/.vim/tmp/
@ -71,76 +60,19 @@ set completeopt-=preview
set backspace=indent,eol,start
" Splits
set splitbelow
set splitright
" CtrlP
nnoremap <silent> <C-o> :CtrlPBuffer<CR>
let g:ctrlp_match_func = {'match': 'cpsm#CtrlPMatch'}
nnoremap <silent> <C-o> :CtrlPBuffer<CR>
let g:cpsm_unicode=1
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" Unsaved buffer switching
set hidden
let g:clang_format#style_options = {
\ "AccessModifierOffset" : -4,
\ "AlignAfterOpenBracket" : "true",
\ "AlignEscapedNewlinesLeft" : "false",
\ "AlignOperands" : "false",
\ "AlignTrailingComments" : "true",
\ "AllowAllParametersOfDeclarationOnNextLine" : "true",
\ "AllowShortBlocksOnASingleLine" : "false",
\ "AllowShortCaseLabelsOnASingleLine" : "false",
\ "AllowShortFunctionsOnASingleLine" : "All",
\ "AllowShortIfStatementsOnASingleLine" : "true",
\ "AllowShortLoopsOnASingleLine" : "true",
\ "AlwaysBreakAfterDefinitionReturnType" : "false",
\ "AlwaysBreakBeforeMultilineStrings" : "false",
\ "AlwaysBreakTemplateDeclarations" : "true",
\ "BinPackArguments" : "true",
\ "BinPackParameters" : "true",
\ "BreakBeforeBinaryOperators" : "None",
\ "BreakBeforeBraces" : "Attach",
\ "BreakBeforeTernaryOperators" : "true",
\ "BreakConstructorInitializersBeforeComma" : "false",
\ "ColumnLimit" : 0,
\ "ConstructorInitializerAllOnOneLineOrOnePerLine" : "true",
\ "ConstructorInitializerIndentWidth" : 4,
\ "ContinuationIndentWidth" : 4,
\ "Cpp11BracedListStyle" : "true",
\ "DerivePointerAlignment" : "true",
\ "DisableFormat" : "false",
\ "ExperimentalAutoDetectBinPacking" : "false",
\ "IndentCaseLabels" : "true",
\ "IndentWidth" : 4,
\ "IndentWrappedFunctionNames" : "false",
\ "KeepEmptyLinesAtTheStartOfBlocks" : "false",
\ "Language" : "Cpp",
\ "MaxEmptyLinesToKeep" : 1,
\ "NamespaceIndentation" : "None",
\ "ObjCBlockIndentWidth" : 4,
\ "ObjCSpaceAfterProperty" : "false",
\ "ObjCSpaceBeforeProtocolList" : "false",
\ "PenaltyBreakBeforeFirstCallParameter" : 1,
\ "PenaltyBreakComment" : 300,
\ "PenaltyBreakFirstLessLess" : 120,
\ "PenaltyBreakString" : 1000,
\ "PenaltyExcessCharacter" : 1000000,
\ "PenaltyReturnTypeOnItsOwnLine" : 200,
\ "PointerAlignment" : "Left",
\ "SpaceAfterCStyleCast" : "false",
\ "SpaceBeforeAssignmentOperators" : "true",
\ "SpaceBeforeParens" : "ControlStatements",
\ "SpaceInEmptyParentheses" : "false",
\ "SpacesBeforeTrailingComments" : 4,
\ "SpacesInAngles" : "false",
\ "SpacesInCStyleCastParentheses" : "false",
\ "SpacesInContainerLiterals" : "true",
\ "SpacesInParentheses" : "false",
\ "SpacesInSquareBrackets" : "false",
\ "Standard" : "Auto",
\ "TabWidth" : 4,
\ "UseTab" : "Never"}
let g:clang_format#code_style = 'Google'
" Line numbering
set number
set numberwidth=4
@ -175,13 +107,15 @@ if has("autocmd")
endif
" Quickfix
nnoremap <silent> <leader>f :YcmCompleter FixIt<CR>
nnoremap <silent> <leader>f :YcmCompleter FixIt<CR>:cexpr []<CR>:cclose<CR>
nnoremap <silent> <leader>g :YcmCompleter GoTo<CR>
" Terminal colors
set t_Co=256
set background=dark
let g:airline_theme="solarized"
let g:airline_solarized_bg="dark"
set tabstop=4
set shiftwidth=4
@ -206,16 +140,64 @@ set ttimeoutlen=50
" Color scheme
syntax enable
let python_highlight_all=1
set background=dark
let g:solarized_termcolors=256
colorscheme solarized
colorscheme hybrid_material
let g:tmux_navigator_no_mappings = 1
" Remap u to y
vnoremap u y
nnoremap <silent> {Left-mapping} :TmuxNavigateLeft<cr>
nnoremap <silent> {Down-Mapping} :TmuxNavigateDown<cr>
nnoremap <silent> {Up-Mapping} :TmuxNavigateUp<cr>
nnoremap <silent> {Right-Mapping} :TmuxNavigateRight<cr>
nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
let g:tmux_navigator_save_on_switch = 2
" Save clipboard on quit
autocmd VimLeave * call system("xsel -ib", getreg('+'))
" Automatically remove trailing spaces
autocmd BufWritePre * :%s/\s\+$//e
" Use deoplete.
autocmd FileType python let g:deoplete#enable_at_startup = 1
" VPW: set filetype for .py3
autocmd BufRead,BufNewFile *.py3 set filetype=python
" Vue indent
autocmd FileType vue setlocal shiftwidth=2 softtabstop=2 expandtab
autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab
autocmd FileType vue syntax sync fromstart
" Disable shift+k for manual lookup
map <S-k> <Nop>
" Prolog: set filetype for .pl
autocmd BufRead,BufNewFile *.pl set filetype=prolog
" Disable modelines, fix CVE
set modelines=0
set nomodeline
" Coc extensions
let g:coc_global_extensions = []
command! -nargs=1 Ext :call add(g:coc_global_extensions, <args>)
Ext 'coc-snippets'
Ext 'coc-emoji'
Ext 'coc-highlight'
Ext 'coc-emmet'
Ext 'coc-vimtex'
Ext 'coc-json'
Ext 'coc-tabnine'
Ext 'coc-python'
Ext 'coc-java'
delc Ext
" Tab for completion
" use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()

View File

@ -1,15 +1,18 @@
# Partially stolen from https://bitbucket.org/mblum/libgp/src/2537ea7329ef/.ycm_extra_conf.py
import os, glob
import os, glob, subprocess, re
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
STD = "-std=c++17"
flags = [
'-Wall',
'-Wextra',
'-Wno-long-long',
'-Wno-variadic-macros',
'-pedantic',
'-Weffc++',
'-fexceptions',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
@ -17,26 +20,43 @@ flags = [
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++14',
STD,
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x', 'c++',
'-isystem', '/usr/local/include',
'-isystem', '/usr/include/qt',
'-I', 'include',
'-I', '.',
'-I', 'src',
'-I','/usr/include/qt4',
'-I', 'main/cpp'
]
def AddSystemIncludes():
global flags
try:
output = subprocess.check_output(["clang++", STD, "-E", "-v", "-x", "c++", os.devnull], stderr=subprocess.STDOUT).decode("utf-8")
for loc in re.findall(r"^ (/.*)$", output, re.M):
flags += ["-isystem", loc]
except:
print("Clang++ not found")
flags += [
'-isystem', '/usr/include/x86_64-linux-gnu/c++/7',
'-isystem', '/usr/include/c++/7',
'-isystem', '/usr/include',
'-isystem', '/usr/local/include'
]
AddSystemIncludes()
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
compilation_database_folder = None
if compilation_database_folder:
database = ycm_core.CompilationDatabase( compilation_database_folder )
@ -89,6 +109,10 @@ def FlagsForFile( filename ):
# relative_to = DirectoryOfThisScript()
relative_to = ProjectRoot(filename)
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) + ["-I", os.path.abspath(os.path.dirname(filename))] + ExtIncludes(relative_to) + BuildIncludes(relative_to, filename)
try:
resources_lib_base = os.path.join(relative_to, "main", "resources", "lib")
final_flags += ["-I"+os.path.join(resources_lib_base, f, "include") for f in os.listdir(resources_lib_base)]
except: pass
return {
'flags': final_flags,
@ -99,7 +123,7 @@ def ProjectRoot(filename):
path = os.path.abspath(os.path.dirname(filename))
while path != os.path.abspath(os.path.dirname(path)) and not (os.path.isdir(os.path.join(path, ".git")) or os.path.isdir(os.path.join(path, "include")) or os.path.isdir(os.path.join(path, "src"))):
path = os.path.abspath(os.path.dirname(path))
if not (os.path.isdir(os.path.join(path, "include")) or os.path.isdir(os.path.join(path, "src"))):
if not (os.path.isdir(os.path.join(path, "include")) or os.path.isdir(os.path.join(path, "src")) or os.path.isdir(os.path.join(path, "main"))):
return os.path.abspath(os.path.dirname(filename))
else:
return path