Adopt for vscode neovim plugin

This commit is contained in:
Oliver Hartmann 2021-06-12 20:07:54 +02:00
parent 2870ce61ee
commit 6db33686b5

View File

@ -1,5 +1,6 @@
let HOSTNAME = substitute(system('hostname'), '\n', '', '') let HOSTNAME = substitute(system('hostname'), '\n', '', '')
" =============Plugins================== " =============Plugins==================
if !exists('g:vscode')
call plug#begin() call plug#begin()
Plug 'morhetz/gruvbox' Plug 'morhetz/gruvbox'
Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' }
@ -36,7 +37,7 @@ Plug 'neoclide/coc-snippets', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-lists', {'do': 'yarn install --frozen-lockfile'} Plug 'neoclide/coc-lists', {'do': 'yarn install --frozen-lockfile'}
Plug 'kkoomen/vim-doge' Plug 'kkoomen/vim-doge'
call plug#end() call plug#end()
endif
" =============Paths===================== " =============Paths=====================
exec "source " . stdpath('config') . "/" . hostname() . ".vim" exec "source " . stdpath('config') . "/" . hostname() . ".vim"
" =============Settings================== " =============Settings==================
@ -89,10 +90,13 @@ vnoremap <leader>P "+P
autocmd BufEnter,FocusGained * checktime " Check for file modifications autocmd BufEnter,FocusGained * checktime " Check for file modifications
" =================Look and feel======================= " =================Look and feel=======================
if !exists('g:vscode')
set termguicolors set termguicolors
set background=dark set background=dark
colorscheme gruvbox colorscheme gruvbox
endif
" =================Filetypes=========================== " =================Filetypes===========================
if !exists('g:vscode')
au BufRead,BufNewFile *.simvis set filetype=xml au BufRead,BufNewFile *.simvis set filetype=xml
au BufRead,BufNewFile *.simcfg set filetype=cfg au BufRead,BufNewFile *.simcfg set filetype=cfg
au BufRead,BufNewFile *.simcon set filetype=cfg au BufRead,BufNewFile *.simcon set filetype=cfg
@ -103,7 +107,9 @@ autocmd BufNewFile,BufReadPre SConstruct set filetype=python
autocmd BufNewFile,BufReadPre SConscript set filetype=python autocmd BufNewFile,BufReadPre SConscript set filetype=python
autocmd FileType xml nnoremap <F10> :% !xmllint.exe "%" --format<CR> autocmd FileType xml nnoremap <F10> :% !xmllint.exe "%" --format<CR>
autocmd FileType json syntax match Comment +\/\/.\+$+ autocmd FileType json syntax match Comment +\/\/.\+$+
endif
" =================Windows and Tabs==================== " =================Windows and Tabs====================
if !exists('g:vscode')
" Open a new tab with F2 " Open a new tab with F2
map <silent> <F2> <Esc>:tabnew <CR><ESC>:Explore<CR> map <silent> <F2> <Esc>:tabnew <CR><ESC>:Explore<CR>
imap <silent> <F2> <Esc>:tabnew <CR><ESC>:Explore<CR> imap <silent> <F2> <Esc>:tabnew <CR><ESC>:Explore<CR>
@ -119,8 +125,10 @@ imap <silent> <C-F2> <Esc>:vsplit .<CR>
" Open a new horizontal split window with Shift - F2 " Open a new horizontal split window with Shift - F2
map <silent> <S-F2> <Esc>:split .<CR> map <silent> <S-F2> <Esc>:split .<CR>
imap <silent> <S-F2> <Esc>:split .<CR> imap <silent> <S-F2> <Esc>:split .<CR>
endif
" ========================Codestyle======================== " ========================Codestyle========================
if !exists('g:vscode')
set tabstop=2 " Size of a tab set tabstop=2 " Size of a tab
set shiftwidth=2 " Die Einrückung set shiftwidth=2 " Die Einrückung
set expandtab "Tabs get spaces when inserting set expandtab "Tabs get spaces when inserting
@ -130,10 +138,13 @@ set softtabstop=0
set cindent " C-Code Style / Automatische Einrückung 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 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) set modeline "Read indent comments (at end of file)
endif
" ======================shortcut======================= " ======================shortcut=======================
if !exists('g:vscode')
map <C-S> <ESC>:wa<CR> map <C-S> <ESC>:wa<CR>
imap <C-S> <ESC>:wa<CR> imap <C-S> <ESC>:wa<CR>
endif
"Jump to last modification line "Jump to last modification line
map ö `. map ö `.
nnoremap ü :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR> nnoremap ü :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>
@ -150,6 +161,7 @@ vnoremap < <gv
vnoremap > >gv vnoremap > >gv
" ===========Linewrap and jumping============================= " ===========Linewrap and jumping=============================
if !exists('g:vscode')
setlocal wrap linebreak nolist setlocal wrap linebreak nolist
set virtualedit= set virtualedit=
setlocal display+=lastline setlocal display+=lastline
@ -165,15 +177,21 @@ vnoremap <silent> <Up> gk
vnoremap <silent> <Down> gj vnoremap <silent> <Down> gj
vnoremap <silent> <Home> g<Home> vnoremap <silent> <Home> g<Home>
vnoremap <silent> <End> g<End> vnoremap <silent> <End> g<End>
endif
" =================Comments============================ " =================Comments============================
if !exists('g:vscode')
map <C-C> :TComment<CR> map <C-C> :TComment<CR>
endif
" =========================Deoplete==================== " =========================Deoplete====================
if !exists('g:vscode')
let g:deoplete#enable_at_startup = 1 let g:deoplete#enable_at_startup = 1
let g:deoplete#auto_complete_start_length = 1 let g:deoplete#auto_complete_start_length = 1
let g:deoplete#enable_smart_case = 1 let g:deoplete#enable_smart_case = 1
endif
" =====================A====================== " =====================A======================
if !exists('g:vscode')
" Function for switching between header and c* files " Function for switching between header and c* files
map <F5> :wa <CR> :A<CR> map <F5> :wa <CR> :A<CR>
imap <F5> <Esc>:wa<CR>:A<CR>i imap <F5> <Esc>:wa<CR>:A<CR>i
@ -223,8 +241,9 @@ let g:rainbow_conf = {
\ 'css': 0, \ 'css': 0,
\ } \ }
\} \}
endif
" ===================LanguageServer================== " ===================LanguageServer==================
if !exists('g:vscode')
if has("win32") if has("win32")
let g:LanguageClient_serverCommands = { let g:LanguageClient_serverCommands = {
\ 'cpp': ['clangd'], \ 'cpp': ['clangd'],
@ -247,16 +266,22 @@ let g:LanguageClient_hasClientSupport = 0
set cmdheight=2 set cmdheight=2
let g:echodoc#enable_at_startup = 1 let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'signature' let g:echodoc#type = 'signature'
endif
" ===================FZF============================= " ===================FZF=============================
if !exists('g:vscode')
nnoremap <C-P> :FZF<CR> nnoremap <C-P> :FZF<CR>
let g:fzf_action = { let g:fzf_action = {
\ 'enter': 'tab split', \ 'enter': 'tab split',
\ 'ctrl-x': 'split', \ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' } \ 'ctrl-v': 'vsplit' }
endif
" ===================Chromatica====================== " ===================Chromatica======================
if !exists('g:vscode')
let g:chromatica#enable_at_startup=1 let g:chromatica#enable_at_startup=1
endif
" ===================COC============================= " ===================COC=============================
if !exists('g:vscode')
inoremap <silent><expr> <c-space> coc#refresh() inoremap <silent><expr> <c-space> coc#refresh()
autocmd CursorHold * silent call CocActionAsync('highlight') autocmd CursorHold * silent call CocActionAsync('highlight')
set updatetime=500 " After ms should CursorHold trigger set updatetime=500 " After ms should CursorHold trigger
@ -298,8 +323,10 @@ endfunction
nnoremap <silent> <space>y :<C-u>CocList -A --normal yank<cr> nnoremap <silent> <space>y :<C-u>CocList -A --normal yank<cr>
" ===================Denite========================== " ===================Denite==========================
if !exists('g:vscode')
call denite#custom#map('insert', '<Down>', '<denite:move_to_next_line>', 'noremap') call denite#custom#map('insert', '<Down>', '<denite:move_to_next_line>', 'noremap')
call denite#custom#map('insert', '<Up>', '<denite:move_to_previous_line>', 'noremap') call denite#custom#map('insert', '<Up>', '<denite:move_to_previous_line>', 'noremap')
nnoremap <C-P> :Denite -default-action=tabopen file/rec<CR> nnoremap <C-P> :Denite -default-action=tabopen file/rec<CR>
nnoremap <C-B> :Denite buffer<CR> nnoremap <C-B> :Denite buffer<CR>
endif