From b09c6c6f90cdf2c2e0fca08f48e8178e5e8d00fa Mon Sep 17 00:00:00 2001 From: Noah Masur Date: Fri, 31 Jul 2020 20:44:02 -0400 Subject: [PATCH] misc vim and fish --- fish.configlink/fish_variables | 3 ++ fish.configlink/functions/aliases.fish | 5 +++ fish.configlink/functions/mactools.fish | 12 +++++ fish.configlink/functions/notes.fish | 6 ++- homebrew/Brewfile | 6 ++- nvim.configlink/init.vim | 60 +++++++++++++++++++++++-- python/boto/requirements.txt | 8 ++++ 7 files changed, 94 insertions(+), 6 deletions(-) diff --git a/fish.configlink/fish_variables b/fish.configlink/fish_variables index 929263a..16153a3 100644 --- a/fish.configlink/fish_variables +++ b/fish.configlink/fish_variables @@ -26,13 +26,16 @@ SETUVAR _fish_abbr_gs:git\x20status SETUVAR _fish_abbr_gu:git\x20pull SETUVAR _fish_abbr_h:http\x20\x2dFh\x20\x2d\x2dall SETUVAR _fish_abbr_hosts:sudo\x20vim\x20/etc/hosts +SETUVAR _fish_abbr_k:kubectl SETUVAR _fish_abbr_l:ls SETUVAR _fish_abbr_la:ls\x20\x2dalhF SETUVAR _fish_abbr_lh:ls\x20\x2dlh SETUVAR _fish_abbr_ll:ls\x20\x2dalhF SETUVAR _fish_abbr_misty:cd\x20\x24PROJ/misty +SETUVAR _fish_abbr_nodes:kubectl\x20get\x20nodes SETUVAR _fish_abbr_oldcat:cat SETUVAR _fish_abbr_p:python +SETUVAR _fish_abbr_pods:kubectl\x20get\x20pods\x20\x2dA SETUVAR _fish_abbr_public_2D_key:ssh\x2dkeygen\x20\x2dy\x20\x2df\x20\x7e/\x2essh/id_rsa\x20\x3e\x20\x7e/\x2essh/id_rsa\x2epub SETUVAR _fish_abbr_py:python SETUVAR _fish_abbr_runbootstrap:\x24DOTS/scripts/bootstrap diff --git a/fish.configlink/functions/aliases.fish b/fish.configlink/functions/aliases.fish index bf6212f..ca5b229 100644 --- a/fish.configlink/functions/aliases.fish +++ b/fish.configlink/functions/aliases.fish @@ -63,6 +63,11 @@ function aliases --description 'All aliases' # Terraform abbr -a te 'terraform' + # Kubernetes + abbr -a k 'kubectl' + abbr -a pods 'kubectl get pods -A' + abbr -a nodes 'kubectl get nodes' + # Python abbr py 'python' alias domisty='cd $PROJ/misty && ./buildrun.sh' diff --git a/fish.configlink/functions/mactools.fish b/fish.configlink/functions/mactools.fish index 9510891..bb2d315 100644 --- a/fish.configlink/functions/mactools.fish +++ b/fish.configlink/functions/mactools.fish @@ -1,7 +1,19 @@ #!/usr/local/bin/fish function mactools + function copy --description 'Copy file contents into clipboard' cat $argv | pbcopy end + + function brewsearch --description "Install brew plugins" + set -l inst (brew search | eval "fzf $FZF_DEFAULT_OPTS -m --header='[brew:install]'") + + if not test (count $inst) = 0 + for prog in $inst + brew install "$prog" + end + end + end + end diff --git a/fish.configlink/functions/notes.fish b/fish.configlink/functions/notes.fish index 1392233..5219c57 100644 --- a/fish.configlink/functions/notes.fish +++ b/fish.configlink/functions/notes.fish @@ -10,7 +10,8 @@ function notes --description "Notes functions" else set yesterday (date -jv "-1d" +"%Y-%m-%d_%a") set tomorrow (date -jv "+1d" +"%Y-%m-%d_%a") - printf "[[journal/$yesterday|Previous]] - [[calendar|Index]] - [[journal/$tomorrow|Next]]\n\n---\n\n # Tasks\n\n\n# Log\n\n\n# Communication\n\n---\n\n# Meetings\n\n" > $today_journal + set weather (curl "https://wttr.in/?format=1") + printf "[[journal/$yesterday|Previous]] - [[calendar|Index]] - [[journal/$tomorrow|Next]]\n\n---\n\n$weather\n\n # Tasks\n\n\n# Log\n\n\n# Communication\n\n---\n\n# Meetings\n\n" > $today_journal echo "New journal added." end end @@ -23,7 +24,8 @@ function notes --description "Notes functions" else set yesterday (date -jv "-1d" +"%Y-%m-%d_%a") set tomorrow (date -jv "+1d" +"%Y-%m-%d_%a") - printf "[[journal/$yesterday|Previous]] - [[calendar|Index]] - [[journal/$tomorrow|Next]]\n\n---\n\n # Tasks\n\n\n# Log\n\n\n# Communication\n\n---\n\n# Meetings\n\n" > $today_journal + set weather (curl "https://wttr.in/?format=1") + printf "[[journal/$yesterday|Previous]] - [[calendar|Index]] - [[journal/$tomorrow|Next]]\n\n---\n\n$weather\n\n # Tasks\n\n\n# Log\n\n\n# Communication\n\n---\n\n# Meetings\n\n" > $today_journal echo "New journal added." vim $today_journal end diff --git a/homebrew/Brewfile b/homebrew/Brewfile index 2ff714a..d207b6b 100644 --- a/homebrew/Brewfile +++ b/homebrew/Brewfile @@ -9,7 +9,7 @@ brew "tmux" brew "autojump" # Shell Completion -brew "tldr" +brew "tealdeer" brew "zsh-syntax-highlighting" brew "zsh-autosuggestions" @@ -59,6 +59,10 @@ tap "nmasur/repo" brew "nmasur/repo/drips" brew "nmasur/repo/update-ssh-config" +# Try them out +tap "cjbassi/ytop" +brew "cjbassi/ytop/ytop" + # Not Installed # git -- already installed # hub -- github commands diff --git a/nvim.configlink/init.vim b/nvim.configlink/init.vim index d3b9e90..b8efaef 100644 --- a/nvim.configlink/init.vim +++ b/nvim.configlink/init.vim @@ -10,7 +10,13 @@ Plug 'Raimondi/delimitMate' " Auto-close parentheses Plug 'tpope/vim-commentary' " Use gc or gcc to comment Plug 'hashivim/vim-terraform' " Terraform HCL syntax Plug 'vimwiki/vimwiki' " Wiki System -Plug 'jreybert/vimagit' " Git GUI +Plug 'jreybert/vimagit' " Git 'gui' buffer +Plug 'airblade/vim-gitgutter' " Git next to line numbers +Plug 'tpope/vim-fugitive' " Other git commands +Plug 'machakann/vim-highlightedyank' " Highlight text when copied +Plug 'itchyny/lightline.vim' " Status bar +Plug 'shinchu/lightline-gruvbox.vim' " Colors for status bar +Plug 'tpope/vim-vinegar' " Fixes netrw file explorer call plug#end() @@ -29,7 +35,6 @@ set softtabstop=4 " Amount to shift with TAB key set ignorecase " Ignore case when searching set smartcase " Check case when using capitals in search set incsearch " Search while typing -set pastetoggle= set visualbell " No sounds set scrolljump=1 " Scroll more than one line (or 1 line) set scrolloff=3 " Margin of lines when scrolling @@ -66,7 +71,7 @@ endif map " Jump to text in this directory -nnoremap t :Rg +nnoremap / :Rg " Open file in this directory nnoremap f :Files @@ -77,6 +82,21 @@ nnoremap b :Buffers " Jump to text in this file nnoremap s :BLines +" Start Magit buffer +nnoremap g :Magit + +" Toggle Git gutter (by line numbers) +nnoremap ` :GitGutterToggle + +" Git push +nnoremap p :Git push + +" Close all other splits +nnoremap m :only + +" Open file tree +nnoremap t :Vexplore + " Mouse interaction / scrolling set mouse=nv @@ -84,6 +104,21 @@ set mouse=nv let &titlestring = @% set title +" Make whitespace pretty +" if &listchars ==# 'eol:$' +" set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ +" endif + +" Built-in explorer plugin +let g:netrw_liststyle = 3 " Change style to 'tree' view +let g:netrw_banner = 0 " Remove useless banner +let g:netrw_winsize = 15 " Explore window takes % of page +let g:netrw_browse_split = 4 " Open in previous window +let g:netrw_altv = 1 " idk + +" Gitgutter plugin +let g:gitgutter_enabled = 0 " Disable on start + " Terraform Plugin let g:terraform_fmt_on_save=1 @@ -91,3 +126,22 @@ let g:terraform_fmt_on_save=1 let g:vimwiki_list = [{'path': '~/Documents/notes/', \ 'syntax': 'markdown', 'ext': '.md'}] +function! GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('+%d ~%d -%d', a, m, r) +endfunction + +let g:lightline = { + \ 'colorscheme': 'jellybeans', + \ 'active': { + \ 'right': [[ 'lineinfo' ]], + \ 'left': [[ 'mode', 'paste' ], + \ [ 'readonly', 'relativepath', 'gitbranch', 'modified' ]] + \ }, + \ 'component_function': { + \ 'gitbranch': 'fugitive#head' + \ } + \ } +" let g:lightline.colorscheme = 'gruvbox' + +" set statusline+=%{GitStatus()} diff --git a/python/boto/requirements.txt b/python/boto/requirements.txt index e69de29..803901c 100644 --- a/python/boto/requirements.txt +++ b/python/boto/requirements.txt @@ -0,0 +1,8 @@ +boto3==1.10.49 +botocore==1.13.49 +docutils==0.15.2 +jmespath==0.9.4 +python-dateutil==2.8.1 +s3transfer==0.2.1 +six==1.13.0 +urllib3==1.25.7