From ae81a6be21b86ea34938caf7cbb34532e71e3379 Mon Sep 17 00:00:00 2001 From: Andrejus Date: Mon, 26 Oct 2020 17:01:20 +0000 Subject: [PATCH 1/3] Bump TF version and language server, coc.nvim fixes --- .gitignore | 1 + files/.bash_profile | 1 + files/.config/nvim/base.vim | 14 ++++++++++++++ files/.config/nvim/coc-settings.json | 10 ++++++++-- files/.config/nvim/mappings.vim | 1 + install/34-terraform.sh | 24 +++++++++++++++--------- 6 files changed, 40 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 396f466..2ccebbe 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ logs/* **/wslu **/TabNine **/firebase +**/pypoetry # pytest **/__pycache__ diff --git a/files/.bash_profile b/files/.bash_profile index 0a45628..4bfc7d0 100644 --- a/files/.bash_profile +++ b/files/.bash_profile @@ -8,3 +8,4 @@ # References: # https://unix.stackexchange.com/questions/192521/loading-profile-from-bash-profile-or-not-using-bash-profile-at-all # https://www.stefaanlippens.net/my_bashrc_aliases_profile_and_other_stuff/ +if [ -e /home/andrejus/.nix-profile/etc/profile.d/nix.sh ]; then . /home/andrejus/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer diff --git a/files/.config/nvim/base.vim b/files/.config/nvim/base.vim index 379fcfe..3f1f5fe 100644 --- a/files/.config/nvim/base.vim +++ b/files/.config/nvim/base.vim @@ -41,8 +41,22 @@ set nowrap " two lines for command line set cmdheight=2 +" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable +" delays and poor user experience. set updatetime=300 +" Don't pass messages to |ins-completion-menu|. +set shortmess+=c + +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved. +if has("patch-8.1.1564") + " Recently vim can merge signcolumn and number column into one + set signcolumn=number +else + set signcolumn=yes +endif + " ============================================================================ " " === UI === " " ============================================================================ " diff --git a/files/.config/nvim/coc-settings.json b/files/.config/nvim/coc-settings.json index b090e57..5c361dd 100644 --- a/files/.config/nvim/coc-settings.json +++ b/files/.config/nvim/coc-settings.json @@ -1,9 +1,15 @@ { + "suggest.echodocSupport": true, + "python.jediEnabled": false, + "python.linting.pylintEnabled": false, + "python.linting.flake8Enabled": true, "languageserver": { "terraform": { - "command": "terraform-lsp", + "command": "terraform-ls", + "args": ["serve"], "filetypes": ["tf", "terraform"], - "initializationOptions": {} + "initializationOptions": {}, + "settings": {} } } } diff --git a/files/.config/nvim/mappings.vim b/files/.config/nvim/mappings.vim index 156a5b9..821c721 100644 --- a/files/.config/nvim/mappings.vim +++ b/files/.config/nvim/mappings.vim @@ -85,6 +85,7 @@ inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() +inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 diff --git a/install/34-terraform.sh b/install/34-terraform.sh index 74ac7ab..cd4433b 100755 --- a/install/34-terraform.sh +++ b/install/34-terraform.sh @@ -1,11 +1,13 @@ #!/usr/bin/env bash source "$(dirname $0)/utils.sh" +tf_version="0.13.5" if not_installed "terraform"; then echo "Installing terraform..." - wget https://releases.hashicorp.com/terraform/0.12.24/terraform_0.12.24_linux_amd64.zip - unzip terraform_0.12.24_linux_amd64.zip -d "$dotfiles_dir/tmp" - rm terraform_0.12.24_linux_amd64.zip + tf_archive="terraform_${tf_version}_linux_amd64.zip" + wget "https://releases.hashicorp.com/terraform/${tf_version}/${tf_archive}" + unzip "$tf_archive" -d "$dotfiles_dir/tmp" + rm "$tf_archive" mkdir -p ~/.local/bin mv "$dotfiles_dir/tmp/terraform" ~/.local/bin rm "$dotfiles_dir/tmp/terraform" @@ -14,12 +16,16 @@ fi echo "terraform is installed" terraform --version -if not_installed "terraform-lsp"; then - echo "Installing terraform-lsp..." - wget https://github.com/juliosueiras/terraform-lsp/releases/download/v0.0.11-beta2/terraform-lsp_0.0.11-beta2_linux_amd64.tar.gz - tar -C "$dotfiles_dir/tmp" -xzf terraform-lsp_0.0.11-beta2_linux_amd64.tar.gz - rm terraform-lsp_0.0.11-beta2_linux_amd64.tar.gz - mv "$dotfiles_dir/tmp/terraform-lsp" ~/.local/bin +tf_lsp_version="0.8.0" +if not_installed "terraform-ls"; then + echo "Installing terraform-ls..." + tf_lsp_archive="terraform-ls_${tf_lsp_version}_linux_amd64.zip" + wget "https://releases.hashicorp.com/terraform-ls/${tf_lsp_version}/${tf_lsp_archive}" + unzip "${tf_lsp_archive}" -d "$dotfiles_dir/tmp" + rm "${tf_lsp_archive}" + mkdir -p ~/.local/bin + mv "$dotfiles_dir/tmp/terraform-ls" ~/.local/bin + rm "$dotfiles_dir/tmp/terraform-ls" fi echo "terraform-lsp is installed" From 75b5a04b97ea3244fd8eede31b2495d976e2ae02 Mon Sep 17 00:00:00 2001 From: Andrejus Date: Sun, 8 Nov 2020 21:23:07 +0000 Subject: [PATCH 2/3] Tidy vim plugins --- files/.config/fish/config.fish | 22 ++-- files/.config/fish/fishfile | 9 +- files/.config/nvim/base.vim | 93 +++++++++-------- files/.config/nvim/coc-settings.json | 88 +++++++++++++++- files/.config/nvim/mappings.vim | 69 ++++++++----- files/.config/nvim/plugins-config.vim | 29 ++---- files/.config/nvim/plugins.vim | 142 +++++++++++++------------- files/.profile | 120 ++++++++++++++-------- install/02-fish.sh | 2 +- install/16-vim.sh | 2 +- 10 files changed, 357 insertions(+), 219 deletions(-) diff --git a/files/.config/fish/config.fish b/files/.config/fish/config.fish index 14d8d8d..16be849 100644 --- a/files/.config/fish/config.fish +++ b/files/.config/fish/config.fish @@ -1,12 +1,12 @@ -# ---------------------------------------------------------------------------- # -# Cross-shell (only import if environment has been setup) -# ---------------------------------------------------------------------------- # -if begin; test -e ~/.bash_profile; and type -q bass; end - bass source ~/.bash_profile +if status --is-interactive + # Cross-shell setup + if begin; test -e ~/.bash_profile; and type -q bax; end + bax "source ~/.bash_profile" + end + + # Fish specific + set fish_greeting + if type -q base16-seti + base16-seti + end end - -# ---------------------------------------------------------------------------- # -# Fish specific -# ---------------------------------------------------------------------------- # -set fish_greeting -base16-seti diff --git a/files/.config/fish/fishfile b/files/.config/fish/fishfile index bec3d00..6fd64bd 100644 --- a/files/.config/fish/fishfile +++ b/files/.config/fish/fishfile @@ -1,5 +1,8 @@ fishpkg/fish-prompt-mono -acomagu/fish-async-prompt -matchai/fish-mock -edc/bass tomyun/base16-fish +gazorby/fish-abbreviation-tips +oh-my-fish/plugin-license +matchai/fish-mock +jorgebucaran/fish-bax +jethrokuan/z +joseluisq/gitnow diff --git a/files/.config/nvim/base.vim b/files/.config/nvim/base.vim index 3f1f5fe..2863e90 100644 --- a/files/.config/nvim/base.vim +++ b/files/.config/nvim/base.vim @@ -1,23 +1,31 @@ " ============================================================================ " " === EDITING OPTIONS === " " ============================================================================ " +" +" Leader key +let g:mapleader=' ' + +" Use posix-compliant shell +set shell=sh + +" Enable syntax highlighting +syntax enable +filetype on +filetype plugin on + +" Hides buffers instead of closing them +set hidden + +" do not wrap long lines by default +set nowrap " default encoding set encoding=utf-8 set fileencoding=utf-8 set fileformat=unix -filetype on -filetype plugin on -syntax on - -" Leader key -let g:mapleader=' ' " Yank and paste with the system clipboard -set clipboard= - -" Hides buffers instead of closing them -set hidden +set clipboard=unnamedplus " et = expandtab (spaces instead of tabs) " ts = tabstop (the number of spaces that a tab equates to) @@ -25,25 +33,20 @@ set hidden " -- or de-indenting -- a line) " sts = softtabstop (the number of spaces to use when expanding tabs) set et sts=4 sw=4 ts=4 +set showtabline=4 set foldenable set foldmethod=indent set foldlevel=99 -set conceallevel=1 +set conceallevel=0 -set number -set relativenumber - -" do not wrap long lines by default -set nowrap - -" two lines for command line -set cmdheight=2 +set scrolloff=10 " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable " delays and poor user experience. -set updatetime=300 +set updatetime=100 +set timeoutlen=300 " Don't pass messages to |ins-completion-menu|. set shortmess+=c @@ -57,12 +60,22 @@ else set signcolumn=yes endif +" coc.nvim recommendations +set nobackup +set nowritebackup + " ============================================================================ " " === UI === " " ============================================================================ " +" Support italics +hi Comment cterm=italic + " Enable true color support -set termguicolors +if (has("termguicolors")) + set termguicolors + hi LineNr ctermbg=NONE guibg=NONE +endif " Set preview window to appear at bottom and right set splitbelow @@ -74,33 +87,25 @@ set noshowmode " Set floating window to be slightly transparent set winbl=10 -" ============================================================================ " -" === MISC. === " -" ============================================================================ " +" Enable ruler +set ruler +set number +set relativenumber -" Automaticaly close nvim if NERDTree is only thing left open -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +" Pop-up menu +set pumheight=10 -" === Search === " -" ignore case when searching -set ignorecase +" two lines for command line +set cmdheight=2 + +" no visual bell +set visualbell t_vb= " if the search string has an upper case letter in it, the search will be case sensitive set smartcase -" Enable spellcheck for markdown files -autocmd BufRead,BufNewFile *.md setlocal spell +" Redraw on resize +autocmd VimResized * redraw! -" Set backups -if has('persistent_undo') - set undofile - set undolevels=3000 - set undoreload=10000 -endif -set backupdir=$XDG_DATA_HOME/nvim/backup " Don't put backups in current dir -set backup -set noswapfile - -" Some servers have issues with backup files, see #649. -" set nobackup -" set nowritebackup +" Redraw on writing buffer +autocmd BufWritePost * redraw! diff --git a/files/.config/nvim/coc-settings.json b/files/.config/nvim/coc-settings.json index 5c361dd..25cc390 100644 --- a/files/.config/nvim/coc-settings.json +++ b/files/.config/nvim/coc-settings.json @@ -1,8 +1,16 @@ { + "coc.preferences.formatOnSaveFiletypes": [""], + "coc.preferences.extensionUpdateCheck": "daily", + + "list.source.files.args": ["--hidden" , "--files"], + "suggest.echodocSupport": true, + + "python.pythonPath": "python3", "python.jediEnabled": false, - "python.linting.pylintEnabled": false, "python.linting.flake8Enabled": true, + "python.linting.pylintEnabled": false, + "languageserver": { "terraform": { "command": "terraform-ls", @@ -11,5 +19,81 @@ "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, + + "gk": "expandablePrev", + "gj": "expandableNext", + + "*": "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", + + "y": "copyFilepath", + "Y": "copyFilename", + "c": "copyFile", + "x": "cutFile", + "p": "pasteFile", + "d": "delete", + "D": "deleteForever", + + "a": "addFile", + "A": "addDirectory", + "r": "rename", + + ".": "toggleHidden", + "R": "refresh", + + "?": "help", + "q": "quit", + "": "esc", + "X": "systemExecute", + "gd": "listDrive", + + "f": "search", + "F": "searchRecursive", + + "gf": "gotoSource:file", + "gb": "gotoSource:buffer", + + "[[": "sourcePrev", + "]]": "sourceNext", + + "[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 821c721..1a0f3bd 100644 --- a/files/.config/nvim/mappings.vim +++ b/files/.config/nvim/mappings.vim @@ -1,4 +1,4 @@ -" No arrow keys +" Disable arrow keys noremap noremap noremap @@ -9,6 +9,25 @@ inoremap inoremap +" Disable manual and ex mode +nnoremap +nnoremap Q + + +" Quick escape +inoremap jk +inoremap kj + + +" Quick save +nnoremap :w + + +" Better tabbing +vnoremap < >gv + + " Quick window switching " Ctrl-[hjkl] nnoremap h @@ -17,6 +36,20 @@ nnoremap k nnoremap l +" Quick window resizing +" Alt-[hjkl] +nnoremap :resize -2 +nnoremap :resize +2 +nnoremap :vertical resize -2 +nnoremap :vertical resize +2 + + +" Quicker omni complete nav +" Ctrl-[jk] +inoremap ("\") +inoremap ("\") + + " Distraction free typing " l - Toggle Goyo and Limelight nnoremap l :Goyo @@ -39,11 +72,11 @@ nnoremap f :Rg nnoremap ; :Buffers -" NERDTree -" e - Toggle NERDTree on/off -" E - Open current file location in NERDTree -nnoremap e :NERDTreeToggle -nnoremap E :NERDTreeFind +" coc.nvim explorer +" e - Toggle explorer on/off +" E - Open current file location +nmap e :CocCommand explorer +nmap E :CocCommand explorer --reveal expand('') " coc.nvim @@ -54,15 +87,13 @@ nnoremap E :NERDTreeFind " j - Jump to implementation of current symbol " s - Fuzzy search current project symbols " n - Symbol renaming -" y - Format selected code -nnoremap (coc-diagnostic-prev) -nnoremap (coc-diagnostic-next) -nnoremap d (coc-definition) -nnoremap r (coc-references) -nnoremap j (coc-implementation) -nnoremap s :CocList -I -N --top symbols -nnoremap n (coc-rename) -nnoremap y (coc-format-selected) +nmap (coc-diagnostic-prev) +nmap (coc-diagnostic-next) +nmap d (coc-definition) +nmap r (coc-references) +nmap j (coc-implementation) +nmap s :CocList -I -N --top symbols +nmap n (coc-rename) " Search shorcuts @@ -72,14 +103,6 @@ nnoremap h :%s/// nnoremap / :nohlsearch -" Easy-motion shortcut -" w - move to word bi-directionally -" W{char} - move to {char} -nnoremap w (easymotion-bd-w) -nnoremap W (easymotion-bd-f) - - - " use for trigger completion and navigate to next complete item inoremap \ pumvisible() ? "\" : diff --git a/files/.config/nvim/plugins-config.vim b/files/.config/nvim/plugins-config.vim index 1c8e848..bbc13b1 100644 --- a/files/.config/nvim/plugins-config.vim +++ b/files/.config/nvim/plugins-config.vim @@ -2,28 +2,21 @@ set background=dark colorscheme base16-seti -" Coc.nvim - " Close preview window when completion is done. autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif " Disable deprecated python2 provider let g:loaded_python_provider = 0 -" Call method on window enter -augroup WindowManagement - autocmd! - autocmd WinEnter * call Handle_Win_Enter() -augroup END +" " Call method on window enter +" augroup WindowManagement +" autocmd! +" autocmd WinEnter * call Handle_Win_Enter() +" augroup END -" Change highlight group of preview window when open -function! Handle_Win_Enter() - if &previewwindow - setlocal winhighlight=Normal:MarkdownError - endif -endfunction - -" Reload icons after init source -if exists('g:loaded_webdevicons') - call webdevicons#refresh() -endif +" " Change highlight group of preview window when open +" function! Handle_Win_Enter() +" if &previewwindow +" setlocal winhighlight=Normal:MarkdownError +" endif +" endfunction diff --git a/files/.config/nvim/plugins.vim b/files/.config/nvim/plugins.vim index 824a5e5..b36d874 100644 --- a/files/.config/nvim/plugins.vim +++ b/files/.config/nvim/plugins.vim @@ -9,34 +9,12 @@ Plug 'chriskempson/base16-vim' " dev icons Plug 'ryanoasis/vim-devicons' " {{{ - let g:webdevicons_enable_nerdtree = 1 - let g:webdevicons_conceal_nerdtree_brackets = 1 - let g:webdevicons_enable_airline_tabline = 1 let g:webdevicons_enable_airline_statusline = 1 let g:webdevicons_enable_startify = 1 " }}} -" explorer sidebar -Plug 'scrooloose/nerdtree' -Plug 'tiagofumo/vim-nerdtree-syntax-highlight' -" {{{ - " Show hidden files/directories - let g:NERDTreeShowHidden = 1 - - " Remove bookmarks and help text from NERDTree - let g:NERDTreeMinimalUI = 1 - let g:NERDTreeMinimalMenu = 1 - - " Remove icons for expandable/expanded directories - let g:NERDTreeDirArrowExpandable = '' - let g:NERDTreeDirArrowCollapsible = '' - - " Hide certain files and directories from NERDTree - let g:NERDTreeIgnore = ['\.git$[[dir]]'] -" }}} - " status line Plug 'vim-airline/vim-airline' " {{{ @@ -46,37 +24,34 @@ Plug 'vim-airline/vim-airline' " Do not draw separators for empty sections (only for the active window) > let g:airline_skip_empty_sections = 1 - " Smartly uniquify buffers names with similar filename, suppressing common parts of paths. - let g:airline#extensions#tabline#formatter = 'unique_tail_improved' - " Custom setup that removes filetype/whitespace from default vim airline bar - " let g:airline#extensions#default#layout = [['a', 'b', 'c'], ['x', 'z', 'warning', 'error']] + let g:airline#extensions#default#layout = [['a', 'b', 'c'], ['x', 'z', 'warning', 'error']] " Customize vim airline per filetype - " 'nerdtree' - Hide nerdtree status line " 'list' - Only show file type plus current line number out of total let g:airline_filetype_overrides = { - \ 'coc-explorer': [ 'CoC Explorer', '' ], + \ 'coc-explorer': [ ' Explore', '' ], \ 'fugitive': ['fugitive', '%{airline#util#wrap(airline#extensions#branch#get_head(),80)}'], \ 'help': [ 'Help', '%f' ], \ 'startify': [ 'startify', '' ], \ 'vim-plug': [ 'Plugins', '' ], - \ 'nerdtree': [ get(g:, 'NERDTreeStatusline', ''), '' ], \ 'list': [ '%y', '%l/%L'], \ } " Enable powerline fonts let g:airline_powerline_fonts = 1 + let g:airline_left_sep = '' + let g:airline_right_sep = '' + let g:airline_right_alt_sep = '' " Enable caching of syntax highlighting groups let g:airline_highlighting_cache = 1 -" }}} - -" Print function signatures in echo area -Plug 'Shougo/echodoc.vim' -" {{{ - " Enable echodoc on startup - let g:echodoc#enable_at_startup = 1 + + " Enable tabline + let g:airline#extensions#tabline#enabled = 1 + let g:airline#extensions#tabline#left_sep = ' ' + let g:airline#extensions#tabline#left_alt_sep = '|' + let g:airline#extensions#tabline#formatter = 'unique_tail_improved' " }}} " start screen @@ -90,20 +65,46 @@ Plug 'junegunn/limelight.vim' Plug 'kkoomen/vim-doge' " auto-close plugins -Plug 'rstacruz/vim-closer' Plug 'tpope/vim-endwise' -" better motion -Plug 'easymotion/vim-easymotion' -Plug 'tpope/vim-surround' -Plug 'svermeulen/vim-subversive' -Plug 'godlygeek/tabular' +" easier commentary Plug 'tpope/vim-commentary' +" easier alignment +Plug 'godlygeek/tabular' + +" extra visual feedback +Plug 'junegunn/rainbow_parentheses.vim' +" {{{ + let g:rainbow_active = 1 + let g:rainbow#pairs = [['(', ')'], ['[', ']'], ['{', '}']] + let g:rainbow_conf = {'guis': ['bold']} +" }}} +Plug 'unblevable/quick-scope' + +" better motion +Plug 'tpope/vim-surround' +Plug 'justinmk/vim-sneak' +" {{{ + let g:sneak#label = 1 + let g:sneak#prompt = ' ' + + " case insensitive + let g:sneak#use_ic_scs = 1 + + " move to next search if cursor hasn't moved + let g:sneak#s_next = 1 +" }}} + " git tools Plug 'mhinz/vim-signify' " {{{ + let g:signify_sign_add = '+' let g:signify_sign_delete = '-' + let g:signify_sign_change = '~' + + let g:signify_sign_show_count = 0 + let g:signify_sign_show_text = 1 " }}} Plug 'tpope/vim-fugitive' @@ -111,44 +112,41 @@ Plug 'tpope/vim-fugitive' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' " {{{ - let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.9 } } + let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } let g:fzf_preview_window = ['right:66%', 'ctrl-/'] - let g:fzf_buffers_jump = 1 - let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' - - let $FZF_DEFAULT_OPTS="--ansi --layout reverse --margin=1,4 --preview 'batcat --color=always --style=header,grid --line-range :300 {}'" - let $FZF_DEFAULT_COMMAND = 'rg --files --ignore-case --hidden -g "!{.git,node_modules,vendor}/*"' - command! -bang -nargs=? -complete=dir Files - \ call fzf#vim#files(, { 'options': $FZF_DEFAULT_OPTS}, 0) " }}} +Plug 'antoinemadec/coc-fzf' +Plug 'airblade/vim-rooter' " coc Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} " {{{ - " Keep in sync with below let g:coc_global_extensions = [ - \ 'coc-css', - \ 'coc-eslint', - \ 'coc-git', - \ 'coc-html', - \ 'coc-json', - \ 'coc-prettier', - \ 'coc-python', - \ 'coc-tabnine', - \ 'coc-tsserver', - \ 'coc-yaml', - \] + \ 'coc-actions', + \ 'coc-css', + \ 'coc-emmet', + \ 'coc-emoji', + \ 'coc-eslint', + \ 'coc-explorer', + \ 'coc-fzf-preview', + \ 'coc-git', + \ 'coc-highlight', + \ 'coc-html', + \ 'coc-json', + \ 'coc-lists', + \ 'coc-marketplace', + \ 'coc-prettier', + \ 'coc-python', + \ 'coc-sh', + \ 'coc-snippets', + \ 'coc-svg', + \ 'coc-tabnine', + \ 'coc-tsserver', + \ 'coc-vimlsp', + \ 'coc-xml', + \ 'coc-yaml', + \ ] " }}} -Plug 'neoclide/coc-css', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-git', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-html', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-tabnine', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'} -Plug 'neoclide/coc-yaml', {'do': 'yarn install --frozen-lockfile'} call plug#end() diff --git a/files/.profile b/files/.profile index 6bee43a..f0668c3 100644 --- a/files/.profile +++ b/files/.profile @@ -1,50 +1,82 @@ -if [ -z "$PROFILE_LOCK" ]; then - export PROFILE_LOCK=1 +# U _____ u _ _ __ __ +# \| ___"|/| \ |"| \ \ /"/u +# | _|" <| \| |> \ \ / // +# | |___ U| |\ |u /\ V /_,-. +# |_____| |_| \_| U \_/-(_/ +# << >> || \\,-.// +# (__) (__)(_") (_/(__) +# +# set PATH so it includes user's private bin +export PATH="$HOME/bin:$PATH" +export PATH="$HOME/.local/bin:$PATH" - # set PATH so it includes user's private bin - export PATH="$HOME/bin:$PATH" - export PATH="$HOME/.local/bin:$PATH" +# xdg data & config +if [ -z "$XDG_DATA_HOME" ]; then + export XDG_DATA_HOME="$HOME/.local/share" +fi +mkdir -p "$XDG_DATA_HOME" +if [ -z "$XDG_CONFIG_HOME" ]; then + export XDG_CONFIG_HOME="$HOME/.config" +fi +mkdir -p "$XDG_CONFIG_HOME" - # xdg data & config - if [ -z "$XDG_DATA_HOME" ]; then - export XDG_DATA_HOME="$HOME/.local/share" - fi - mkdir -p "$XDG_DATA_HOME" - if [ -z "$XDG_CONFIG_HOME" ]; then - export XDG_CONFIG_HOME="$HOME/.config" - fi - mkdir -p "$XDG_CONFIG_HOME" - - # workspace - if [ -z "$WORKSPACE" ]; then - export WORKSPACE="$HOME/workspace" - fi - mkdir -p "$WORKSPACE" - - # pyenv - export PYENV_ROOT="$HOME/.pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" - export PATH="$PYENV_ROOT/shims:$PATH" - if [ -d "$PYENV_ROOT" ]; then - [ -x "$(command -v pyenv)" ] && eval "$(pyenv init -)" - fi - - # poetry - export POETRY_ROOT="$HOME/.poetry" - export PATH="$POETRY_ROOT/bin:$PATH" - - # nvm - if [ -z "$NVM_DIR" ]; then - export NVM_DIR="$HOME/.nvm" - fi - mkdir -p "$NVM_DIR" - export PATH="$NVM_DIR/bin:$PATH" - - # yarn - export YARN_DIR="$HOME/.yarn" - mkdir -p "$YARN_DIR" - export PATH="$YARN_DIR/bin:$PATH" +# workspace +if [ -z "$WORKSPACE" ]; then + export WORKSPACE="$HOME/workspace" +fi +mkdir -p "$WORKSPACE" +# dotfiles +if [ -z "$DOTFILES" ]; then + export DOTFILES="$HOME/.dotfiles" fi +# pyenv +export PYENV_ROOT="$HOME/.pyenv" +export PATH="$PYENV_ROOT/bin:$PATH" +export PATH="$PYENV_ROOT/shims:$PATH" +if [ -d "$PYENV_ROOT" ]; then + [ -x "$(command -v pyenv)" ] && eval "$(pyenv init -)" +fi + +# poetry +export POETRY_ROOT="$HOME/.poetry" +export PATH="$POETRY_ROOT/bin:$PATH" + +# nvm +if [ -z "$NVM_DIR" ]; then +export NVM_DIR="$HOME/.nvm" +fi +mkdir -p "$NVM_DIR" +export PATH="$NVM_DIR/bin:$PATH" + +# yarn +export YARN_DIR="$HOME/.yarn" +mkdir -p "$YARN_DIR" +export PATH="$YARN_DIR/bin:$PATH" + +# editor +export EDITOR="nvim" +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_COMPLETION_TRIGGER='**' + +# do not use fishlogin +export SHELL=/bin/sh + + # _ _ _ ____ +# U /"\ u |"| ___ U /"\ u / __"| u +# \/ _ \/ U | | u |_"_| \/ _ \/ <\___ \/ +# / ___ \ \| |/__ | | / ___ \ u___) | +# /_/ \_\ |_____| U/| |\u /_/ \_\ |____/>> +# \\ >> // \\.-,_|___|_,-.\\ >> )( (__) +# (__) (__)(_")("_)\_)-' '-(_/(__) (__)(__) +# alias vim='nvim' +alias vi='vim' + +alias bat='batcat' +alias cat='bat' diff --git a/install/02-fish.sh b/install/02-fish.sh index 98ee0b9..ca0ee60 100755 --- a/install/02-fish.sh +++ b/install/02-fish.sh @@ -26,7 +26,7 @@ if not_installed "fishlogin"; then mkdir -p ~/bin target="$HOME/bin/fishlogin" tee -a $target << END -#!/bin/bash -l +#!/bin/bash exec -l fish "\$@" END sudo chmod +x $target diff --git a/install/16-vim.sh b/install/16-vim.sh index cf638dd..999aa1d 100755 --- a/install/16-vim.sh +++ b/install/16-vim.sh @@ -15,5 +15,5 @@ npm install -g neovim elm-format sudo gem install neovim echo "Running PlugInstall"; -nvim --headless +PlugInstall +PlugUpgrade +PlugUpdate +qall +nvim --headless +PlugClean! +PlugInstall +PlugUpgrade +PlugUpdate +qall nvim --version From 5f6eec0996328a8755c8124be55b73a56a8274c9 Mon Sep 17 00:00:00 2001 From: Andrejus Date: Mon, 9 Nov 2020 18:21:18 +0000 Subject: [PATCH 3/3] 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. """