let HOSTNAME = substitute(system('hostname'), '\n', '', '') " =============Plugins================== call plug#begin() Plug 'morhetz/gruvbox' Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'chemzqm/denite-git' Plug 'tomtom/tcomment_vim' Plug 'bling/vim-airline' Plug 'vim-airline/vim-airline-themes' " Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}} Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' Plug 'vim-scripts/a.vim' Plug 'luochen1990/rainbow' if has("win32") Plug 'autozimu/LanguageClient-neovim', { \ 'branch': 'next', \ 'do': 'powershell -executionpolicy bypass -File install.ps1', \ } else Plug 'autozimu/LanguageClient-neovim', { \ 'branch': 'next', \ 'do': 'bash install.sh', \ } end Plug 'Shougo/echodoc.vim' Plug 'arakashic/chromatica.nvim', { 'do': ':UpdateRemotePlugins' } call plug#end() " =============Paths===================== exec "source " . stdpath('config') . "/" . hostname() . ".vim" " =============Settings================== filetype plugin on filetype indent on set nocompatible set ignorecase " Case sensitive off set incsearch set encoding=utf-8 set nobackup set noswapfile set mouse=a set spelllang=en,de set spellsuggest=double,10 set list set icon set listchars=tab:>.,trail:.,extends:#,nbsp:. set showmatch " Show pair braces set hlsearch "Highlight search syntax on set number set scrolloff=2 let mapleader = "," if has("win32") " set rop=type:directx let g:loaded_matchparen = 1 end " set clipboard+=unnamedplus " use system clipboard " " Copy to clipboard vnoremap y "+y nnoremap Y "+yg_ nnoremap y "+y nnoremap yy "+yy " " Paste from clipboard nnoremap p "+p nnoremap P "+P vnoremap p "+p vnoremap P "+P " =================Look and feel======================= set termguicolors set background=dark colorscheme gruvbox " =================Filetypes=========================== au BufRead,BufNewFile *.simvis set filetype=xml au BufRead,BufNewFile *.simcfg set filetype=cfg au BufRead,BufNewFile *.simcon set filetype=cfg au BufRead,BufNewFile *.simudex set filetype=cfg " =================Windows and Tabs==================== " Open a new tab with F2 map :tabnew :Explore imap :tabnew :Explore map :tabnext map :tabprevious nmap :wincmd k nmap :wincmd j nmap :wincmd h nmap :wincmd l " Open a new vertical split window with Ctrl - F2 map :vsplit . imap :vsplit . " Open a new horizontal split window with Shift - F2 map :split . imap :split . " ========================Codestyle======================== set tabstop=2 " Size of a tab set shiftwidth=2 " Die Einrückung set expandtab "Tabs get spaces when inserting set softtabstop=0 "set autoindent "alignment ansi style (astyle) set cindent " C-Code Style / Automatische Einrückung set cinoptions=(0,u0,U0,:0,=0 "Einrückung wie bei astyle: :0 (switch), =0 (case), (0 (unclosed parentheses), set modeline "Read indent comments (at end of file) " ======================shortcut======================= map :wa imap :wa "Jump to last modification line map ö `. nnoremap ü :let @/='\<=expand("")\>':set hls vnoremap ü : \let old_reg=getreg('"')let old_regtype=getregtype('"') \gvy:let @/=substitute( \escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g') \gV:call setreg('"', old_reg, old_regtype):set hls "map jump back to ctrl+- nnoremap " ===========Linewrap and jumping============================= setlocal wrap linebreak nolist set virtualedit= setlocal display+=lastline nnoremap k gk nnoremap j gj nnoremap 0 g0 nnoremap $ g$ nnoremap gk nnoremap gj nnoremap g nnoremap g vnoremap gk vnoremap gj vnoremap g vnoremap g " =================Comments============================ map :TComment " =========================Deoplete==================== let g:deoplete#enable_at_startup = 1 let g:deoplete#auto_complete_start_length = 1 let g:deoplete#enable_smart_case = 1 " =====================A====================== " Function for switching between header and c* files map :wa :A imap :wa:Ai map :AV imap :AVi map :AT imap :ATi let g:alternateSearchPath = 'sfr:../source,sfr:../src,sfr:../include,../../include,sfr:../inc,sfr:../h' " Dont create the file if the .cpp or .h is not found let g:alternateNoDefaultAlternate = 1 " ===================UltiSnips================ let g:UltiSnipsExpandTrigger = "(ultisnips_expand)" let g:UltiSnipsJumpForwardTrigger = "" let g:UltiSnipsJumpBackwardTrigger = "" " ===========RAINBOW==================== let g:rainbow_active = 1 let g:rainbow_conf = { \'separately': { \ 'cmake': { \ 'parentheses': [], \ }, \} \} " ===================LanguageServer================== if has("win32") let g:LanguageClient_serverCommands = { \ 'cpp': ['clangd'], \ } else let g:LanguageClient_serverCommands = { \ 'cpp': ['cquery', \ '--log-file=/tmp/cq.log', \ '--init={"cacheDirectory":"/tmp/cquery/"}'] \ } end nnoremap K :call LanguageClient#textDocument_hover() nnoremap gd :call LanguageClient#textDocument_definition({'gotoCmd': 'tabedit'}) nnoremap :call LanguageClient_contextMenu() vnoremap :call LanguageClient_contextMenu() nnoremap :call LanguageClient_textDocument_documentSymbol() let g:LanguageClient_hasClientSupport = 0 " ===================EchoDoc========================= set cmdheight=2 let g:echodoc#enable_at_startup = 1 let g:echodoc#type = 'signature' " ===================FZF============================= nnoremap :FZF let g:fzf_action = { \ 'enter': 'tab split', \ 'ctrl-x': 'split', \ 'ctrl-v': 'vsplit' } " ===================Chromatica====================== let g:chromatica#enable_at_startup=1 " ===================COC============================= inoremap coc#refresh() autocmd CursorHold * silent call CocActionAsync('highlight') " Remap for format selected region vmap f (coc-format-selected) nmap f (coc-format-selected) nmap r (coc-rename) " Use `:Format` for format current buffer command! -nargs=0 Format :call CocAction('format') " Shortcuts for denite interface " Show extension list nnoremap e :CocList extensions " Show symbols of current buffer nnoremap o :CocList outline " Search symbols of current workspace nnoremap t :CocList symbols " Show diagnostics of current workspace nnoremap a :CocList diagnostics " Show available commands nnoremap c :CocList commands " Show available services nnoremap s :CocList services " Show links of current buffer nnoremap l :CocList link nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Use K for show documentation in preview window nnoremap K :call show_documentation() function! s:show_documentation() if &filetype == 'vim' execute 'h '.expand('') else call CocAction('doHover') endif endfunction " ===================Denite========================== call denite#custom#map('insert', '', '', 'noremap') call denite#custom#map('insert', '', '', 'noremap') nnoremap :Denite -default-action=tabopen file/rec nnoremap :Denite buffer