From feabd4e98b98a07c02bc6330a08ae9d2b1b5abd9 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Thu, 18 Jul 2019 11:09:33 -0400 Subject: [PATCH] Termux templating/packages --- .chezmoiignore | 2 +- dot_config/chezmoi/chezmoi-template.toml.tmpl | 1 + dot_config/fish/config.fish.tmpl | 17 +++- .../fish/functions/{cd.fish => cd.fish.tmpl} | 6 +- .../fish/functions/git/git-amend-push.fish | 2 +- dot_vimrc.tmpl | 43 ++++++++- key_aliases.tmpl | 57 +++++++---- key_dirs.tmpl | 7 +- key_files.tmpl | 1 - txt/exclude-dirs-backup-full.txt | 0 txt/exclude-dirs-backup.txt.tmpl | 0 txt/gtk-themes.txt | 0 txt/nzxt-aur.txt | 0 txt/nzxt-pkgs.txt | 0 txt/termux-pkgs.txt | 95 +++++++++++++++++++ txt/tex-build-files.txt | 0 txt/todo.md | 0 txt/usbs.md | 0 txt/x1-carbon-aur.txt | 0 txt/x1-carbon-pkgs.txt | 0 20 files changed, 197 insertions(+), 34 deletions(-) rename dot_config/fish/functions/{cd.fish => cd.fish.tmpl} (90%) mode change 100755 => 100644 txt/exclude-dirs-backup-full.txt mode change 100755 => 100644 txt/exclude-dirs-backup.txt.tmpl mode change 100755 => 100644 txt/gtk-themes.txt mode change 100755 => 100644 txt/nzxt-aur.txt mode change 100755 => 100644 txt/nzxt-pkgs.txt create mode 100644 txt/termux-pkgs.txt mode change 100755 => 100644 txt/tex-build-files.txt mode change 100755 => 100644 txt/todo.md mode change 100755 => 100644 txt/usbs.md mode change 100755 => 100644 txt/x1-carbon-aur.txt mode change 100755 => 100644 txt/x1-carbon-pkgs.txt diff --git a/.chezmoiignore b/.chezmoiignore index 6fe46e0..16adaf3 100755 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -1,6 +1,6 @@ README.md -{{ if or (eq .chezmoi.username "root") (not (eq .chezmoi.osRelease.id "arch")) }} +{{ if .gui }} .config/i3/ .config/i3blocks/ .config/mpv/ diff --git a/dot_config/chezmoi/chezmoi-template.toml.tmpl b/dot_config/chezmoi/chezmoi-template.toml.tmpl index cf7acd4..61a91c2 100755 --- a/dot_config/chezmoi/chezmoi-template.toml.tmpl +++ b/dot_config/chezmoi/chezmoi-template.toml.tmpl @@ -4,3 +4,4 @@ sourceDir = "~/linux-config" gui = true ext_kb = true # ext_kb = false + linux_os = "" diff --git a/dot_config/fish/config.fish.tmpl b/dot_config/fish/config.fish.tmpl index 6bcc158..fc33b0f 100755 --- a/dot_config/fish/config.fish.tmpl +++ b/dot_config/fish/config.fish.tmpl @@ -22,11 +22,20 @@ set -U mfs_dir "/home/kevin/coding/mf-site" source /home/kevin/coding/spotify-lib-vis/src/scripts/api-keys-fish.sh {{ end }} -set -x PATH $PATH ~/scripts ~/scripts/colors ~/go/bin +set -x PATH $PATH ~/.local/bin ~/scripts ~/scripts/colors ~/go/bin set -x CLASSPATH $CLASSPATH /home/kevin/java/*.jar set -x LD_LIBRARY_PATH $LD_LIBRARY_PATH /usr/local/lib /usr/local/lib64 set -x PKG_CONFIG_PATH $PKG_CONFIG_PATH /usr/lib/pkgconfig +{{ if eq .linux_os "termux" }} +# set SPACEFISH_PROMPT_ORDER time user dir host git package node docker ruby golang php rust haskell julia aws conda pyenv kubecontext exec_time line_sep battery jobs exit_code vi_mode char +set SPACEFISH_DIR_PREFIX '' +set SPACEFISH_PROMPT_ORDER vi_mode dir git pyenv exec_time jobs exit_code line_sep char +set SPACEFISH_VI_MODE_INSERT '' +set SPACEFISH_VI_MODE_NORMAL '[n] ' +set SPACEFISH_VI_MODE_SUFFIX '' +{{ end }} + set -x PASSWORD_STORE_CLIP_TIME 120 set -xU XSET_RATE 90 set -xU XSET_DELAY 200 @@ -53,8 +62,10 @@ bind \ce edit_command_buffer bind \cr forward-word chezmoi apply -~/scripts/sync-shortcuts -# source ~/.config/fish/key_abbr.fish > /dev/null +{{ if not (eq .linux_os "termux") }} + ~/scripts/sync-shortcuts +{{ end }} +source ~/.config/fish/key_abbr.fish > /dev/null set -U fish_fxn_dir "{{ .chezmoi.homedir }}/linux-config/dot_config/fish/functions" # set -U fish_fxn_dir "~/.config/fish/functions" abbr ff "cd $fish_fxn_dir" diff --git a/dot_config/fish/functions/cd.fish b/dot_config/fish/functions/cd.fish.tmpl similarity index 90% rename from dot_config/fish/functions/cd.fish rename to dot_config/fish/functions/cd.fish.tmpl index ffc7f47..f7f1060 100755 --- a/dot_config/fish/functions/cd.fish +++ b/dot_config/fish/functions/cd.fish.tmpl @@ -46,7 +46,11 @@ function cd --description "Change directory" set -g __fish_cd_direction prev set -U last_dir $PWD - lsd -a + {{ if (not (eq .linux_os "termux")) }} + lsd -a + {{ else }} + ls -a + {{ end }} end return $cd_status diff --git a/dot_config/fish/functions/git/git-amend-push.fish b/dot_config/fish/functions/git/git-amend-push.fish index 84d7861..dd920e1 100755 --- a/dot_config/fish/functions/git/git-amend-push.fish +++ b/dot_config/fish/functions/git/git-amend-push.fish @@ -1,5 +1,5 @@ function git-amend-push - git add -A . + git add -A and git commit --amend --no-edit -S and git push --force end diff --git a/dot_vimrc.tmpl b/dot_vimrc.tmpl index 53b80c8..ef74a23 100755 --- a/dot_vimrc.tmpl +++ b/dot_vimrc.tmpl @@ -124,8 +124,10 @@ Plug 'vim-scripts/L9' " find files from within Vim " Plug 'vim-scripts/FuzzyFinder' +{{ if not .gui }} " Gotham color scheme -" Plug 'whatyouhide/vim-gotham' +Plug 'whatyouhide/vim-gotham' +{{ end }} " " collection of Vim color schemes " Plug 'flazz/vim-colorschemes' @@ -263,13 +265,44 @@ Plug 'kana/vim-textobj-user' Plug 'rbonvall/vim-textobj-latex' " swap words Plug 'tommcdo/vim-exchange' +Plug 'scrooloose/nerdtree' + let NERDTreeQuitOnOpen=1 + let NERDTreeShowHidden=1 +Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } + Plug 'junegunn/fzf.vim' +Plug 'christoomey/vim-tmux-navigator' + let g:tmux_navigator_no_mappings = 1 + " nnoremap :TmuxNavigateDown + " nnoremap :TmuxNavigateUp + " nnoremap :TmuxNavigateLeft + " nnoremap :TmuxNavigateRight + " nnoremap j :TmuxNavigateDown + " nnoremap k :TmuxNavigateUp + " nnoremap h :TmuxNavigateLeft + " nnoremap l :TmuxNavigateRight + " nnoremap :TmuxNavigateDown + " nnoremap :TmuxNavigateUp + " nnoremap :TmuxNavigateLeft + " nnoremap :TmuxNavigateRight + " nnoremap :TmuxNavigateDown + " nnoremap :TmuxNavigateUp + " nnoremap :TmuxNavigateLeft + " nnoremap :TmuxNavigateRight + " nnoremap :TmuxNavigateDown + " nnoremap :TmuxNavigateUp + " nnoremap :TmuxNavigateLeft + " nnoremap :TmuxNavigateRight " ]]] vim-plug " " Mappings [[[ " call plug#end() -" colorscheme gotham256 + +{{ if .gui }} colorscheme wal +{{ else }} +colorscheme gotham256 +{{ end }} " normal mappings [[[ " @@ -340,10 +373,11 @@ nnoremap ll Vjgq nnoremap m :call cursor(0, len(getline('.'))/2) " apply normal command to selection vnoremap n q:anorm -" don't wrap lines -nnoremap nw :set nowrap +nnoremap nt :NERDTree " check if in neovim nnoremap nv :echo has('nvim') +" don't wrap lines +nnoremap nw :set nowrap " recursively open fold nnoremap o zO " Plug commands @@ -416,6 +450,7 @@ nnoremap nnoremap nnoremap nnoremap + " Maximize height/width. nnoremap _ nnoremap | diff --git a/key_aliases.tmpl b/key_aliases.tmpl index 45be0c2..72d2cf9 100755 --- a/key_aliases.tmpl +++ b/key_aliases.tmpl @@ -69,9 +69,13 @@ vdr "vidir --verbose" # directory-related [[[ # -ls "lsd" +{{ if not (eq .linux_os "termux") }} l "lsd -a" ll "lsd -al" +{{ else }} +l "ls -a" +ll "ls -al" +{{ end }} smv "sudo mv" f "cd" fz "fzf" @@ -88,16 +92,17 @@ lhd "sudo fdisk -l" # get disc space for mounted drives # ds "df -h | tee >(head -n 1) >(grep sd) >/dev/null" ds "df -h | head -n 1 && df -h | grep sd" -chownw "sudo chown -R {{ .chezmoi.group }}:wheel" -chwnm "sudo chown -R {{ .chezmoi.group }}:wheel /run/media/{{ .chezmoi.username }}" +chownw "sudo chown -R kevin:wheel" +chwnm "sudo chown -R kevin:wheel /run/media/{{ .chezmoi.username }}" # cd into backup folder and show backup sizes -nbu "cd /run/media/{{ .chezmoi.group }}/backup-hd/{{ .chezmoi.fullHostname }}/tar && lsd -l" +nbu "cd /run/media/kevin/backup-hd/{{ .chezmoi.fullHostname }}/tar && lsd -l" # ]]] directory-related # # power options [[[ # s "systemctl suspend" +x "exit" so "xset dpms force off" sd "systemctl poweroff" rb "systemctl reboot" @@ -120,15 +125,9 @@ vlh "alsamixer -c 2" vlm "alsamixer -c 1" {{ end }} -# apt [[[ # +# pkg management [[[ # -# apti "sudo apt install" -# aptr "sudo apt remove" -# aptu "sudo apt upgrade" - -# ]]] apt # - -{{ if eq .chezmoi.osRelease.id "arch" }} +{{ if eq .linux_os "arch" }}#[[[ # pacman [[[ # # pc "sudo pacman -S" @@ -161,7 +160,26 @@ yaug "yay -Syu --answerclean=None --answerdiff=None --answeredit=None" xya "yay -Qqne > ~/{{ .chezmoi.os }}-config/txt/{{ .chezmoi.fullHostname }}-pkgs.txt && yay -Qqme > ~/{{ .chezmoi.os }}-config/txt/{{ .chezmoi.fullHostname }}-aur.txt " # ]]] yay # -{{ end }} +#]]] + +{{ else if eq .linux_os "termux" }}#[[[ +pki "pkg install" +pkli "pkg list-installed" +pku "pkg uninstall" +pks "pkg search" +xpk "pkg list-installed | awk -F/ '{print \$1}' > ~/{{ .chezmoi.os }}-config/txt/termux-pkgs.txt" + +{{ end }}#]]] + +# apt [[[ # + +# apti "sudo apt install" +# aptr "sudo apt remove" +# aptu "sudo apt upgrade" + +# ]]] apt # + +# ]]] pkg management # py "python" pyt "pytest -vv" @@ -192,6 +210,7 @@ clc "cloc ." cv "cava" dg "dragon-drag-and-drop -x" fh "feh" +fi "fish" gpd "gpg --decrypt" gpe "gpg --encrypt --recipient" htc "htop -s PERCENT_CPU" @@ -213,7 +232,10 @@ r "ranger" rg "printf '\033c' && rg" rx "redshift -x" sn "sudo nvim" -sw "swex" +# sw "swex" +t "tmux" +ta "tmux a" +tls "tmux ls" vmd "vimdiff" wg "wego" wp "grep wallpaper ~/.cache/wal/colors.sh" @@ -281,7 +303,9 @@ gmg "git merge" gmgt "git mergetool" gr "git remote -v" -gro "git remote show origin" +gra "git remote add origin" +grr "git remote remove origin" +grs "git remote show origin" # ]]] branch # @@ -413,8 +437,6 @@ ureq "pip freeze > requirements.txt" hlg "tail -n 5 $spv_dir/src/api/management/commands/update-history.log" # scan history # hs "$spv_dir/src/update-history.sh && cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1" -# scan cron log for hs cmd -crnl "grep \"({{ .chezmoi.group }}) CMD\" /var/log/syslog | tail -n 1 && hlg" # removes all but newest file # rmol "ls -t | tail -n +2 | xargs rm -- && l" @@ -471,7 +493,6 @@ ht "python3 -m http.server" h "hugo" he "hugo serve -D --disableFastRender" -ss "ssh {{ .chezmoi.group }}@192.168.0.100" ssb "ssh-bandit" rt "python ~/coding/rt-scraper/!rt-scraper.py" diff --git a/key_dirs.tmpl b/key_dirs.tmpl index 126a269..f04c429 100755 --- a/key_dirs.tmpl +++ b/key_dirs.tmpl @@ -3,7 +3,6 @@ # sys [[[ # bg ~/Pictures/Backgrounds -bu /run/media/{{ .chezmoi.group }}/backup-hd/{{ .chezmoi.fullHostname }}/tar cf ~/.config cff ~/.config/fish d ~/Downloads @@ -13,12 +12,10 @@ k ~/ lc ~/linux-config lf /mnt/linux-files lfv /mnt/linux-files/Videos -me /run/media/{{ .chezmoi.group }} o / p ~/.password-store P ~/Pictures std ~/st -sw ~/.local/share/nvim/swap/ tm /tmp # ]]] sys # @@ -29,7 +26,8 @@ cn ~/coding ib ~/linux-config/dot_config/i3blocks/scripts ra ~/linux-config/dot_config/ranger sr ~/linux-config/scripts -swa ~/.local/share/nvim/swap +snp ~/.vim/plugged/vim-snippets/UltiSnips +sw ~/.local/share/nvim/swap/ tx ~/linux-config/txt wd ~/.config/watson @@ -44,7 +42,6 @@ mmd ~/coding/move-mouse-with-head ms ~/coding/mf-site mh ~/coding/mf-site/layouts # mg ~/coding/best-mf-site-personal -snp ~/.vim/plugged/vim-snippets/UltiSnips sv ~/coding/spotify-lib-vis/src svg ~/coding/spotify-lib-vis/src/graphs/static/graphs/scripts swd ~/coding/swex diff --git a/key_files.tmpl b/key_files.tmpl index ecd88a0..46b7730 100755 --- a/key_files.tmpl +++ b/key_files.tmpl @@ -58,7 +58,6 @@ wt ~/.config/watson/state.tmp 0f ~/school/309-proj/public/js/food.js 0s ~/school/309-proj/server.js 0t ~/school/309-proj/public/js/stores.js -0k ~/school/309-proj/json/{{ .chezmoi.group }}.md # ]]] 309 # diff --git a/txt/exclude-dirs-backup-full.txt b/txt/exclude-dirs-backup-full.txt old mode 100755 new mode 100644 diff --git a/txt/exclude-dirs-backup.txt.tmpl b/txt/exclude-dirs-backup.txt.tmpl old mode 100755 new mode 100644 diff --git a/txt/gtk-themes.txt b/txt/gtk-themes.txt old mode 100755 new mode 100644 diff --git a/txt/nzxt-aur.txt b/txt/nzxt-aur.txt old mode 100755 new mode 100644 diff --git a/txt/nzxt-pkgs.txt b/txt/nzxt-pkgs.txt old mode 100755 new mode 100644 diff --git a/txt/termux-pkgs.txt b/txt/termux-pkgs.txt new file mode 100644 index 0000000..03b3a1b --- /dev/null +++ b/txt/termux-pkgs.txt @@ -0,0 +1,95 @@ +Listing... +apt +bash +bat +bc +binutils +busybox +ca-certificates +clang +cmake +command-not-found +coreutils +curl +dash +diffutils +dpkg +fd +file +findutils +fish +flex +game-repo +gdbm +git +gnupg +gpgv +htop +jsoncpp +krb5 +ldns +less +libandroid-glob +libandroid-support +libarchive +libassuan +libbz2 +libc++ +libcrypt +libcrypt-dev +libcurl +libdb +libedit +libevent +libexpat +libffi +libgcrypt +libgpg-error +libiconv +libksba +libllvm +liblua +liblzma +libmsgpack +libnghttp2 +libnpth +libsqlite +libtermkey +libunibilium +libunistring +libuuid +libuv +libvterm +libxml2 +m4 +make +man +ncurses +ncurses-ui-libs +ncurses-utils +ndk-sysroot +neofetch +neovim +openssh +openssl +pcre2 +pinentry +python +python-dev +ranger +readline +rhash +ripgrep +science-repo +termux-am +termux-auth +termux-exec +termux-keyring +termux-licenses +termux-tools +tmux +util-linux +vim-python +vim-runtime +wget +zlib diff --git a/txt/tex-build-files.txt b/txt/tex-build-files.txt old mode 100755 new mode 100644 diff --git a/txt/todo.md b/txt/todo.md old mode 100755 new mode 100644 diff --git a/txt/usbs.md b/txt/usbs.md old mode 100755 new mode 100644 diff --git a/txt/x1-carbon-aur.txt b/txt/x1-carbon-aur.txt old mode 100755 new mode 100644 diff --git a/txt/x1-carbon-pkgs.txt b/txt/x1-carbon-pkgs.txt old mode 100755 new mode 100644