From 5f6eec0996328a8755c8124be55b73a56a8274c9 Mon Sep 17 00:00:00 2001 From: Andrejus Date: Mon, 9 Nov 2020 18:21:18 +0000 Subject: [PATCH] coc auto formatting updates, airline theme, formatting --- Dockerfile | 2 +- README.md | 26 ++-- files/.config/nvim/base.vim | 2 +- files/.config/nvim/coc-settings.json | 174 +++++++++++++++------------ files/.config/nvim/mappings.vim | 24 +--- files/.config/nvim/plugins.vim | 12 ++ files/.profile | 7 +- install/00-apt-pkglist | 1 + tests/test_binaries.py | 20 ++- 9 files changed, 145 insertions(+), 123 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5244ae0..3df46cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -from ubuntu:bionic as install +FROM ubuntu:bionic as install # Install sudo and make, git since built-in is skipped RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections diff --git a/README.md b/README.md index 40d8fc1..4715238 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ Collection of experimental dotfiles and supporting install scripts. Tested on and compatible with: - * Ubuntu 18.04 - * Ubuntu 20.04 + +- Ubuntu 20.04 ## Install @@ -13,17 +13,19 @@ Tested on and compatible with: Shell: 🐟 fish (+ fisher) -Editor: nvim (+ vim-plug) +Editor: neovim (+ vim-plug) Tools: -* aws -* docker (+ docker-compose) -* firebase -* terraform -* screenfetch + +- aws, gcloud, firebase +- docker (+ docker-compose) +- kubectl +- terraform +- screenfetch Languages: -* java -* js (nvm, node yarn, nvm) -* python (+ poetry, pyenv) -* ruby + +- java +- js (nvm, node, yarn) +- python (pyenv, poetry) +- ruby diff --git a/files/.config/nvim/base.vim b/files/.config/nvim/base.vim index 2863e90..12509ac 100644 --- a/files/.config/nvim/base.vim +++ b/files/.config/nvim/base.vim @@ -49,7 +49,7 @@ set updatetime=100 set timeoutlen=300 " Don't pass messages to |ins-completion-menu|. -set shortmess+=c +set shortmess=atT " Always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. diff --git a/files/.config/nvim/coc-settings.json b/files/.config/nvim/coc-settings.json index 25cc390..c28396c 100644 --- a/files/.config/nvim/coc-settings.json +++ b/files/.config/nvim/coc-settings.json @@ -1,99 +1,113 @@ { - "coc.preferences.formatOnSaveFiletypes": [""], - "coc.preferences.extensionUpdateCheck": "daily", + "coc.preferences.formatOnSaveFiletypes": [ + "css", + "dockerfile", + "html", + "javascript", + "javascriptreact", + "json", + "make", + "markdown", + "perl", + "python", + "sh", + "svg", + "toml", + "typescript", + "typescriptreact", + "vim", + "xml", + "yaml" + ], + "coc.preferences.extensionUpdateCheck": "daily", - "list.source.files.args": ["--hidden" , "--files"], + "list.source.files.args": ["--hidden", "--files"], - "suggest.echodocSupport": true, + "suggest.echodocSupport": true, - "python.pythonPath": "python3", - "python.jediEnabled": false, - "python.linting.flake8Enabled": true, - "python.linting.pylintEnabled": false, + "python.pythonPath": "python3", + "python.jediEnabled": false, + "python.linting.flake8Enabled": true, + "python.linting.pylintEnabled": false, - "languageserver": { - "terraform": { - "command": "terraform-ls", - "args": ["serve"], - "filetypes": ["tf", "terraform"], - "initializationOptions": {}, - "settings": {} - } - }, + "languageserver": { + "terraform": { + "command": "terraform-ls", + "args": ["serve"], + "filetypes": ["tf", "terraform"], + "initializationOptions": {}, + "settings": {} + } + }, - "explorer.width": 30, - "explorer.file.root.template": "[icon] [git] [hidden & 1][root]", - "explorer.icon.enableNerdfont": true, - "explorer.previewAction.onHover": false, - "explorer.icon.enableVimDevicons": false, - "explorer.file.showHiddenFiles": true, - "explorer.file.autoReveal": true, - "explorer.keyMappings.global": { - "i": false, + "explorer.width": 30, + "explorer.file.root.template": "[icon] [git] [hidden & 1][root]", + "explorer.icon.enableNerdfont": true, + "explorer.previewAction.onHover": false, + "explorer.icon.enableVimDevicons": false, + "explorer.file.showHiddenFiles": true, + "explorer.file.autoReveal": true, + "explorer.keyMappings.global": { + "i": false, - "gk": "expandablePrev", - "gj": "expandableNext", + "gk": "expandablePrev", + "gj": "expandableNext", - "*": "toggleSelection", - "": "actionMenu", + "*": "toggleSelection", + "": "actionMenu", - "h": "collapse", - "l": ["expandable?", "expand", "open"], - "J": ["toggleSelection", "nodeNext"], - "K": ["toggleSelection", "nodePrev"], - "gl": "expandRecursive", - "gh": "collapseRecursive", - "<2-LeftMouse>": [ - "expandable?", - ["expanded?", "collapse", "expand"], - "open" - ], - "o": ["expanded?", "collapse", "expand"], - "": ["expandable?", "cd", "open"], - "e": "open", - "s": "open:split", - "S": "open:split:plain", - "E": "open:vsplit", - "t": "open:tab", - "": "gotoParent", - "gp": "preview:labeling", + "h": "collapse", + "l": ["expandable?", "expand", "open"], + "J": ["toggleSelection", "nodeNext"], + "K": ["toggleSelection", "nodePrev"], + "gl": "expandRecursive", + "gh": "collapseRecursive", - "y": "copyFilepath", - "Y": "copyFilename", - "c": "copyFile", - "x": "cutFile", - "p": "pasteFile", - "d": "delete", - "D": "deleteForever", + "o": ["expanded?", "collapse", "expand"], + "": ["expandable?", "cd", "open"], + "e": "open", + "s": "open:split", + "v": "open:vsplit", + "t": "open:tab", + "": "gotoParent", + "gp": "preview:labeling", - "a": "addFile", - "A": "addDirectory", - "r": "rename", + "y": "copyFilepath", + "Y": "copyFilename", + "c": "copyFile", + "x": "cutFile", + "p": "pasteFile", + "d": "delete", + "D": "deleteForever", - ".": "toggleHidden", - "R": "refresh", + "a": "addFile", + "A": "addDirectory", + "r": "rename", - "?": "help", - "q": "quit", - "": "esc", - "X": "systemExecute", - "gd": "listDrive", + ".": "toggleHidden", + "R": "refresh", - "f": "search", - "F": "searchRecursive", + "?": "help", + "q": "quit", + "": "esc", + "X": "systemExecute", + "gd": "listDrive", - "gf": "gotoSource:file", - "gb": "gotoSource:buffer", + "f": "search", + "F": "searchRecursive", - "[[": "sourcePrev", - "]]": "sourceNext", + "gf": "gotoSource:file", + "gb": "gotoSource:buffer", - "[d": "diagnosticPrev", - "]d": "diagnosticNext", + "[[": "sourcePrev", + "]]": "sourceNext", - "[c": "gitPrev", - "]c": "gitNext", - "<<": "gitStage", - ">>": "gitUnstage" - } + "[d": "diagnosticPrev", + "]d": "diagnosticNext", + + "[c": "gitPrev", + "]c": "gitNext", + "<<": "gitStage", + ">>": "gitUnstage" + } } diff --git a/files/.config/nvim/mappings.vim b/files/.config/nvim/mappings.vim index 1a0f3bd..aec4ea6 100644 --- a/files/.config/nvim/mappings.vim +++ b/files/.config/nvim/mappings.vim @@ -87,10 +87,13 @@ nmap E :CocCommand explorer --reveal expand('') " j - Jump to implementation of current symbol " s - Fuzzy search current project symbols " n - Symbol renaming +" k - Symbol renaming nmap (coc-diagnostic-prev) nmap (coc-diagnostic-next) +" broken d nmap d (coc-definition) nmap r (coc-references) +" broken j nmap j (coc-implementation) nmap s :CocList -I -N --top symbols nmap n (coc-rename) @@ -103,25 +106,6 @@ nnoremap h :%s/// nnoremap / :nohlsearch -" use for trigger completion and navigate to next complete item -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~ '\s' -endfunction - -" Use to trigger completion. -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - " Use K to show documentation in preview window. nnoremap K :call show_documentation() @@ -145,5 +129,3 @@ augroup mygroup " Update signature help on jump placeholder. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end - - diff --git a/files/.config/nvim/plugins.vim b/files/.config/nvim/plugins.vim index b36d874..5003ac3 100644 --- a/files/.config/nvim/plugins.vim +++ b/files/.config/nvim/plugins.vim @@ -17,7 +17,11 @@ Plug 'ryanoasis/vim-devicons' " status line Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' " {{{ + " Theme + let g:airline_theme = 'base16_seti' + " Enable extensions let g:airline_extensions = ['branch', 'coc', 'hunks'] @@ -124,24 +128,32 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} " {{{ let g:coc_global_extensions = [ \ 'coc-actions', + \ 'coc-clangd', \ 'coc-css', + \ 'coc-docker', \ 'coc-emmet', \ 'coc-emoji', \ 'coc-eslint', \ 'coc-explorer', + \ 'coc-fish', \ 'coc-fzf-preview', \ 'coc-git', + \ 'coc-go', + \ 'coc-groovy', \ 'coc-highlight', \ 'coc-html', \ 'coc-json', \ 'coc-lists', \ 'coc-marketplace', + \ 'coc-perl', \ 'coc-prettier', \ 'coc-python', + \ 'coc-rust-analyzer', \ 'coc-sh', \ 'coc-snippets', \ 'coc-svg', \ 'coc-tabnine', + \ 'coc-toml', \ 'coc-tsserver', \ 'coc-vimlsp', \ 'coc-xml', diff --git a/files/.profile b/files/.profile index f0668c3..82eda0f 100644 --- a/files/.profile +++ b/files/.profile @@ -61,10 +61,11 @@ export VISUAL="nvim" # fzf export FZF_DEFAULT_OPTS="--reverse --margin=1,5%" -export FZF_DEFAULT_COMMAND='rg --files --smart-case --hidden --follow --no-ignore-vcs' +export FZF_DEFAULT_COMMAND='fdfind --type f --hidden --follow --exclude .git' +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_COMPLETION_TRIGGER='**' -# do not use fishlogin +# do not use fishlogin for subshells export SHELL=/bin/sh # _ _ _ ____ @@ -80,3 +81,5 @@ alias vi='vim' alias bat='batcat' alias cat='bat' + +alias j="z" diff --git a/install/00-apt-pkglist b/install/00-apt-pkglist index 7d125bf..9911034 100644 --- a/install/00-apt-pkglist +++ b/install/00-apt-pkglist @@ -1,6 +1,7 @@ apt-transport-https bat curl +fdfind git gnupg2 jq diff --git a/tests/test_binaries.py b/tests/test_binaries.py index 85ad765..835845b 100644 --- a/tests/test_binaries.py +++ b/tests/test_binaries.py @@ -4,7 +4,7 @@ # from distutils.spawn import find_executable from typing import List -from subprocess import run, CalledProcessError +from subprocess import run import pytest @@ -26,7 +26,7 @@ def in_shell_path(shell: str, binary: str) -> bool: try: result = run(command, shell=True) return (result.returncode == 0) - except: + except Exception: return False @@ -49,7 +49,9 @@ binaries: List[str] = [ "nvim", "firebase", "aws", + "gcloud", "terraform", + "kubectl", "docker", "docker-compose", "screenfetch", @@ -65,13 +67,19 @@ binaries: List[str] = [ "node", "npm", "yarn", - "elm", + # "elm", + + # language: java + "java", + + # langauge: ruby + "ruby" ] -# ---------------------------------------------------------------------------- # -# Tests -# ---------------------------------------------------------------------------- # +# --------------------------------------------------------------------------- # +# Tests +# --------------------------------------------------------------------------- # @pytest.mark.parametrize("shell", shells) def test_shells(shell: str): """ Assert all shells we expect are in PATH. """