158 lines
5.0 KiB
VimL
158 lines
5.0 KiB
VimL
let hostname = substitute(system('hostname'), '\n', '', '')
|
|
" =============Plugins==================
|
|
call plug#begin()
|
|
Plug 'morhetz/gruvbox'
|
|
Plug 'tomtom/tcomment_vim'
|
|
Plug 'bling/vim-airline'
|
|
Plug 'vim-airline/vim-airline-themes'
|
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
|
Plug 'tpope/vim-fugitive'
|
|
Plug 'airblade/vim-gitgutter'
|
|
" Plug 'Shougo/neosnippet.vim'
|
|
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'
|
|
call plug#end()
|
|
" =============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
|
|
|
|
if has("win32")
|
|
" set rop=type:directx
|
|
let g:loaded_matchparen = 1
|
|
end
|
|
|
|
set clipboard+=unnamedplus " use system clipboard
|
|
|
|
" =================Look and feel=======================
|
|
set background=dark
|
|
colorscheme gruvbox
|
|
|
|
" =================Windows and Tabs====================
|
|
" Open a new tab with F2
|
|
map <F2> <Esc>:tabnew <CR><ESC>:Explore<CR>
|
|
imap <F2> <Esc>:tabnew <CR><ESC>:Explore<CR>
|
|
map <S-Right> :tabnext<CR>
|
|
map <S-Left> :tabprevious<CR>
|
|
nmap <silent> <A-Up> :wincmd k<CR>
|
|
nmap <silent> <A-Down> :wincmd j<CR>
|
|
nmap <silent> <A-Left> :wincmd h<CR>
|
|
nmap <silent> <A-Right> :wincmd l<CR>
|
|
" Open a new vertical split window with Ctrl - F2
|
|
map <C-F2> <Esc>:vsplit .<CR>
|
|
imap <C-F2> <Esc>:vsplit .<CR>
|
|
" Open a new horizontal split window with Shift - F2
|
|
map <S-F2> <Esc>:split .<CR>
|
|
imap <S-F2> <Esc>:split .<CR>
|
|
|
|
" ========================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 <C-S> <ESC>:wa<CR>
|
|
imap <C-S> <ESC>:wa<CR>
|
|
"Jump to last modification line
|
|
map ö `.
|
|
nnoremap ü :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>
|
|
vnoremap <silent> ü :<C-U>
|
|
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
|
|
\gvy:let @/=substitute(
|
|
\escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR>
|
|
\gV:call setreg('"', old_reg, old_regtype)<CR>:set hls<CR>
|
|
|
|
" =================Comments============================
|
|
map <C-C> :TComment<CR>
|
|
|
|
" =================Python==============================
|
|
if has("win32")
|
|
if hostname == "perryWin64"
|
|
let g:python3_host_prog="f:\\Tools\\Python\\python.exe"
|
|
let g:python_host_prog="f:\\Tools\\Python27\\python.exe"
|
|
end
|
|
end
|
|
|
|
" =========================Deoplete====================
|
|
let g:deoplete#enable_at_startup = 1
|
|
let g:deoplete#auto_complete_start_length = 1
|
|
let g:deoplete#enable_smart_case = 1
|
|
" =========================neosnippet==================
|
|
" " Enable snipMate compatibility feature.
|
|
let g:neosnippet#enable_snipmate_compatibility = 1
|
|
" Tell Neosnippet about the other snippets
|
|
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>"
|
|
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
|
|
" conceal neosnippet markers
|
|
" =====================A======================
|
|
" Function for switching between header and c* files
|
|
map <F5> :wa <CR> :A<CR>
|
|
imap <F5> <Esc>:wa<CR>:A<CR>i
|
|
map <C-F5> :AV<CR>
|
|
imap <C-F5> <Esc>:AV<CR>i
|
|
map <S-F5> :AT<CR>
|
|
imap <S-F5> <Esc>:AT<CR>i
|
|
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
|
|
|
|
" ===========RAINBOW====================
|
|
let g:rainbow_active = 1
|
|
let g:rainbow_conf = {
|
|
\'separately': {
|
|
\ 'cmake': {
|
|
\ 'parentheses': [],
|
|
\ },
|
|
\}
|
|
\}
|
|
|
|
" ===================LanguageServer==================
|
|
let g:LanguageClient_serverCommands = {
|
|
\ 'cpp': ['clangd'],
|
|
\ }
|
|
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
|
|
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
|
|
nnoremap <silent> <F3> :call LanguageClient_contextMenu()<CR>
|
|
vnoremap <silent> <F3> :call LanguageClient_contextMenu()<CR>
|
|
|
|
let g:LanguageClient_hasClientSupport = 0
|
|
" ===================EchoDoc=========================
|
|
set cmdheight=2
|
|
let g:echodoc#enable_at_startup = 1
|
|
let g:echodoc#type = 'signature'
|