From 9e4931f37e1f33eeeb6ec714786b50136f5ff600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Mon, 5 Sep 2022 15:19:52 +0200 Subject: [PATCH] Add vscodium and integrate with neovim --- dotfiles.yml | 10 +- vim/vimrc | 265 ++++++++++------------------- vscode/keybindings.json | 7 - vscodium/install.sh | 15 ++ vscodium/keybindings.json | 26 +++ vscodium/product.json | 9 + {vscode => vscodium}/settings.json | 90 +++++----- 7 files changed, 195 insertions(+), 227 deletions(-) delete mode 100644 vscode/keybindings.json create mode 100755 vscodium/install.sh create mode 100644 vscodium/keybindings.json create mode 100644 vscodium/product.json rename {vscode => vscodium}/settings.json (61%) diff --git a/dotfiles.yml b/dotfiles.yml index 6576a94..2aa93bb 100644 --- a/dotfiles.yml +++ b/dotfiles.yml @@ -53,10 +53,12 @@ dotfiles: template: true - from: redshift/redshift.conf to: .config/redshift.conf - - from: vscode/settings.json - to: .config/Code/User/settings.json - - from: vscode/keybindings.json - to: .config/Code/User/keybindings.json + - from: vscodium/product.json + to: .config/VSCodium/product.json + - from: vscodium/settings.json + to: .config/VSCodium/User/settings.json + - from: vscodium/keybindings.json + to: .config/VSCodium/User/keybindings.json - from: alacritty/alacritty.yml to: .config/alacritty.yml template: true diff --git a/vim/vimrc b/vim/vimrc index f8440c4..ac58e70 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -4,73 +4,38 @@ call plug#begin('~/.local/share/nvim/plugged') " === plugins === -"Plug 'vim-airline/vim-airline' -"Plug 'vim-airline/vim-airline-themes' -Plug 'itchyny/lightline.vim' -Plug 'godlygeek/tabular' -Plug 'lepture/vim-jinja' -Plug 'majutsushi/tagbar' -" Plug 'nblock/vim-dokuwiki' -Plug 'reedes/vim-pencil' -Plug 'saltstack/salt-vim' -Plug 'sickill/vim-monokai' -" Plug 'patstockwell/vim-monokai-tasty' -" Plug 'sjl/gundo.vim' -Plug 'tpope/vim-commentary' -Plug 'tpope/vim-fugitive' -" Plug 'tpope/vim-speeddating' -" Plug 'tpope/vim-surround' -Plug 'airblade/vim-gitgutter' -Plug 'junegunn/goyo.vim' -Plug 'junegunn/limelight.vim' -" Plug 'sheerun/vim-polyglot' -" Plug 'freitass/todo.txt-vim' -Plug 'nathanaelkane/vim-indent-guides' +function! Cond(Cond, ...) + let opts = get(a:000, 0, {}) + return a:Cond ? opts : extend(opts, { 'on': [], 'for': [] }) +endfunction -"Plugin 'Lokaltog/vim-easymotion' -"Plugin 'PeterRincker/vim-argumentative' -"Plugin 'flazz/vim-colorschemes' -"Plugin 'jmcantrell/vim-virtualenv' -"Plugin 'kien/ctrlp.vim' -"Plugin 'klen/python-mode' -"Plugin 'mbbill/undotree' -Plug 'scrooloose/nerdtree' -"Plugin 'sjl/gundo.vim' -"Plugin 'terryma/vim-expand-region' -"Plugin 'terryma/vim-multiple-cursors' -"Plugin 'wellle/targets.vim' -"Plugin 'wincent/Command-T' -Plug 'vimwiki/vimwiki' -"Plug 'blindFS/vim-taskwarrior' -" Plug 'tbabej/taskwiki' -Plug 'rodjek/vim-puppet' -Plug 'suan/vim-instant-markdown' -"Plug 'marshallward/vim-restructuredtext' -Plug 'vim-syntastic/syntastic' -"Plug 'ElmCast/elm-vim' -"Plug 'avh4/elm-format' +" editing plugins +Plug 'godlygeek/tabular', Cond(!exists('g:vscode')) +Plug 'nathanaelkane/vim-indent-guides', Cond(!exists('g:vscode')) +Plug 'tpope/vim-commentary', Cond(!exists('g:vscode')) +Plug 'airblade/vim-gitgutter', Cond(!exists('g:vscode')) -Plug 'fatih/vim-go' -Plug 'hashivim/vim-terraform' +" ui +Plug 'sickill/vim-monokai', Cond(!exists('g:vscode')) +Plug 'itchyny/lightline.vim', Cond(!exists('g:vscode')) -Plug 'editorconfig/editorconfig-vim' +" lang integrations +Plug 'lepture/vim-jinja', Cond(!exists('g:vscode')) +Plug 'fatih/vim-go', Cond(!exists('g:vscode')) +Plug 'hashivim/vim-terraform', Cond(!exists('g:vscode')) +Plug 'editorconfig/editorconfig-vim', Cond(!exists('g:vscode')) +Plug 'rust-lang/rust.vim', Cond(!exists('g:vscode')) +Plug 'rodjek/vim-puppet', Cond(!exists('g:vscode')) -Plug 'leafgarland/typescript-vim' +" helpers +"" distraction free writing +Plug 'junegunn/limelight.vim', Cond(!exists('g:vscode')) +Plug 'junegunn/goyo.vim', Cond(!exists('g:vscode')) +Plug 'reedes/vim-pencil', Cond(!exists('g:vscode')) -Plug 'prettier/vim-prettier', { 'do': 'npm install' } +"" markdown +Plug 'suan/vim-instant-markdown', Cond(!exists('g:vscode')) -Plug 'yuezk/vim-js' -Plug 'maxmellon/vim-jsx-pretty' - -Plug 'evanleck/vim-svelte', {'branch': 'main'} - -"Plug 'neoclide/coc.nvim', {'branch': 'release'} - -" Plug 'Chiel92/vim-autoformat' - -Plug 'evanleck/vim-svelte', {'branch': 'main'} - -Plug 'cespare/vim-toml', { 'branch': 'main' } call plug#end() filetype plugin indent on @@ -199,82 +164,52 @@ map Y y$ map j gj map k gk -nnoremap h -nnoremap j -nnoremap k -nnoremap l - -nmap :bnext -nmap :bprev map N Nzz map n nzz inoremap jj -nnoremap v vl - -nnoremap m :InstantMarkdownPreview - -nnoremap u :GundoToggle -nnoremap d :diffupdate - -nmap :Goyo:TogglePencil:Limelight!! -nmap w :Goyo:TogglePencil:Limelight!! - -nmap c :%w !xclip -selection clipboard -nmap x :r !xclip -out -selection -clipboard - -nmap f :Autoformat - " no more ex mode nnoremap Q -" === autocommands === +" Use // in visual mode to search for selection +" https://vim.fandom.com/wiki/Search_for_visually_selected_text +vnoremap // y/\V=escape(@",'/\') -"" autosave views when closing and restoring when opening again. -"autocmd BufWinLeave *.* mkview -"autocmd BufWinEnter *.* silent loadview +if exists('g:vscode') + xmap gc VSCodeCommentary + nmap gc VSCodeCommentary + omap gc VSCodeCommentary + nmap gcc VSCodeCommentaryLine +else + nnoremap h + nnoremap j + nnoremap k + nnoremap l -" === plugin setup === + nmap :bnext + nmap :bprev -" == colorscheme == -" set background=light -" let g:solarized_termcolors=16 -" let g:solarized_termtrans=1 -" let g:solarized_contrast="normal" -" let g:solarized_visibility="normal" -syntax enable -silent! colorscheme monokai + nnoremap m :InstantMarkdownPreview -" == tagbar == -nnoremap :TagbarToggle -let g:tagbar_map_jump = "i" -let g:tagbar_left = 0 -let g:tagbar_vertical = 0 -let g:tagbar_width = 50 -let g:tagbar_autoclose = 1 -let g:tagbar_autofocus = 1 -let g:tagbar_sort = 0 " 1: sort by name, 0: sort by position -let g:tagbar_compact = 1 -let g:tagbar_indent = 2 -let g:tagbar_show_linenumbers = 0 -let g:tagbar_foldlevel = 99 " unfold all + nnoremap u :GundoToggle + nnoremap d :diffupdate -" == airline == -"let g:airline_right_sep = '' -"let g:airline_left_sep = '' -"let g:airline#extensions#disable_rtp_load = 1 -"let g:airline_extensions = ['whitespace'] -"let g:airline_theme='powerlineish' -"let g:airline_powerline_fonts = 1 -"let g:airline_section_x = airline#section#create(['%{tagbar#currenttag("%s", "", "f")}','' , ' %{PencilMode()}', ' [', 'filetype', ']']) -"let g:pencil#mode_indicators = {'hard': 'H', 'auto': 'A', 'soft': 'S', 'off': '',} -"let g:airline#extensions#whitespace#enabled = 1 -"let g:airline#extensions#whitespace#symbol = '' -"let g:airline#extensions#whitespace#checks = ['trailing'] + nmap :Goyo:TogglePencil:Limelight!! + nmap w :Goyo:TogglePencil:Limelight!! -let g:lightline = { + nmap c :%w !xclip -selection clipboard + nmap x :r !xclip -out -selection -clipboard + + nmap f :Autoformat + + nnoremap v vl + + syntax enable + silent! colorscheme monokai + + let g:lightline = { \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], @@ -293,68 +228,44 @@ let g:lightline = { \ }, \ } -function! LightLineFilename() - return fnamemodify(expand('%F'), ":~:h") -endfunction + function! LightLineFilename() + return fnamemodify(expand('%F'), ":~:h") + endfunction -" == pencil == -let g:pencil#textwidth = 80 -let g:pencil#autoformat = 1 -let g:pencil#cursorwrap = 1 -let g:pencil#wrapModeDefault = 'soft' -let g:pencil#cursorwrap = 0 + " == pencil == + let g:pencil#textwidth = 80 + let g:pencil#autoformat = 1 + let g:pencil#cursorwrap = 1 + let g:pencil#wrapModeDefault = 'soft' + let g:pencil#cursorwrap = 0 -" == goyo == -let g:goyo_width = 100 -let g:goyo_height = "90%" -let g:goyo_linenr = 0 + " == goyo == + let g:goyo_width = 100 + let g:goyo_height = "90%" + let g:goyo_linenr = 0 -" == limelight == -let g:limelight_default_coefficient = 0.5 + " == limelight == + let g:limelight_default_coefficient = 0.5 -" === functions === -function! DeleteTrailingWS() - exe "normal mz" - %s/\s\+$//e - exe "normal `z" -endfunction -autocmd BufWritePre * :call DeleteTrailingWS() + " === functions === + function! DeleteTrailingWS() + exe "normal mz" + %s/\s\+$//e + exe "normal `z" + endfunction + autocmd BufWritePre * :call DeleteTrailingWS() -autocmd FileType yaml set shiftwidth=2 -autocmd FileType toml set shiftwidth=2 -set completeopt-=preview -let g:ycm_add_preview_to_completeopt = 0 + autocmd FileType yaml set shiftwidth=2 + autocmd FileType toml set shiftwidth=2 + autocmd FileType html setl shiftwidth=2 -set completeopt-=preview -let g:ycm_add_preview_to_completeopt = 0 + let g:instant_markdown_autostart = 0 -let g:instant_markdown_autostart = 0 + let g:terraform_align = 1 + let g:terraform_fmt_on_save=1 -let g:terraform_align = 1 -let g:terraform_fmt_on_save=1 + let g:rustfmt_autosave = 1 -if has("autocmd") - au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + " https://stackoverflow.com/a/8585343 + map q :bpspbnbd endif - -let g:ycm_server_python_interpreter = "python3" - -au FileType html setl shiftwidth=2 - -" Use // in visual mode to search for selection -" https://vim.fandom.com/wiki/Search_for_visually_selected_text -vnoremap // y/\V=escape(@",'/\') - -if v:version >= 700 - au BufLeave * let b:winview = winsaveview() - au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif -endif - -" https://github.com/golang/tools/blob/master/gopls/doc/vim.md -let g:go_def_mode='gopls' -let g:go_info_mode='gopls' - -" https://stackoverflow.com/a/8585343 -map q :bpspbnbd - -let g:rustfmt_autosave = 1 diff --git a/vscode/keybindings.json b/vscode/keybindings.json deleted file mode 100644 index 3e486c9..0000000 --- a/vscode/keybindings.json +++ /dev/null @@ -1,7 +0,0 @@ -// Place your key bindings in this file to override the defaultsauto[] -[ - { - "key": "ctrl+3", - "command": "workbench.action.terminal.focus" - } -] \ No newline at end of file diff --git a/vscodium/install.sh b/vscodium/install.sh new file mode 100755 index 0000000..ea6ee23 --- /dev/null +++ b/vscodium/install.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -o nounset +set -o pipefail +set -o errexit + +codium --install-extension ms-vscode.cpptools +codium --install-extension ms-python.python +codium --install-extension rust-lang.rust-analyzer +codium --install-extension asvetliakov.vscode-neovim +codium --install-extension monokai.theme-monokai-pro-vscode +codium --install-extension yzhang.markdown-all-in-one +codium --install-extension puppet.puppet-vscode + + diff --git a/vscodium/keybindings.json b/vscodium/keybindings.json new file mode 100644 index 0000000..2072348 --- /dev/null +++ b/vscodium/keybindings.json @@ -0,0 +1,26 @@ +[ +// { +// "key": "ctrl+3", +// "command": "workbench.action.terminal.focus" +// }, + { + "key": "ctrl+alt+b", + "command": "workbench.action.toggleActivityBarVisibility" + }, + { + "key": "ctrl+b", + "command": "workbench.action.toggleSidebarVisibility" + }, + { + "command": "vscode-neovim.compositeEscape1", + "key": "j", + "when": "neovim.mode == insert && editorTextFocus", + "args": "j" + }, + { + "command": "vscode-neovim.compositeEscape2", + "key": "k", + "when": "neovim.mode == insert && editorTextFocus", + "args": "k" + } +] diff --git a/vscodium/product.json b/vscodium/product.json new file mode 100644 index 0000000..032102a --- /dev/null +++ b/vscodium/product.json @@ -0,0 +1,9 @@ +{ + "extensionsGallery": { + "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", + "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index", + "itemUrl": "https://marketplace.visualstudio.com/items", + "controlUrl": "", + "recommendationsUrl": "" + } +} diff --git a/vscode/settings.json b/vscodium/settings.json similarity index 61% rename from vscode/settings.json rename to vscodium/settings.json index 913aa82..12bbd54 100644 --- a/vscode/settings.json +++ b/vscodium/settings.json @@ -1,60 +1,72 @@ { - "workbench.colorTheme": "Visual Studio Light", - "vim.neovimPath": "/usr/bin/nvim", - "explorer.confirmDelete": false, - "window.zoomLevel": 0, - "terraform.telemetry.enabled": false, - "editor.formatOnSave": true, - "vim.gdefault": true, - "vim.visualstar": true, - "vim.enableNeovim": true, - "git.detectSubmodulesLimit": 50, - "files.autoSave": "onFocusChange", - "editor.fontFamily": "'Inconsolata','Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'", + "ansible.dockerImage": "", "editor.accessibilitySupport": "off", - "editor.lineNumbers": "relative", - "editor.mouseWheelZoom": true, - "editor.renderWhitespace": "none", "editor.cursorSurroundingLines": 7, - "editor.minimap.renderCharacters": false, + "editor.fontFamily": "'Droid Sans Mono'", + "editor.formatOnSave": true, + "editor.lineNumbers": "off", "editor.minimap.showSlider": "always", - "editor.minimap.size": "fill", + "editor.renderWhitespace": "none", + "explorer.confirmDelete": false, + "explorer.confirmDragAndDrop": false, + "explorer.incrementalNaming": "smart", + "extensions.ignoreRecommendations": true, "files.eol": "\n", "files.hotExit": "off", "files.trimFinalNewlines": true, "files.trimTrailingWhitespace": true, - "workbench.enableExperiments": false, - "workbench.startupEditor": "newUntitledFile", - "workbench.activityBar.visible": false, - "workbench.iconTheme": "material-icon-theme", - "workbench.tree.indent": 12, - "window.menuBarVisibility": "toggle", - "window.title": "${rootName}${separator}${dirty}${activeEditorShort}${separator}VSCode", - "explorer.confirmDragAndDrop": false, - "explorer.incrementalNaming": "smart", - "search.smartCase": true, - "extensions.ignoreRecommendations": true, - "terminal.external.linuxExec": "alacritty", - "problems.showCurrentInStatus": true, + "git.detectSubmodulesLimit": 50, "problems.decorations.enabled": false, - "update.mode": "none", + "problems.showCurrentInStatus": true, + "rust-client.autoStartRls": false, + "rust-client.disableRustup": true, + "search.smartCase": true, "telemetry.enableCrashReporter": false, "telemetry.enableTelemetry": false, - "ansible.dockerImage": "", - "vim.cursorStylePerMode.normal": "block", + "terminal.external.linuxExec": "", + "terminal.integrated.mouseWheelScrollSensitivity": 3, + "terraform.telemetry.enabled": false, + "update.mode": "none", "vim.cursorStylePerMode.insert": "line", + "vim.cursorStylePerMode.normal": "block", "vim.cursorStylePerMode.replace": "underline", "vim.easymotion": true, + "vim.enableNeovim": true, + "vim.gdefault": true, "vim.hlsearch": true, "vim.leader": "", + "vim.neovimPath": "/usr/bin/nvim", + "vim.vimrc.enable": true, + "vim.visualstar": true, + "editor.wordWrap": "off", + "vscode-neovim.neovimExecutablePaths.linux": "/usr/bin/nvim", + "window.menuBarVisibility": "toggle", + "window.title": "[code] ${rootName}${separator}${dirty}${activeEditorShort}${separator}VSCode", "workbench.colorCustomizations": { "statusBar.background": "#005f5f", "statusBar.noFolderBackground": "#005f5f", "statusBar.debuggingBackground": "#005f5f" }, - "vim.vimrc.enable": true, - "editor.fontSize": 15, - "rust-client.disableRustup": true, - "rust-client.autoStartRls": false, - "terminal.integrated.mouseWheelScrollSensitivity": 3 -} + "workbench.enableExperiments": false, + "workbench.iconTheme": "Monokai Classic Icons", + "workbench.startupEditor": "newUntitledFile", + "workbench.tree.indent": 14, + "security.workspace.trust.enabled": false, + "scm.inputFontSize": 12, + "debug.console.fontSize": 12, + "terminal.integrated.fontSize": 12, + "files.autoSave": "onFocusChange", + "editor.fontWeight": "normal", + "editor.cursorStyle": "block", + "editor.minimap.renderCharacters": false, + "editor.minimap.size": "fit", + "workbench.colorTheme": "Monokai Classic", + "workbench.tree.renderIndentGuides": "always", + "breadcrumbs.icons": false, + "window.titleSeparator": " — ", + "explorer.excludeGitIgnore": true, + "puppet.editorService.formatOnType.enable": true, + "puppet.installType": "agent", + "puppet.installDirectory": "/usr/bin/puppet", + "window.zoomLevel": 0.1 +} \ No newline at end of file