diff --git a/.git_template/hooks/prepare-commit-msg b/.git_template/hooks/prepare-commit-msg new file mode 100755 index 0000000..495f2a6 --- /dev/null +++ b/.git_template/hooks/prepare-commit-msg @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +target_file="$1" + +commit_type="$2" + +if [ ! -z "$commit_type" ]; then + # re-use existing commit message + exit 0 +fi + + +existing_content=$(cat $target_file) + +branch_type=$(git current | cut -d '/' -f1) + +cat > $target_file < { + it('$2', () => { + expect(1).toBe(0) + }) +}) +endsnippet + +snippet it +it('$1', () => { + expect(1).toBe(0) +}) +endsnippet diff --git a/nvim/UltiSnips/typescriptreact.snippets b/nvim/UltiSnips/typescriptreact.snippets new file mode 100644 index 0000000..6efcb36 --- /dev/null +++ b/nvim/UltiSnips/typescriptreact.snippets @@ -0,0 +1,17 @@ +extends typescript + +snippet c +`!p fn = snip.basename +proptype = f"{fn}Props" +snip.rv = "\n".join([ +f"interface {proptype} {{", +" todo: null", +"}", +"", +f"const {fn} = ({{todo}}: {proptype}) => {{", +" return <>TODO: {todo}", +"}", +"", +f"export default {fn}", +])` +endsnippet diff --git a/nvim/init.vim b/nvim/init.vim index 6c5019c..33c14f4 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -19,13 +19,13 @@ endif " ALE adjustments let g:ale_fix_on_save = 1 let g:ale_fixers = { -\ 'python': ['isort', 'black', 'autoflake'], -\ 'javascript': ['prettier'], -\ 'javascriptreact': ['prettier'], +\ 'python': ['black', 'ruff'], +\ 'javascript': ['prettier', 'eslint'], +\ 'javascriptreact': ['prettier', 'eslint'], \ 'json': ['prettier'], \ 'css': ['prettier'], -\ 'typescript': ['prettier'], -\ 'typescriptreact': ['prettier'], +\ 'typescript': ['prettier', 'eslint'], +\ 'typescriptreact': ['prettier', 'eslint'], \ 'elixir': ['mix_format'], \ 'terraform': ['terraform'], \} @@ -77,6 +77,9 @@ nnoremap gb :Git blame " MaxMEllon/vim-jsx-pretty installed via vim-polyglot let g:vim_jsx_pretty_highlight_close_tag = 1 +" https://github.com/wuelnerdotexe/vim-astro#configuration +let g:astro_typescript = 'enable' + let g:user_emmet_expandabbr_key='' colorscheme molokai @@ -90,7 +93,16 @@ let g:highlightedyank_highlight_duration = 350 " fzf.vim shortcuts " nnoremap f :GFiles " nnoremap b :Buffers -nnoremap u :Ag \b +nnoremap u :Rg \b +" muscle memory: clobber Ag to use Rg instead +cabbrev Ag Rg +" and deal with casing issues +cabbrev ag Rg +nnoremap t :Tags + +nnoremap a :A +nnoremap s :Estory + " navigate smoothly from terminal mode/between windows " via https://thoughtbot.com/upcase/videos/neovim-creating-mappings-for-terminal diff --git a/nvim/lua/fred.lua b/nvim/lua/fred.lua index 7ea381b..b446711 100644 --- a/nvim/lua/fred.lua +++ b/nvim/lua/fred.lua @@ -2,6 +2,7 @@ modules = { "./plugins", "./lsp", "./searching", + "./snippets", } function _G.reload_fred_config() diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index f23a4fb..37b4d8e 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -38,7 +38,8 @@ return require('packer').startup( use 'tpope/vim-repeat' -- linting and fixing - use 'dense-analysis/ale' + -- use 'dense-analysis/ale' + use '~/dev/ale' -- syntax highlighting: JSX, Jenkinsfile and more @@ -47,6 +48,9 @@ return require('packer').startup( -- syntax highlighting: Hashicorp Sentinel use 'hashicorp/sentinel.vim' + -- syntax highlight: astro + use 'wuelnerdotexe/vim-astro' + -- colour scheme use 'tomasr/molokai' diff --git a/nvim/lua/snippets.lua b/nvim/lua/snippets.lua new file mode 100644 index 0000000..1b9ff67 --- /dev/null +++ b/nvim/lua/snippets.lua @@ -0,0 +1,3 @@ +vim.g.UltiSnipsExpandTrigger='' + +vim.keymap.set('n', 's', 'UltiSnipsEdit') diff --git a/scripts/brew-leaves b/scripts/brew-leaves new file mode 100755 index 0000000..246f176 --- /dev/null +++ b/scripts/brew-leaves @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +# misc formulae to install +# to calculate:: +# +# brew leaves + +brew install \ + bats-core \ + exercism \ + # gawk \ + # lolcat \ + # luajit-openresty \ + # neovim \ + pipx \ + # ripgrep \ + # tmate \ + tree diff --git a/scripts/gnome-extensions b/scripts/gnome-extensions index 9167e76..ad5a711 100755 --- a/scripts/gnome-extensions +++ b/scripts/gnome-extensions @@ -1,5 +1,6 @@ #!/usr/bin/env sh # sudo apt install chrome-gnome-shell +sudo apt install gnome-shell-extension-manager mkdir -p downloads curl https://extensions.gnome.org/extension-data/caffeinepatapon.info.v37.shell-extension.zip > downloads/caffeine.zip diff --git a/scripts/install b/scripts/install index a186e12..24362c5 100755 --- a/scripts/install +++ b/scripts/install @@ -19,4 +19,10 @@ scripts/cloc scripts/neovim scripts/python scripts/nodejs +scripts/rust +scripts/tauri scripts/terraform +scripts/ruby +scripts/organize +scripts/pgadmin4 +scripts/brew-leaves diff --git a/scripts/organize b/scripts/organize new file mode 100755 index 0000000..739c589 --- /dev/null +++ b/scripts/organize @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +# https://github.com/tfeldmann/organize +pip install "organize-tool" diff --git a/scripts/pgadmin4 b/scripts/pgadmin4 new file mode 100755 index 0000000..24769d6 --- /dev/null +++ b/scripts/pgadmin4 @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# ref: https://www.pgadmin.org/download/pgadmin-4-apt/ + +# Install the public key for the repository (if not done previously): +curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg + +# Create the repository configuration file: +sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update' + +# Install for both desktop and web modes: +sudo apt install pgadmin4 diff --git a/scripts/ruby b/scripts/ruby new file mode 100755 index 0000000..0673528 --- /dev/null +++ b/scripts/ruby @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +# https://github.com/rbenv/ruby-build/wiki#ubuntudebianmint +sudo apt-get install autoconf bison patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev + +asdf plugin add ruby +asdf install ruby latest +asdf global ruby latest diff --git a/scripts/rust b/scripts/rust new file mode 100755 index 0000000..f734477 --- /dev/null +++ b/scripts/rust @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +asdf plugin add rust +asdf install rust latest +asdf global rust latest diff --git a/scripts/tauri b/scripts/tauri new file mode 100755 index 0000000..76d213f --- /dev/null +++ b/scripts/tauri @@ -0,0 +1,10 @@ +#!/usr/bin/env sh +# https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-linux +sudo apt install libwebkit2gtk-4.0-dev \ + build-essential \ + curl \ + wget \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev diff --git a/zshrc/.zshrc b/zshrc/.zshrc index 456449a..cdaa5d2 100644 --- a/zshrc/.zshrc +++ b/zshrc/.zshrc @@ -11,6 +11,10 @@ . $ZDOTDIR/brew . $ZDOTDIR/terraform +if [ -f $ZDOTDIR/local-overrides ]; then + . $ZDOTDIR/local-overrides +fi + # installed via fzf for vim # . ~/.fzf.zsh diff --git a/zshrc/docker-compose b/zshrc/docker-compose index 41239fc..315faa1 100644 --- a/zshrc/docker-compose +++ b/zshrc/docker-compose @@ -3,10 +3,10 @@ alias d="docker" # dc is already taken -alias dco="docker-compose" -alias dcof="docker-compose -f docker-compose.yml" +alias dco="docker compose" +alias dcof="docker compose -f docker-compose.yml" -alias dcu="docker-compose up" -alias dcr="docker-compose run --rm" -alias dcb="docker-compose build" -alias dcl="docker-compose logs --tail=1000 --follow" +alias dcu="docker compose up" +alias dcr="docker compose run --rm" +alias dcb="docker compose build" +alias dcl="docker compose logs --tail=1000 --follow" diff --git a/zshrc/local-overrides b/zshrc/local-overrides new file mode 100644 index 0000000..fb66498 --- /dev/null +++ b/zshrc/local-overrides @@ -0,0 +1,2 @@ +#!zsh +. ~/.zshrc diff --git a/zshrc/shell b/zshrc/shell index a2fb3b1..99fa4f8 100644 --- a/zshrc/shell +++ b/zshrc/shell @@ -15,7 +15,8 @@ set -o emacs bindkey -e function grepp() { - ag --group -A 2 --smart-case --pager="better-less" "$@" + # ag --group -A 2 --smart-case --pager="better-less" "$@" + rg -A 2 --smart-case "$@" } alias "?"=grepp diff --git a/zshrc/terraform b/zshrc/terraform index 4711258..159bddd 100644 --- a/zshrc/terraform +++ b/zshrc/terraform @@ -2,3 +2,5 @@ autoload -U +X bashcompinit && bashcompinit complete -o nospace -C $(asdf which terraform) terraform alias tf=terraform + +alias tspace=bundle exec terraspace