From 331df1cb5e57765678751dcc0b7d0a31ec440243 Mon Sep 17 00:00:00 2001 From: Entourage Date: Wed, 11 Sep 2024 02:07:44 -0400 Subject: [PATCH 1/2] Adjustments to tmux/p, remove spacevim --- .zshrc | 48 +++--- config/SpaceVim.d/SpaceVim.d | 1 - config/SpaceVim.d/autoload/bootstrap.vim | 174 --------------------- config/SpaceVim.d/init.toml | 191 ----------------------- 4 files changed, 28 insertions(+), 386 deletions(-) delete mode 120000 config/SpaceVim.d/SpaceVim.d delete mode 100644 config/SpaceVim.d/autoload/bootstrap.vim delete mode 100644 config/SpaceVim.d/init.toml diff --git a/.zshrc b/.zshrc index 20b0d39..cdaaab1 100644 --- a/.zshrc +++ b/.zshrc @@ -40,32 +40,40 @@ zshrc_probe() { zshrc_enter_tmux() { if [[ -n "$(command -v tmux)" ]]; then local session_count=$(tmux ls 2>/dev/null | wc -l) - if [[ "$session_count" -eq "0" ]]; then - if type tmuxp > /dev/null 2>&1; then - local host_config="${HOME}/.tmuxp/$(hostname).yml" + if type tmuxp > /dev/null 2>&1; then + if [[ "$session_count" -eq "0" ]]; then + # Load the tmuxp configuration for the current host, and attach + # if it already exists. + local host_config="${HOME}/.tmuxp/$(hostname).yaml" if [ -s "${host_config}" ]; then - tmuxp load "${host_config}" + tmuxp load -y "${host_config}" else - tmuxp load "${HOME}/.tmuxp/main.yaml" + tmuxp load -y "${HOME}/.tmuxp/main.yaml" fi - else - tmux -2 new-session -s "Main" + elif [[ -n "$TMUX" ]]; then + # If we are already in a tmux session, just display the banner for this shell. + zshrc_display_banner fi else - # Make sure we are not already in a tmux session - if [[ -z "$TMUX" ]]; then - # Session id is date and time to prevent conflict - # TODO: Make session number more... meaningful? - local session_id="$(date +%H%M%S)" - - # Create a new session (without attaching it) and link to base session - # to share windows - tmux -2 new-session -d -t Main -s "$session_id" - - # Attach to the new session & kill it once orphaned - tmux -2 attach-session -t "$session_id" \; set-option destroy-unattached + local session_count=$(tmux ls 2>/dev/null | wc -l) + if [[ "$session_count" -eq "0" ]]; then + tmux -2 new-session -s "Main" else - zshrc_display_banner + # Make sure we are not already in a tmux session + if [[ -z "$TMUX" ]]; then + # Session id is date and time to prevent conflict + # TODO: Make session number more... meaningful? + local session_id="$(date +%H%M%S)" + + # Create a new session (without attaching it) and link to base session + # to share windows + tmux -2 new-session -d -t Main -s "$session_id" + + # Attach to the new session & kill it once orphaned + tmux -2 attach-session -t "$session_id" \; set-option destroy-unattached + else + zshrc_display_banner + fi fi fi else diff --git a/config/SpaceVim.d/SpaceVim.d b/config/SpaceVim.d/SpaceVim.d deleted file mode 120000 index 1df05e4..0000000 --- a/config/SpaceVim.d/SpaceVim.d +++ /dev/null @@ -1 +0,0 @@ -/home/max/src/miscellaneous/config/SpaceVim.d \ No newline at end of file diff --git a/config/SpaceVim.d/autoload/bootstrap.vim b/config/SpaceVim.d/autoload/bootstrap.vim deleted file mode 100644 index e6339d2..0000000 --- a/config/SpaceVim.d/autoload/bootstrap.vim +++ /dev/null @@ -1,174 +0,0 @@ -" TODO LIST -" Spell checking: spell spelllang=en_us -" Cursor line wrapping -" Merge configuration with Neovim Studio -" Plugins: vim-sleuth, vim-lastplace - -func! bootstrap#before() abort - set modeline - set modelines=5 - - let g:vim_arduino_library_path = '/home/max/.local/share/arduino/' - " let g:vim_arduino_serial_port = /my/serial/port - - let g:startify_custom_header = [ - \ ' _ __ _ ', - \ ' / | / /__ ____ _ __(_)___ ___ ', - \ ' / |/ / _ \/ __ \ | / / / __ `__ \', - \ ' / /| / __/ /_/ / |/ / / / / / / /', - \ ' /_/_||||_||/\____/|___/|||/ /_/ /_/ ', - \ ' / ___// /___ ______/ (_)___ ', - \ ' \__ \/ __/ / / / __ / / __ \ ', - \ ' ___/ / /_/ /_/ / /_/ / / /_/ / ', - \ ' /____/\__/\__,_/\__,_/_/\____/ ', - \ ' ', - \ ] - - " Disable concealing of Markdown characters for displaying. - let g:vim_markdown_conceal = 0 - - " Use Galactic's airline theme. - let g:airline_theme='galactic' - let g:gitgutter_realtime = 0 - let g:airline#extensions#tmuxline#enabled = 0 - let g:airline#extensions#bookmark#enabled = 0 - let g:airline#extensions#fugitiveline#enabled = 0 - let g:airline#extensions#hunks#enabled = 0 - - let g:bootstrap_pre_exec = 1 -endf - -func! bootstrap#after() abort - " Keep lines above or below the cursor at all times. - set scrolloff=7 - set colorcolumn=80,125 - - " Wrap around lines in insert mode. - set whichwrap+=<,>,h,l,[,] - - " Raise cmdheight so echodoc can display function parameters. - set cmdheight=2 - - " Default to case insensitive searches. - set ignorecase - set smartcase - - " Decrease idle time. - set updatetime=350 - - " Enable automated fixing. - let g:ale_fixers = { - \ '*': ['remove_trailing_lines', 'trim_whitespace'], - \ 'javascript': ['eslint'], - \ 'typescript': ['eslint'], - \ 'jsx': ['eslint'], - \ 'python': ['black'], - \} - - " Automatically fix on save. - let g:ale_fix_on_save = 1 - - " Disable ALE for C/C++, Python, use LSP exclusively. - let g:ale_linters = { - \ 'c': [], - \ 'cpp': [], - \ 'python': [], - \ 'java': [], - \ 'json': [], - \ 'javascript': [], - \ 'typescript': [], - \ 'jsx': [], - \ 'css': [], - \ 'html': [], - \ 'ruby': [], - \ 'rust': [], - \ 'go': [], - \ 'yaml': [], - \} - - " let g:ale_sign_column_always = 1 - - " let g:signify_sign_add = '+' - " let g:signify_sign_delete = '_' - " let g:signify_sign_delete_first_line = '‾' - let g:signify_sign_change = '~' - " let g:signify_sign_changedelete = g:signify_sign_change - - call SpaceVim#mapping#space#def('nmap', ['c', ''], 'NERDCommenterToggle', 'toggle the comments on the selected line(s)', 0, 1) - let g:_spacevim_mappings_space.l.c = {'name' : '+coc.nvim'} - call SpaceVim#mapping#space#langSPC('nmap', ['l', 'c', 'd'], 'CocList diagnostics', 'show diagnostics', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l', 'c', 'c'], 'CocList extensions', 'list commands', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l', 'c', 'e'], 'CocList extensions', 'list extensions', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l', 'c', 'o'], 'CocList outline', 'list document symbols', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l', 'c', 's'], 'CocList -I symbols', 'list workspace symbols', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l', 'c', 'j'], 'CocNext', 'perform default action', 1) - - " nnoremap lh :call LanguageClient_textDocument_hover() - " nnoremap ld :call LanguageClient_textDocument_definition() - " nnoremap lr :call LanguageClient_textDocument_rename() - - inoremap coc#refresh() - - call coc#config('coc.preferences', { - \ "autoTrigger": "always", - \ "maxCompleteItemCount": 10, - \ "codeLens.enable": 1, - \ "diagnostic.virtualText": 1, - \}) - - " \ 'coc-prettier', - " \ 'coc-imselect', - " \ 'coc-wxml', - " \ 'coc-stylelint', - " \ 'coc-weather', - " \ 'coc-emoji', - " \ 'coc-ultisnips', - " let s:coc_extensions = [ - " \ 'coc-dictionary', - " \ 'coc-json', - " \ 'coc-tag', - " \ 'coc-tslint', - " \ 'coc-eslint', - " \ 'coc-css', - " \ 'coc-html', - " \ 'coc-pyls', - " \ 'coc-solargraph', - " \ 'coc-vetur', - " \ 'coc-json', - " \ 'coc-tsserver', - " \ 'coc-jest', - " \ 'coc-java', - " \ 'coc-rls', - " \ 'coc-highlight', - " \ 'coc-gocode', - " \ 'coc-omni', - " \ 'coc-word', - " \ 'coc-neosnippet', - " \ 'coc-yaml', - " \ 'coc-emmet', - " \ 'coc-snippets', - " \ 'coc-pairs', - " \ 'coc-lists', - " \ 'coc-yank', - " \ 'coc-vimtex', - " \ 'coc-tslint-plugin', - " \] - - " for extension in s:coc_extensions - " call coc#add_extension(extension) - " endfor - - " Jump to next item in snippets with Tab. - " let g:UltiSnipsJumpForwardTrigger="" - " let g:UltiSnipsJumpBackwardTrigger="" - " imap (neosnippet_jump) - - let g:AutoHighlight_ClearOnCursorMoved = 1 - let g:AutoHighlight_ClearOnWindowExit = 1 - - if g:bootstrap_pre_exec - echom('Pre-execution bootstrap completed.') - endif - - echom('Post-execution bootstrap complete.') -endf diff --git a/config/SpaceVim.d/init.toml b/config/SpaceVim.d/init.toml deleted file mode 100644 index 748cadb..0000000 --- a/config/SpaceVim.d/init.toml +++ /dev/null @@ -1,191 +0,0 @@ -#============================================================================= -# dark_powered.toml --- dark powered configuration example for SpaceVim -# Copyright (c) 2016-2017 Wang Shidong & Contributors -# Author: Wang Shidong < wsdjeg at 163.com > -# URL: https://spacevim.org -# License: GPLv3 -#============================================================================= - -# All SpaceVim option below [option] section -[options] - # Bootstrap hooks - bootstrap_before = "bootstrap#before" - bootstrap_after = "bootstrap#after" - - # Aesthetic - colorscheme = "galactic" # "NeoSolarized" - colorscheme_default = "desert" - background = "dark" - enable_guicolors = true - statusline_separator = "arrow" - statusline_inactive_separator = "arrow" - enable_tabline_filetype_icon = true - enable_statusline_display_mode = false # ??? - error_symbol = "x" - warning_symbol = "!" - info_symbol = "i" - buffer_index_type = 2 - - # Automation - autocomplete_parens = true - autocomplete_method = "coc" # :call coc#util#build() - windows_smartclose = "" - - # Tooling - filemanager = "nerdtree" - - # Code - enable_neomake = false - enable_ale = true - lint_on_the_fly = true - default_indent = 4 - expand_tab = true - max_column = 80 - - # Plugins - disabled_plugins = [ - "Clamp", # Prefer ~clangd~ cquery via LSP - "javacomplete2" # Prefer eclipse jdt - ] - -[[custom_plugins]] - name = "tpope/vim-sleuth" -[[custom_plugins]] - name = "sheerun/vim-polyglot" -[[custom_plugins]] - name = "sirtaj/vim-openscad" -[[custom_plugins]] - name = "tpope/vim-abolish" -[[custom_plugins]] - name = "tclem/vim-arduino" -[[custom_plugins]] - name = "tmux-plugins/vim-tmux-focus-events" -[[custom_plugins]] - name = "lygaret/autohighlight.vim" -[[custom_plugins]] - name = "lifepillar/vim-colortemplate" -[[custom_plugins]] - name = "flazz/vim-colorschemes" -[[custom_plugins]] - name = "maxattax97/vim-galactic" - -[[layers]] - # Disable statusline in favor of airline. - name = "core#statusline" - enable = false -[[layers]] - name = "autocomplete" - auto-completion-return-key-behavior = "smart" - auto-completion-tab-key-behavior = "cycle" - auto-completion-delay = 10 - # TODO: Battery conservation by delayed autocompletion. - # https://github.com/w0rp/ale#faq-my-battery-is-sad - # TODO: Install LSP's -[[layers]] - # SPC ' - name = "shell" - default_position = "top" - default_height = 65 -[[layers]] - name = "colorscheme" -[[layers]] - # SPC g . - name = "VersionControl" -[[layers]] - # SPC g - name = "git" -[[layers]] - # SPC g h - name = "github" - # TODO: Setup Github token login -[[layers]] - # SPC e - # Install: npm install -g eslint eslint-config-airbnb - name = "checkers" - # TODO: Battery conservation by delayed linting. -[[layers]] - name = "ui" -[[layers]] - name = "tools" -[[layers]] - # Install: dnf install global global-ctags - name = "tags" -[[layers]] - # CTL p - name = "denite" -[[layers]] - # SPC d - name = "debug" -[[layers]] - name = "edit" -[[layers]] - # SPC f - name = "sudo" -[[layers]] - # CTL - name = "tmux" - -[[layers]] - name = "lsp" - filetypes = [ - ## "python" # Install: pip install --user 'python-language-server[all]' - ## "openscad", - ## "json", - # "sh", # Install: npm install -g bash-language-server - # "dockerfile", # Install: npm install -g dockerfile-language-server-nodejs - # "javascript", # Install: npm install -g javascript-typescript-langserver - # "c", # Install: cquery (https://github.com/cquery-project) - # "cpp", - # "java" # Install: eclipse-jdt (https://github.com/eclipse/eclipse.jdt.ls) - ] - [layers.override_cmd] - ## python = ["pyls", "--check-parent-process"] - # json = ["python3", "/home/max/src/pygls/examples/json-extension/server/__main__.py"] - # openscad = ["tcp://127.0.0.1:2087"] - # dockerfile = ["docker-langserver", "--stdio"] - # c = ["cquery", "--log-file=/tmp/cquery.log", '--init={"cacheDirectory":"/tmp/cquery/", "completion": {"filterAndSort": false}}'] - # cpp = ["cquery", "--log-file=/tmp/cquery.log", '--init={"cacheDirectory":"/tmp/cquery/", "completion": {"filterAndSort": false}}'] - # java = ["eclipse-jdt"] - # TODO: Battery saving techniques. -[[layers]] - # Install: pip install flake8 yapf autoflake isort - enable = false - name = "lang#python" - format-on-save = 1 -[[layers]] - name = "lang#java" - enable = false -#[[layers]] - ## Install: dnf install clang clang-libs - #name = "lang#c" - #clang_executable = "/usr/bin/clang" - #libclang_path = "/usr/lib64/libclang.so.7" - #[layer.clang_std] - #c = "gnu11" - #cpp = "gnu++11" - #objc = "gnu11" - #objcpp = "gnu++11" -[[layers]] - enable = false - name = "lang#sh" -[[layers]] - # SPC j - enable = false - name = "lang#javascript" -[[layers]] - # Install: npm install -g remark remark-cli remark-stringify - enable = false - name = "lang#markdown" -[[layers]] - # Install: npm install -g typescript javascript-typescript-langserver - enable = false - name = "lang#typescript" -[[layers]] - # Install: curl https://sh.rustup.rs -sSf | sh - # Install: rustup component add rust-src - # Install: cargo install racer - enable = false - name = "lang#rust" - recommended-style = true -[[layers]] - name = "lang#r" From e73139cc3eff38aa1349e5e8ce596a9351665872 Mon Sep 17 00:00:00 2001 From: Entourage Date: Wed, 11 Sep 2024 03:07:29 -0400 Subject: [PATCH 2/2] Fix tmux entering on ssh --- .zshrc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.zshrc b/.zshrc index 4d5df14..4286fab 100644 --- a/.zshrc +++ b/.zshrc @@ -41,9 +41,10 @@ zshrc_enter_tmux() { if [[ -n "$(command -v tmux)" ]]; then local session_count=$(tmux ls 2>/dev/null | wc -l) if type tmuxp > /dev/null 2>&1; then - if [[ "$session_count" -eq "0" ]]; then - # Load the tmuxp configuration for the current host, and attach - # if it already exists. + if [[ -z "$TMUX" ]]; then + # If we haven't entered tmux yet, then load the tmuxp + # configuration for the current host, and attach if it already + # exists. local host_config="${HOME}/.tmuxp/$(hostname).yaml" if [ -s "${host_config}" ]; then tmuxp load -y "${host_config}" @@ -351,6 +352,12 @@ zshrc_setup_completion() { fi fi + #if type pipx > /dev/null 2>&1; then + #if [ ! -s "${HOME}/.zsh_completions/_pipx" ]; then + #register-python-argcomplete pipx > "${HOME}/.zsh_completions/_pipx" + #fi + #fi + # Takes a lot of extra time ... #if type molecule > /dev/null 2>&1; then # Because it may be in a venv, we will have to do this on-demand.