75 Commits

Author SHA1 Message Date
f493b263e0 fix: terraform highlights and formatting 2022-01-21 15:28:07 -05:00
e819c2a7b6 nvim updates 2022-01-13 18:23:12 -05:00
6a0a27714b autoformat hammerspoon and add calendar 2021-12-27 22:31:30 -07:00
b09a38201c add default dig command options 2021-12-27 22:29:57 -07:00
26ee43fe84 tmux synchronise shortcut 2021-12-27 22:29:42 -07:00
38ea7742a1 more newsboat highlights 2021-12-27 22:29:18 -07:00
d1269e8455 mpv youtube config 2021-12-27 22:28:38 -07:00
f314eb82b7 gca changes and flushdns 2021-12-27 22:27:54 -07:00
d913ad88d5 improve nb highlighting 2021-12-02 12:43:42 -05:00
39d21d23f4 rg opts deprecated 2021-12-01 08:08:58 -05:00
955c6b0aca attempt newsboat macos cronjob 2021-11-29 22:50:36 -05:00
f485a20e06 more newsboat macros 2021-11-29 22:50:18 -05:00
9914eae230 merge fish histories in open shells 2021-11-29 22:50:00 -05:00
4ea1235c9c remove lightspeed nvim plugin 2021-11-29 22:49:44 -05:00
f025413ad1 newsboat improvements 2021-11-25 14:40:15 -05:00
154fe2917b newsboat config 2021-11-24 17:25:52 -05:00
29cf53f5f6 add browser variable 2021-11-24 17:13:46 -05:00
a3ff05b40c remove silent from formatter 2021-11-24 17:12:46 -05:00
3a04b58574 format abbrs 2021-11-24 17:12:26 -05:00
21333baefd use poetry for python formatting 2021-11-24 09:28:12 -05:00
9e3244d8ea stylua formatting 2021-11-24 09:04:07 -05:00
f40dc276e2 null-ls formatting 2021-11-24 09:03:18 -05:00
93a74e5d22 remove trouble plugin 2021-11-24 08:33:21 -05:00
5ce2e5cbce clipboard and notes changes 2021-11-24 08:25:39 -05:00
3b223a88ca switch from outlook to mail 2021-11-24 08:24:21 -05:00
bd2433c869 autochdir back for wiki 2021-11-17 23:04:23 -05:00
216d325d5c telescope improvements 2021-11-17 23:03:51 -05:00
59c65bfa53 journal vim headers 2021-11-17 23:02:29 -05:00
beeebb178e handle repos with commas in descriptions 2021-11-17 12:35:28 -05:00
dd07f97122 add logitech g-hub 2021-11-17 08:43:23 -05:00
4d8de6b3bc vim: search and sub on selected 2021-11-17 08:35:53 -05:00
b486085580 find uncommitted git repos 2021-11-16 07:49:59 -05:00
afefa06229 add fish syntax back to vim 2021-11-16 07:49:47 -05:00
bc31e9d7df fcd auto execute 2021-11-16 07:49:29 -05:00
13a4cac980 use fish for repos downloading 2021-11-16 07:49:01 -05:00
b9747c4e6f fish keybind updates 2021-11-15 11:17:34 -05:00
06a455fcf4 glow markdown previews 2021-11-15 11:17:17 -05:00
7a9e9b75c0 option to clear weather cache 2021-11-14 20:50:45 -05:00
007ed17e71 use clipboard for neoclip 2021-11-14 20:42:09 -05:00
6453e6788e github clone repo with fzf 2021-11-14 20:33:31 -05:00
37647acbeb npm lsp installer script 2021-11-14 20:33:08 -05:00
1f1769be70 nvim harpoon 2021-11-14 20:32:44 -05:00
b4dc2f0d18 make it easier to git add fuzzy 2021-11-14 20:32:29 -05:00
4a8f41a151 luasnip jumping 2021-11-14 20:32:02 -05:00
e58763a168 icloud notes directory 2021-11-14 20:31:31 -05:00
16e4165d14 remove poetry from bootstrapping 2021-11-14 20:30:27 -05:00
f51f0c0e3d lightspeed nvim navigation 2021-11-13 16:55:58 -05:00
096aa594a8 security update 2021-11-13 16:55:20 -05:00
3a244110eb ripgrep completion 2021-11-13 16:50:28 -05:00
5f794c626b nvim keymap boilerplate function 2021-11-13 16:29:09 -05:00
1c95039847 new macbook requirements 2021-11-13 16:28:31 -05:00
c69fa02713 nvim plugin settings inside packer 2021-11-13 16:28:31 -05:00
81815ed551 telescope keymap hints 2021-11-13 16:28:31 -05:00
8012fa7051 Merge pull request #3 from nmasur/dependabot/pip/python/requests/urllib3-1.26.5
Bump urllib3 from 1.26.2 to 1.26.5 in /python/requests
2021-11-09 15:18:49 -05:00
609bfb8132 Bump urllib3 from 1.26.2 to 1.26.5 in /python/requests
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.2 to 1.26.5.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.2...1.26.5)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-09 04:49:18 +00:00
c71ffe0ea2 Merge branch 'experimental' 2021-11-08 23:48:45 -05:00
aadeffecde telescope fish abbrs 2021-11-08 23:48:02 -05:00
cbb64f61fc packer compile after installing 2021-11-07 23:24:25 -05:00
170a2a24de nvim: cmp and telescope 2021-11-07 23:11:17 -05:00
f92b7cf891 url decoder 2021-10-22 07:34:27 -04:00
a1962afef0 gpp execute after cli 2021-10-21 11:21:31 -04:00
b9e248be32 Revert "evaluate gpp upstream on cli"
This reverts commit e4b6c3c9ba.
2021-10-21 11:17:51 -04:00
e4b6c3c9ba evaluate gpp upstream on cli 2021-10-06 17:28:19 -04:00
249cbe5889 puppet syntax for nvim 2021-09-28 09:16:03 -04:00
1f9fdac268 gh auto pull after merge 2021-09-28 09:15:48 -04:00
2705e636b9 more abbreviations 2021-09-16 14:57:49 -04:00
43cbd18caf hammerspoon updates 2021-08-30 15:36:04 -06:00
ba75ec2366 more fish stuff 2021-08-26 10:44:38 -06:00
bb00648208 vimrc tweaks 2021-08-04 11:39:27 -04:00
cf1e39a3b8 silence direnv output 2021-07-13 11:54:30 -04:00
06a2c5eb3d Merge branch 'experimental' 2021-07-08 09:17:17 -04:00
03889db9f8 Merge branch 'nix' into experimental 2021-07-08 09:14:35 -04:00
3a27c37f3e direnv and neovim updates 2021-07-06 22:19:20 -04:00
0989a15b5d Merge pull request #2 from nmasur/dependabot/pip/bin/connect_aws/urllib3-1.26.5
Bump urllib3 from 1.25.8 to 1.26.5 in /bin/connect_aws
2021-06-01 22:03:48 -04:00
bf180db95e Bump urllib3 from 1.25.8 to 1.26.5 in /bin/connect_aws
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.25.8 to 1.26.5.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.25.8...1.26.5)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-02 02:02:02 +00:00
44 changed files with 1161 additions and 574 deletions

3
.gitignore vendored
View File

@ -1,4 +1,6 @@
.DS_Store
newsboat.configlink/history.search
newsboat.configlink/urls
nvim.configlink/dirs/*
nvim.configlink/.netrwhist
nvim.configlink/plugin/**
@ -9,3 +11,4 @@ fish.configlink/functions/vim.fish
fish_variables
homebrew/*.lock.json
*.bak
*.db

View File

@ -99,7 +99,8 @@ font:
# - (Windows) Consolas
#family: Fira Code
#family: Noto Sans Mono
family: Fira Mono for Powerline
# family: Fira Mono for Powerline
family: FiraMono Nerd Font
# The `style` can be specified to pick a specific face.
#style: Regular
@ -138,7 +139,7 @@ font:
#style: Bold Italic
# Point size
size: 18.0
size: 17.0
# Offset is the extra space around each character. `offset.y` can be thought of
# as modifying the line spacing, and `offset.x` as modifying the letter spacing.

15
bin/bookmark Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
URL=$1
TITLE=$2
DESCRIPTION=$3
FEED=$4
printf "\n\n## [%s](%s)\n%s\nFrom %s: added on [%s](%s.md).\n\n---\n" \
"$TITLE" \
"$URL" \
"$DESCRIPTION" \
"$FEED" \
"$TODAY_NOTE" \
"$TODAY_NOTE" \
>>"$NOTES_PATH/bookmarks.md"

View File

@ -5,4 +5,4 @@ jmespath==0.9.4
python-dateutil==2.8.0
s3transfer==0.2.1
six==1.12.0
urllib3==1.25.8
urllib3==1.26.5

37
bin/gh-repos Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
case $1 in
t2) organization="take-two" ;;
d2c) organization="take-two-t2gp" ;;
t2gp) organization="take-two-t2gp" ;;
pd) organization="private-division" ;;
dots) organization="playdots" ;;
*) organization="nmasur" ;;
esac
selected=$(gh repo list "$organization" \
--limit 50 \
--no-archived \
--json=name,description,isPrivate,updatedAt,primaryLanguage \
| jq -r '.[] | .name + "," + if .description == "" then "-" else .description |= gsub(","; " ") | .description end + "," + .updatedAt + "," + .primaryLanguage.name' \
| (echo "REPO,DESCRIPTION,UPDATED,LANGUAGE"; cat -) \
| column -s , -t \
| fzf \
--header-lines=1 \
--layout=reverse \
--bind "ctrl-o:execute:gh repo view -w ${organization}/{1}" \
--bind "shift-up:preview-half-page-up" \
--bind "shift-down:preview-half-page-down" \
--preview "GH_FORCE_TTY=49% gh repo view ${organization}/{1} | glow -" \
--preview-window up
)
[ -n "${selected}" ] && {
directory="$HOME/dev/work"
if [ $organization = "nmasur" ]; then directory="$HOME/dev/personal"; fi
repo=$(echo "${selected}" | awk '{print $1}')
repo_full="${organization}/${repo}"
if [ ! -d "${directory}/${repo}" ]; then
gh repo clone "$repo_full" "${directory}/${repo}"
fi
echo "${directory}/${repo}"
}

View File

@ -1,12 +0,0 @@
#!/bin/sh
# Copied from David Pedersen: https://github.com/davidpdrsn/dotfiles/blob/master/bin/git-pp
set -e
git_branch_name() {
val=$( git branch 2>/dev/null | grep '^\*' | colrm 1 2 )
echo "$val"
}
git push --set-upstream origin "$(git_branch_name)"

5
bin/url-decode Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
urldecode "$@"

View File

@ -1,7 +1,12 @@
#!/bin/sh
CACHE_FILE="$HOME/.tmux/.weather_cache"
CACHE_TIME="$(stat -f %m "$CACHE_FILE")"
CACHE_FILE="$HOME/.cache/weather_cache"
if [ "$1" = "clear" ]; then
rm -f "$CACHE_FILE"
fi
CACHE_TIME="$(stat -f %m "$CACHE_FILE" 2>/dev/null)"
NOW_TIME=$(date +%s)
TIME_PASSED=$((NOW_TIME-CACHE_TIME))
if [ "$TIME_PASSED" -gt "1200" ]

1
digrc.symlink Normal file
View File

@ -0,0 +1 @@
+noall +answer

View File

@ -1,138 +0,0 @@
# Setup Nix
# We need to distinguish between single-user and multi-user installs.
# This is difficult because there's no official way to do this.
# We could look for the presence of /nix/var/nix/daemon-socket/socket but this will fail if the
# daemon hasn't started yet. /nix/var/nix/daemon-socket will exist if the daemon has ever run, but
# I don't think there's any protection against accidentally running `nix-daemon` as a user.
# We also can't just look for /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh because
# older single-user installs used the default profile instead of a per-user profile.
# We can still check for it first, because all multi-user installs should have it, and so if it's
# not present that's a pretty big indicator that this is a single-user install. If it does exist,
# we still need to verify the install type. To that end we'll look for a root owner and sticky bit
# on /nix/store. Multi-user installs set both, single-user installs don't. It's certainly possible
# someone could do a single-user install as root and then manually set the sticky bit but that
# would be extremely unusual.
set -l nix_profile_path /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
set -l single_user_profile_path ~/.nix-profile/etc/profile.d/nix.sh
if test -e $nix_profile_path
# The path exists. Double-check that this is a multi-user install.
# We can't just check for ~/.nix-profile/… because this may be a single-user install running as
# the wrong user.
# stat is not portable. Splitting the output of ls -nd is reliable on most platforms.
set -l owner (string split -n ' ' (ls -nd /nix/store 2>/dev/null))[3]
if not test -k /nix/store -a $owner -eq 0
# /nix/store is either not owned by root or not sticky. Assume single-user.
set nix_profile_path $single_user_profile_path
end
else
# The path doesn't exist. Assume single-user
set nix_profile_path $single_user_profile_path
end
if test -e $nix_profile_path
# Source the nix setup script
# We're going to run the regular Nix profile under bash and then print out a few variables
for line in (env -u BASH_ENV bash -c '. "$0"; for name in PATH "${!NIX_@}"; do printf "%s=%s\0" "$name" "${!name}"; done' $nix_profile_path | string split0)
set -xg (string split -m 1 = $line)
end
# Insert Nix's fish share directories into fish's special variables.
# nixpkgs-installed fish tries to set these up already if NIX_PROFILES is defined, which won't
# be the case when sourcing $__fish_data_dir/share/config.fish normally, but might be for a
# recursive invocation. To guard against that, we'll only insert paths that don't already exit.
# Furthermore, for the vendor_conf.d sourcing, we'll use the pre-existing presence of a path in
# $fish_function_path to determine whether we want to source the relevant vendor_conf.d folder.
# To start, let's locally define NIX_PROFILES if it doesn't already exist.
set -al NIX_PROFILES
if test (count $NIX_PROFILES) -eq 0
set -a NIX_PROFILES $HOME/.nix-profile
end
# Replicate the logic from nixpkgs version of $__fish_data_dir/__fish_build_paths.fish.
set -l __nix_profile_paths (string split ' ' -- $NIX_PROFILES)[-1..1]
set -l __extra_completionsdir \
$__nix_profile_paths/etc/fish/completions \
$__nix_profile_paths/share/fish/vendor_completions.d
set -l __extra_functionsdir \
$__nix_profile_paths/etc/fish/functions \
$__nix_profile_paths/share/fish/vendor_functions.d
set -l __extra_confdir \
$__nix_profile_paths/etc/fish/conf.d \
$__nix_profile_paths/share/fish/vendor_conf.d \
### Configure fish_function_path ###
# Remove any of our extra paths that may already exist.
# Record the equivalent __extra_confdir path for any function path that exists.
set -l existing_conf_paths
for path in $__extra_functionsdir
if set -l idx (contains --index -- $path $fish_function_path)
set -e fish_function_path[$idx]
set -a existing_conf_paths $__extra_confdir[(contains --index -- $path $__extra_functionsdir)]
end
end
# Insert the paths before $__fish_data_dir.
if set -l idx (contains --index -- $__fish_data_dir/functions $fish_function_path)
# Fish has no way to simply insert into the middle of an array.
set -l new_path $fish_function_path[1..$idx]
set -e new_path[$idx]
set -a new_path $__extra_functionsdir
set fish_function_path $new_path $fish_function_path[$idx..-1]
else
set -a fish_function_path $__extra_functionsdir
end
### Configure fish_complete_path ###
# Remove any of our extra paths that may already exist.
for path in $__extra_completionsdir
if set -l idx (contains --index -- $path $fish_complete_path)
set -e fish_complete_path[$idx]
end
end
# Insert the paths before $__fish_data_dir.
if set -l idx (contains --index -- $__fish_data_dir/completions $fish_complete_path)
set -l new_path $fish_complete_path[1..$idx]
set -e new_path[$idx]
set -a new_path $__extra_completionsdir
set fish_complete_path $new_path $fish_complete_path[$idx..-1]
else
set -a fish_complete_path $__extra_completionsdir
end
### Source conf directories ###
# The built-in directories were already sourced during shell initialization.
# Any __extra_confdir that came from $__fish_data_dir/__fish_build_paths.fish was also sourced.
# As explained above, we're using the presence of pre-existing paths in $fish_function_path as a
# signal that the corresponding conf dir has also already been sourced.
# In order to simulate this, we'll run through the same algorithm as found in
# $__fish_data_dir/config.fish except we'll avoid sourcing the file if it comes from an
# already-sourced location.
# Caveats:
# * Files will be sourced in a different order than we'd ideally do (because we're coming in
# after the fact to source them).
# * If there are existing extra conf paths, files in them may have been sourced that should have
# been suppressed by paths we're inserting in front.
# * Similarly any files in $__fish_data_dir/vendor_conf.d that should have been suppressed won't
# have been.
set -l sourcelist
for file in $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish
# We know these paths were sourced already. Just record them.
set -l basename (string replace -r '^.*/' '' -- $file)
contains -- $basename $sourcelist
or set -a sourcelist $basename
end
for root in $__extra_confdir
for file in $root/*.fish
set -l basename (string replace -r '^.*/' '' -- $file)
contains -- $basename $sourcelist
and continue
set -a sourcelist $basename
contains -- $root $existing_conf_paths
and continue # this is a pre-existing path, it will have been sourced already
[ -f $file -a -r $file ]
and source $file
end
end
end

View File

@ -38,4 +38,7 @@ if status --is-interactive
# Use `starship` prompt
starship init fish | source
# Hook into direnv
direnv hook fish | source
end

View File

@ -3,11 +3,11 @@
function abbrs --description 'All abbreviations'
# Directory aliases
abbr -a l 'ls'
abbr -a l ls
abbr -a lh 'ls -lh'
abbr -a ll 'ls -alhF'
abbr -a lf 'ls -lh | fzf'
abbr -a c 'cd'
abbr -a c cd
abbr -a -- - 'cd -'
abbr -a proj 'cd $PROJ'
abbr -a mkd 'mkdir -pv'
@ -18,7 +18,7 @@ function abbrs --description 'All abbreviations'
abbr -a tnn 'tmux new-session -s noah'
# Git
abbr -a g 'git'
abbr -a g git
abbr -a gs 'git status'
abbr -a gd 'git diff'
abbr -a gds 'git diff --staged'
@ -27,10 +27,10 @@ function abbrs --description 'All abbreviations'
abbr -a gaa 'git add -A'
abbr -a gac 'git commit -am'
abbr -a gc 'git commit -m'
abbr -a gca 'git commit --amend'
abbr -a gca 'git commit --amend --no-edit'
abbr -a gu 'git pull'
abbr -a gp 'git push'
abbr -a gpp 'git_set_upstream'
abbr -a gpp git-push-upstream
abbr -a gl 'git log --graph --decorate --oneline -20'
abbr -a gll 'git log --graph --decorate --oneline'
abbr -a gco 'git checkout'
@ -47,40 +47,46 @@ function abbrs --description 'All abbreviations'
# GitHub
abbr -a ghr 'gh repo view -w'
abbr -a gha 'gh run list | head -1 | awk \'{ print $NF }\' | xargs gh run view'
abbr -a grw 'gh run watch'
abbr -a gha 'gh run list | head -1 | awk \'{ print $(NF-2) }\' | xargs gh run view'
abbr -a grw 'noti gh run watch'
abbr -a grf 'gh run view --log-failed'
abbr -a grl 'gh run view --log'
abbr -a ghpr 'gh pr create && sleep 3 && noti gh run watch'
abbr -a ghm 'gh pr merge -s -d && git pull'
# Vim
if command -v nvim > /dev/null
if command -v nvim >/dev/null
alias --save vim='nvim'
abbr -a vimrc 'vim $HOME/.config/nvim/init.lua'
else
alias --save vim='vim'
abbr -a vimrc 'vim $HOME/.vimrc'
end
abbr -a v 'vim'
abbr -a v vim
abbr -a vl 'vim -c "normal! `0"'
abbr -a vll 'vim -c "Hist"'
abbr -a vll 'vim -c "Telescope oldfiles"'
abbr -a vh 'vim -c "Telescope oldfiles"'
# Notes
abbr -a qn 'quicknote'
abbr -a sn 'syncnotes'
abbr -a qn quicknote
abbr -a sn syncnotes
abbr -a to today
abbr -a work 'vim $NOTES_PATH/work.md'
# RSS
abbr -a nb newsboat
# Improved CLI Tools
abbr -a cat 'bat' # Swap cat with bat
abbr -a cat bat # Swap cat with bat
abbr -a h 'http -Fh --all' # Curl site for headers
abbr -a j just
# Fun CLI Tools
abbr goo 'googler'
abbr gooj 'googler -j'
abbr weather 'curl wttr.in/$WEATHER_CITY'
abbr moon 'curl wttr.in/Moon'
# Dotfile and config shortcuts
abbr -a s 'sudo'
abbr -a s sudo
abbr -a boot '$DOTS/scripts/bootstrap'
abbr -a sshc 'vim ~/.ssh/config'
abbr -a hosts 'sudo nvim /etc/hosts'
@ -89,11 +95,12 @@ function abbrs --description 'All abbreviations'
# Cheat Sheets
abbr -a ssl 'openssl req -new -newkey rsa:2048 -nodes' \
'-keyout server.key -out server.csr'
'-keyout server.key -out server.csr'
abbr -a fingerprint 'ssh-keyscan myhost.com | ssh-keygen -lf -'
abbr -a publickey 'ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub'
abbr -a forloop 'for i in (seq 1 100)'
abbr -a gatekeeper 'sudo spctl --master-disable'
abbr -a flushdns 'sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder'
# Docker
abbr -a dc '$DOTS/bin/docker_cleanup'
@ -105,37 +112,37 @@ function abbrs --description 'All abbreviations'
abbr -a alp 'docker run --rm -it -v $PWD:/project alpine sh'
# Terraform
abbr -a te 'terraform'
abbr -a te terraform
abbr -a tap 'terraform apply'
# Kubernetes
abbr -a k 'kubectl'
abbr -a k kubectl
abbr -a pods 'kubectl get pods -A'
abbr -a nodes 'kubectl get nodes'
abbr -a deploys 'kubectl get deployments -A'
abbr -a dash 'kube-dashboard'
abbr -a ks 'k9s'
abbr -a dash kube-dashboard
abbr -a ks k9s
# Cloud
abbr -a awsc 'vim ~/.aws/credentials'
# Python
abbr -a py 'python'
abbr -a po 'poetry'
abbr -a py python
abbr -a po poetry
abbr -a pr 'poetry run python'
abbr -a pl 'poetry run pylint *'
abbr -a black 'poetry run black --target-version py38 .'
abbr -a bl 'poetry run black --target-version py38 .'
# Rust
abbr -a ca 'cargo'
abbr -a ca cargo
# macOS
abbr -a casks 'vim $DOTS/homebrew/Caskfile'
abbr -a t 'trash'
abbr -a t trash
# Linux
if [ (uname) = "Linux" ]
if [ (uname) = Linux ]
linux
end

View File

@ -8,4 +8,5 @@ function fcd --description 'Jump to directory' -a 'directory'
end
set jump (fd -t d . $directory | fzf)
and cd $jump $argv;
and commandline -f execute;
end

View File

@ -2,8 +2,16 @@
function fish_user_key_bindings
bind -M insert \co 'edit'
bind -M default \co 'edit'
bind -M insert \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
bind -M default \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
bind -M insert \ce 'recent'
bind -M default \ce 'recent'
bind -M insert \cg 'commandline-git-commits'
bind -M insert \cf 'fcd'
bind -M default \cf 'fcd'
bind -M insert \cp 'prj'
bind -M default \cp 'prj'
bind -M insert \x1F accept-autosuggestion
bind -M default \x1F accept-autosuggestion
end

View File

@ -4,6 +4,7 @@ function git-add-fuzzy
--height 50% \
-m \
--preview-window right:70% \
--layout reverse \
--preview 'set -l IFS; set gd (git diff --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2)); if test "$gd"; echo "$gd"; else; bat --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2); end')
and for gf in $gitfile
set gf (echo $gf \

View File

@ -0,0 +1,6 @@
function git-push-upstream --description "Create upstream branch"
set -l branch (git branch 2>/dev/null | grep '^\*' | colrm 1 2)
set -l command "git push --set-upstream origin $branch"
commandline -r $command
commandline -f execute
end

View File

@ -1,4 +1,4 @@
function note-header
set -g CURRENT_WEATHER (curl -s "https://wttr.in/?format=1")
set -g JOURNAL_HEADER "[Yesterday]($YESTERDAY_NOTE.md) | [Home](home.md) | [Tomorrow]($TOMORROW_NOTE.md)\n\n$LONG_DATE\n$CURRENT_WEATHER\n#journal\n\n---\n\n"
set -g JOURNAL_HEADER "[Yesterday]($YESTERDAY_NOTE.md) | [Home](../home.md) | [Today](obsidian://advanced-uri?daily=true) | [Tomorrow]($TOMORROW_NOTE.md)\n\n$LONG_DATE\n$CURRENT_WEATHER\n#journal\n\n---\n\n"
end

View File

@ -1,4 +1,5 @@
function prj --description "cd to a project"
set projdir (ls $PROJ | fzf)
and cd $PROJ/$projdir
and commandline -f execute
end

View File

@ -0,0 +1,42 @@
#!/usr/local/bin/fish
function repos --description 'Clone GitHub repositories' -a 'organization'
set directory (gh-repos $organization)
and cd $directory
end
#switch $organization
# case t2; set organization "take-two"
# case d2c; set organization "take-two-t2gp"
# case t2gp; set organization "take-two-t2gp"
# case pd; set organization "private-division"
# case dots; set organization "playdots"
# case '*'; set organization "nmasur"
#end
#set selected (gh repo list "$organization" \
# --limit 50 \
# --no-archived \
# --json=name,description,isPrivate,updatedAt,primaryLanguage \
# | jq -r '.[] | .name + "," + if .description == "" then "-" else .description end + "," + .updatedAt + "," + .primaryLanguage.name' \
# | begin
# echo "REPO,DESCRIPTION,UPDATED,LANGUAGE"
# cat -
# end | column -s , -t
# | fzf \
# --header-lines=1 \
# --layout=reverse
#--bind "ctrl-o:execute:gh repo view -w $organization/{1}" \
#--preview "GH_FORCE_TTY=49% gh repo view $organization/{1} | glow -" \
#--preview-window up
#)
#if test -n (echo $selected | tr -d '\r')
# set directory "$HOME/dev/work"
# if test $organization = "nmasur"
# set directory "$HOME/dev/personal"
# end
# set repo (echo $selected | awk '{print $1}')
# set repo_full "$organization/$repo"
# gh repo clone "$repo_full" "$directory/$repo"
# cd "$directory/$repo"
#end
#end

View File

@ -0,0 +1,16 @@
#!/usr/local/bin/fish
function uncommitted --description "Find uncommitted git repos"
set current_dir (pwd)
cd $HOME/dev
find . -type d -name '.git' | \
while read dir
cd $dir/../
and if test -n (echo (git status -s))
pwd
git status -s
end
cd -
end
cd $current_dir
end

View File

@ -0,0 +1,29 @@
# by @farcaller from https://github.com/fish-shell/fish-shell/issues/825#issuecomment-440286038
function up-or-search -d "Depending on cursor position and current mode, either search backward or move up one line"
# If we are already in search mode, continue
if commandline --search-mode
commandline -f history-search-backward
return
end
# If we are navigating the pager, then up always navigates
if commandline --paging-mode
commandline -f up-line
return
end
# We are not already in search mode.
# If we are on the top line, start search mode,
# otherwise move up
set lineno (commandline -L)
switch $lineno
case 1
commandline -f history-search-backward
history merge # <-- ADDED THIS
case '*'
commandline -f up-line
end
end

View File

@ -39,15 +39,20 @@ function obj:init()
-- Control was not down but is now
if not self.lastModifiers['ctrl'] then
-- Only prepare to send escape if no other modifier keys are in use
self.lastModifiers = newModifiers
if (not self.lastModifiers['cmd'] and not self.lastModifiers['alt']) then
self.sendEscape = true
self.movements = 0
end
-- Control was down and is up, hasn't been blocked by another key, and
-- isn't above the movement threshold
elseif (self.sendEscape == true and not newModifiers['ctrl'] and self.movements < 20) then
elseif (self.sendEscape == true and not newModifiers['ctrl'] and self.movements < 30) then
self.lastModifiers = newModifiers
-- Allow for shift-escape
if newModifiers['shift'] then
hs.eventtap.keyStroke({'shift'}, 'escape', 0)
@ -56,8 +61,12 @@ function obj:init()
end
self.sendEscape = false
self.movements = 0
self.numberOfCharacters = 0
-- Control was down and is up, but isn't ready to send escape
else
self.lastModifiers = newModifiers
end
end
)
@ -65,7 +74,7 @@ function obj:init()
-- If any other key is pressed, don't send escape
self.asModifier = hs.eventtap.new({hs.eventtap.event.types.keyDown},
function(event)
self.sendEscape = false
self.sendEscape = false
end
)

View File

@ -0,0 +1,77 @@
--- === Launcher ===
local obj = {}
obj.__index = obj
-- Metadata
obj.name = "Launcher"
obj.version = "0.1"
obj.license = "MIT - https://opensource.org/licenses/MIT"
function obj:init()
-- Begin launcher mode
self.launcher = hs.hotkey.modal.new("ctrl", "space")
-- Behaviors on enter
function self.launcher:entered()
-- hs.alert'Entered mode'
end
-- Behaviors on exit
function self.launcher:exited()
-- hs.alert'Exited mode'
end
-- Use escape to exit launcher mode
self.launcher:bind("", "escape", function()
self.launcher:exit()
end)
-- Launcher shortcuts
self.launcher:bind("", "space", function()
hs.hints.windowHints()
self.launcher:exit()
end)
self.launcher:bind("", "return", function()
self:switch("Alacritty.app")
end)
self.launcher:bind("", "C", function()
self:switch("Calendar.app")
end)
self.launcher:bind("", "D", function()
self:switch("Discord.app")
end)
self.launcher:bind("", "E", function()
self:switch("Mail.app")
end)
self.launcher:bind("", "F", function()
self:switch("Firefox.app")
end)
self.launcher:bind("", "G", function()
self:switch("Mimestream.app")
end)
self.launcher:bind("", "M", function()
self:switch("Messages.app")
end)
self.launcher:bind("", "O", function()
self:switch("Obsidian.app")
end)
self.launcher:bind("", "P", function()
self:switch("System Preferences.app")
end)
self.launcher:bind("", "R", function()
hs.reload()
end)
self.launcher:bind("", "S", function()
self:switch("Slack.app")
end)
self.launcher:bind("", "Z", function()
self:switch("zoom.us.app")
end)
end
function obj:switch(app)
hs.application.launchOrFocus(app)
self.launcher:exit()
end
return obj

View File

@ -1 +1,2 @@
hs.loadSpoon('ControlEscape'):start() -- Load Hammerspoon bits from https://github.com/jasonrudolph/ControlEscape.spoon
hs.loadSpoon('Launcher'):init()

View File

@ -3,36 +3,36 @@ tap "homebrew/cask"
# Core Applications
cask "alacritty" # Terminal
cask "firefox" # Browser
cask "slack" # Chat
cask "zoomus" # Video conference
#cask "slack" # Chat
#cask "zoomus" # Video conference
cask "1password" # Passwords
cask "dropbox" # File sync
cask "docker" # Containers
#cask "docker" # Containers
# Helpful Applications
cask "obsidian" # Notes
cask "github-desktop" # Git GUI
cask "drawio" # Diagrams
# Auxiliary Tools
cask "scroll-reverser" # Mouse vs. trackpad
cask "meetingbar" # Scheduling
cask "gitify" # GitHub notifications
cask "basictex" # Small LaTeX distribution
cask "scroll-reverser" # Mouse vs. trackpad
cask "meetingbar" # Scheduling
cask "gitify" # GitHub notifications
# cask "basictex" # Small LaTeX distribution
cask "hammerspoon"
tap "homebrew/cask-drivers"
cask "logitech-g-hub" # Hardware drivers
# Fonts
tap "homebrew/cask-fonts"
cask "font-fira-mono-for-powerline"
cask "font-fira-mono-nerd-font"
# Personal
cask "authy" # Authentication
cask "keybase" # Encryption
cask "discord" # Chat
cask "steam" # Games
cask "epic-games" # Games
cask "calibre" # E-Books
cask "signal" # Messaging
#cask "steam" # Games
#cask "epic-games" # Games
#cask "calibre" # E-Books
#cask "signal" # Messaging
# Maybe
cask "jira-client" # Project Management
#cask "jira-client" # Project Management

View File

@ -13,3 +13,5 @@ brew "exa" # Better ls
brew "bat" # Better cat
brew "fzf" # Fuzzy finder
brew "tealdeer" # Mini man page
brew "direnv" # Environment variables
brew "glow" # Markdown previews

View File

@ -1,6 +1,7 @@
# DevOps Packages
tap "nmasur/repo"
tap "hashicorp/tap"
brew "ansible" # Deploy to local server
brew "terraform" # Deploy cloud infra
@ -9,3 +10,5 @@ brew "awscli" # AWS API tools
brew "kubectl" # Kubernetes CLI
brew "k9s" # Kubernetes TUI
brew "nmasur/repo/drips" # Retrieve AWS IPs
brew "hashicorp/tap/terraform-ls"
brew "tflint"

View File

@ -1,8 +1,8 @@
# Fun / Unnecessary Packages
tap "nmasur/repo"
tap "tarkah/tickrs"
#tap "nmasur/repo"
#tap "tarkah/tickrs"
brew "ffmpeg" # Convert videos
brew "nmasur/repo/bee" # Cheat on NYTimes Spelling Bee
brew "tarkah/tickrs/tickrs" # Interactive stock tickers
#brew "ffmpeg" # Convert videos
#brew "nmasur/repo/bee" # Cheat on NYTimes Spelling Bee
#brew "tarkah/tickrs/tickrs" # Interactive stock tickers

View File

@ -4,14 +4,14 @@ tap "superfly/tap"
tap "nmasur/repo"
tap "cjbassi/ytop"
brew "superfly/tap/flyctl" # Fly.io CLI
brew "ghc" # Haskell
brew "xsv" # CSV manipulation
brew "gron" # JSON grep
brew "nushell" # Data manipulation shell
brew "tectonic" # Minimal LaTeX compiler
#brew "superfly/tap/flyctl" # Fly.io CLI
#brew "ghc" # Haskell
#brew "xsv" # CSV manipulation
#brew "gron" # JSON grep
#brew "nushell" # Data manipulation shell
#brew "tectonic" # Minimal LaTeX compiler
brew "noti" # Create system notifications
brew "b2-tools" # BackBlaze B2 storage
brew "cjbassi/ytop/ytop" # Fancy system performance
brew "nmasur/repo/update-ssh-config" # Update .ssh/config
#brew "b2-tools" # BackBlaze B2 storage
#brew "cjbassi/ytop/ytop" # Fancy system performance
#brew "nmasur/repo/update-ssh-config" # Update .ssh/config
brew "awslogs" # View AWS log streams

View File

@ -2,6 +2,7 @@
brew "shellcheck" # Lint for bash
brew "shfmt" # Formatter for bash
brew "stylua" # Formatter for lua
brew "python" # Latest version of Python
brew "ipython" # Better interactive Python shell
brew "poetry" # Project-based Python dependencies

View File

@ -1,5 +1,7 @@
# Utility Packages
tap "saulpw/vd"
brew "jq" # JSON manipulation
brew "dos2unix" # File conversion
brew "tree" # Display directory trees
@ -12,8 +14,7 @@ brew "gpg" # Encryption
brew "qrencode" # Make a QR code
brew "mpv" # Video player
brew "youtube-dl" # Download YouTube videos
brew "googler" # Search Google
brew "gh" # GitHub commands
brew "pandoc" # Document converter
brew "visidata" # Spreadsheet manipulation
brew "saulpw/vd/visidata" # Spreadsheet manipulation
brew "mdp" # Terminal slideshows

8
mpv.configlink/mpv.conf Normal file
View File

@ -0,0 +1,8 @@
#script-opts=ytdl_hook-ytdl_path=/usr/local/bin/yt-dlp
[Youtube-dl]
profile = protocol.https
ytdl-format = bestvideo[height<=?1080]+bestaudio/best[height<=?1080]
demuxer-seekable-cache = yes
demuxer-max-bytes = 2048MiB
demuxer-max-back-bytes = 1024MiB

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.noah.newsboat</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/newsboat -x reload</string>
</array>
<key>Nice</key>
<integer>1</integer>
<key>StartInterval</key>
<integer>1800</integer>
<key>RunAtLoad</key>
<false/>
<key>StandardErrorPath</key>
<string>/tmp/newsboat.err</string>
<key>StandardOutPath</key>
<string>/tmp/newsboat.out</string>
</dict>
</plist>

View File

@ -0,0 +1,40 @@
browser "$BROWSER %u"
prepopulate-query-feeds yes
feed-sort-order lastupdated
reload-only-visible-feeds yes
text-width 72
bind-key j down
bind-key k up
bind-key j next articlelist
bind-key k prev articlelist
bind-key G end
bind-key g home
bind-key d pagedown
bind-key u pageup
bind-key n next-unread
bind-key p prev-unread
bind-key ; macro-prefix
bind-key B bookmark
bind-key f edit-flags
macro v set browser "mpv %u"; open-in-browser; set browser "$BROWSER %u"
macro p set browser "echo %u"; one; set browser "$BROWSER %u"
macro H set browser "clx view $(echo %u | cut -d '=' -f2)"; one; set browser "$BROWSER %u"
macro h set browser "clx view $(echo %u | cut -d '=' -f2)"; two; set browser "$BROWSER %u"
macro w set browser "w3m -o confirm_qq=false %u"; open-in-browser; set browser "$BROWSER %u"
macro r set browser "url-markdown %u | glow -p -w 72 -"; open-in-browser; set browser "$BROWSER %u"
macro d set browser "youtube-dl -o ~/Downloads/%(title)s.%(ext)s %u &"; open-in-browser-noninteractively; set browser "$BROWSER %u"
macro n set-tag News; reload-all
macro a set-tag All
macro e set-tag Reddit; reload-all
macro y set-tag YouTube; reload-all
bookmark-cmd "bookmark"
highlight article "^(Feed|Title|Author|Link|Date):.*" color243 default
highlight article "^(Links):.*" color243 default
highlight article "^(\\[[0-9]+\\]):.*" color243 default
highlight article "^(\\[[0-9]+\\])" color243 default
highlight article "^\\[.*\\]$" color243 default
highlight article "^(Title:).*" color249 default

View File

@ -1,255 +1,498 @@
-- Bootstrap the Packer plugin manager
local execute = vim.api.nvim_command
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
execute 'packadd packer.nvim'
packer_bootstrap = fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
})
end
-- Packer plugin installations
local use = require('packer').use
require('packer').startup(function()
use 'wbthomason/packer.nvim' -- Maintain plugin manager
use 'tpope/vim-eunuch' -- File manipulation in Vim
use 'tpope/vim-vinegar' -- Fixes netrw file explorer
use 'tpope/vim-fugitive' -- Git commands
use 'tpope/vim-surround' -- Manipulate parentheses
use 'tpope/vim-commentary' -- Use gc or gcc to add comments
use 'tpope/vim-repeat' -- Actually repeat using .
use 'christoomey/vim-tmux-navigator' -- Hotkeys for tmux panes
use 'morhetz/gruvbox' -- Colorscheme
use 'phaazon/hop.nvim' -- Quick jump around the buffer
use 'neovim/nvim-lspconfig' -- Language server linting
use 'folke/lsp-colors.nvim' -- Pretty LSP highlights
use 'jiangmiao/auto-pairs' -- Parentheses
use 'rafamadriz/friendly-snippets'
use 'hrsh7th/vim-vsnip'
use 'hrsh7th/vim-vsnip-integ'
use 'hrsh7th/nvim-compe' -- Auto-complete
use 'godlygeek/tabular' -- Spacing and alignment
use 'vimwiki/vimwiki' -- Wiki Markdown System
use 'airblade/vim-rooter' -- Change directory to git route
use 'itchyny/lightline.vim' -- Status bar
use { -- Syntax highlighting for most languages
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
use 'bfontaine/Brewfile.vim' -- Brewfile syntax
use 'blankname/vim-fish' -- Fish syntax
use 'chr4/nginx.vim' -- Nginx syntax
use 'hashivim/vim-terraform' -- Terraform syntax
use 'cespare/vim-toml' -- TOML syntax
use 'towolf/vim-helm' -- Helm syntax
use { -- Git next to line numbers
'lewis6991/gitsigns.nvim',
requires = {'nvim-lua/plenary.nvim'},
require("packer").startup(function(use)
-- Maintain plugin manager
use("wbthomason/packer.nvim")
-- Startup speed hacks
use({
"lewis6991/impatient.nvim",
config = function()
require('gitsigns').setup()
end
}
use { -- Fuzzy finder
'junegunn/fzf.vim',
requires = {'/usr/local/opt/fzf'}
}
-- use 'ludovicchabant/vim-gutentags'
require("impatient")
end,
})
-- Important tweaks
use("tpope/vim-surround") --- Manipulate parentheses
use("tpope/vim-commentary") --- Use gc or gcc to add comments
-- Convenience tweaks
use("tpope/vim-eunuch") --- File manipulation in Vim
use("tpope/vim-vinegar") --- Fixes netrw file explorer
use("tpope/vim-fugitive") --- Git commands and syntax
use("tpope/vim-repeat") --- Actually repeat using .
use("christoomey/vim-tmux-navigator") --- Hotkeys for tmux panes
-- Colorscheme
use({
"morhetz/gruvbox",
config = function()
vim.cmd([[colorscheme gruvbox]])
end,
})
-- Git next to line numbers
use({
"lewis6991/gitsigns.nvim",
branch = "main",
requires = { "nvim-lua/plenary.nvim" },
config = function()
require("gitsigns").setup()
end,
})
-- Status bar
use({
"hoob3rt/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true },
config = function()
require("lualine").setup({
options = {
theme = "gruvbox",
icons_enabled = true,
},
})
end,
})
-- Improve speed and filetype detection
use({
"nathom/filetype.nvim",
config = function()
-- Filetype for .env files
local envfiletype = function()
vim.bo.filetype = "text"
vim.bo.syntax = "sh"
end
-- Force filetype patterns that Vim doesn't know about
require("filetype").setup({
overrides = {
extensions = {
Brewfile = "brewfile",
muttrc = "muttrc",
tfvars = "terraform",
tf = "terraform",
},
literal = {
Caskfile = "brewfile",
[".gitignore"] = "gitignore",
},
complex = {
[".*git/config"] = "gitconfig",
["tmux.conf%..*link"] = "tmux",
["gitconfig%..*link"] = "gitconfig",
[".*ignore%..*link"] = "gitignore",
[".*%.toml%..*link"] = "toml",
},
function_extensions = {},
function_literal = {
[".envrc"] = envfiletype,
[".env"] = envfiletype,
[".env.dev"] = envfiletype,
[".env.prod"] = envfiletype,
[".env.example"] = envfiletype,
},
},
})
end,
})
-- Alignment tool
use("godlygeek/tabular")
-- Markdown renderer / wiki notes
use("vimwiki/vimwiki")
-- Markdown pretty view
use("ellisonleao/glow.nvim")
-- Snippet engine
use("L3MON4D3/LuaSnip")
-- =======================================================================
-- Language Server
-- =======================================================================
-- Language server engine
use({
"neovim/nvim-lspconfig",
requires = { "hrsh7th/cmp-nvim-lsp" },
config = function()
local capabilities = require("cmp_nvim_lsp").update_capabilities(
vim.lsp.protocol.make_client_capabilities()
)
require("lspconfig").rust_analyzer.setup({ capabilities = capabilities })
require("lspconfig").tflint.setup({ capabilities = capabilities })
require("lspconfig").terraformls.setup({ capabilities = capabilities })
require("lspconfig").pyright.setup({
cmd = { "poetry", "run", "pyright-langserver", "--stdio" },
capabilities = capabilities,
})
end,
})
-- Pretty highlights
use("folke/lsp-colors.nvim")
-- Linting
use({
"jose-elias-alvarez/null-ls.nvim",
branch = "main",
requires = {
"nvim-lua/plenary.nvim",
"neovim/nvim-lspconfig",
},
config = function()
require("null-ls").setup({
sources = {
require("null-ls").builtins.formatting.stylua,
require("null-ls").builtins.formatting.black.with({
command = "poetry",
args = { "run", "black", "--quiet", "--fast", "-" },
}),
require("null-ls").builtins.formatting.fish_indent,
-- require("null-ls").builtins.formatting.nixfmt,
require("null-ls").builtins.formatting.rustfmt,
require("null-ls").builtins.diagnostics.shellcheck,
require("null-ls").builtins.formatting.shfmt.with({
extra_args = { "-i", "4", "-ci" },
}),
require("null-ls").builtins.formatting.terraform_fmt,
-- require("null-ls").builtins.diagnostics.luacheck,
-- require("null-ls").builtins.diagnostics.markdownlint,
-- require("null-ls").builtins.diagnostics.pylint,
},
-- Format on save
on_attach = function(client)
if client.resolved_capabilities.document_formatting then
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()
augroup END
]])
end
end,
})
end,
})
-- =======================================================================
-- Completion System
-- =======================================================================
-- Completion sources
use("hrsh7th/cmp-nvim-lsp") --- Language server completion plugin
use("hrsh7th/cmp-buffer") --- Generic text completion
use("hrsh7th/cmp-path") --- Local file completion
use("hrsh7th/cmp-cmdline") --- Command line completion
use("hrsh7th/cmp-nvim-lua") --- Nvim lua api completion
use("saadparwaiz1/cmp_luasnip") --- Luasnip completion
use("lukas-reineke/cmp-rg") --- Ripgrep completion
-- Completion engine
use({
"hrsh7th/nvim-cmp",
requires = { "L3MON4D3/LuaSnip" },
config = function()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<Esc>"] = function(fallback)
cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
})
vim.cmd("stopinsert") --- Abort and leave insert mode
end,
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
-- ['<S-Tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 's' }),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
["<C-r>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<C-l>"] = cmp.mapping(function(fallback)
if require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
end
end, { "i", "s" }),
},
sources = {
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "luasnip" },
{ name = "buffer", keyword_length = 3, max_item_count = 10 },
{
name = "rg",
keyword_length = 6,
max_item_count = 10,
option = { additional_arguments = "--ignore-case" },
},
},
experimental = {
native_menu = false, --- Use cmp menu instead of Vim menu
ghost_text = true, --- Show preview auto-completion
},
})
-- Use buffer source for `/`
cmp.setup.cmdline("/", {
sources = {
{ name = "buffer", keyword_length = 5 },
},
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(":", {
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
end,
})
-- =======================================================================
-- Syntax
-- =======================================================================
-- Syntax engine
use({
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"hcl",
"python",
"lua",
"nix",
"fish",
"toml",
"yaml",
"json",
},
highlight = { enable = true },
indent = { enable = true },
})
end,
})
-- Additional syntax sources
use("bfontaine/Brewfile.vim") --- Brewfile syntax
use("chr4/nginx.vim") --- Nginx syntax
use("towolf/vim-helm") --- Helm syntax
use("rodjek/vim-puppet") --- Puppet syntax
-- =======================================================================
-- Fuzzy Launcher
-- =======================================================================
use({
"nvim-telescope/telescope.nvim",
requires = { "nvim-lua/plenary.nvim" },
config = function()
-- Telescope: quit instantly with escape
local actions = require("telescope.actions")
require("telescope").setup({
defaults = {
mappings = {
i = {
["<esc>"] = actions.close,
["<C-h>"] = "which_key",
},
},
},
pickers = {
find_files = { theme = "ivy" },
oldfiles = { theme = "ivy" },
buffers = { theme = "dropdown" },
},
extensions = {
fzy_native = {},
tmux = {},
zoxide = {},
neoclip = {},
project = {
base_dirs = { "~/dev/work" },
},
},
})
end,
})
-- Faster sorting
use("nvim-telescope/telescope-fzy-native.nvim")
-- Jump around tmux sessions
use("camgraff/telescope-tmux.nvim")
-- Jump directories
use({
"jvgrootveld/telescope-zoxide",
requires = { "nvim-lua/popup.nvim" },
})
-- Jump projects
use({
"nvim-telescope/telescope-project.nvim",
requires = { "nvim-telescope/telescope.nvim" },
config = function()
require("telescope").load_extension("project")
end,
})
-- Clipboard history
use({
"AckslD/nvim-neoclip.lua",
branch = "main",
requires = {
{ "tami5/sqlite.lua", module = "sqlite" },
{ "nvim-telescope/telescope.nvim" },
},
config = function()
require("neoclip").setup({
enable_persistant_history = true,
default_register = { "+", '"' },
keys = {
telescope = {
i = { paste = "<c-v>" },
},
},
})
require("telescope").load_extension("neoclip")
end,
})
-- Project bookmarks
use({
"ThePrimeagen/harpoon",
requires = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
})
-- TLDR Lookup
use({
"mrjones2014/tldr.nvim",
requires = { "nvim-telescope/telescope.nvim" },
})
-- =======================================================================
-- Install on initial bootstrap
if packer_bootstrap then
require("packer").sync()
end
end)
-- LSP Plugins
require('lspconfig').rust_analyzer.setup{}
require('lspconfig').pyright.setup{
cmd = { "poetry", "run", "pyright-langserver", "--stdio" }
}
require'compe'.setup({
enabled = true,
source = {
path = true,
buffer = true,
nvim_lsp = true,
},
})
if require('lspconfig/util').has_bins('diagnostic-languageserver') then
require('lspconfig').diagnosticls.setup{
cmd = { "diagnostic-languageserver", "--stdio" },
filetypes = { "sh" },
on_attach = on_attach,
init_options = {
filetypes = {
sh = "shellcheck",
},
linters = {
shellcheck = {
sourceName = "shellcheck",
command = "shellcheck",
debounce = 100,
args = { "--format=gcc", "-" },
offsetLine = 0,
offsetColumn = 0,
formatLines = 1,
formatPattern = {
"^[^:]+:(\\d+):(\\d+):\\s+([^:]+):\\s+(.*)$",
{
line = 1,
column = 2,
message = 4,
security = 3
}
},
securities = {
error = "error",
warning = "warning",
}
},
}
}
}
end
-- Auto-complete
-- ====================
-- Auto-complete mapping
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
local check_back_space = function()
local col = vim.fn.col('.') - 1
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
return true
else
return false
end
end
-- Use (s-)tab to:
--- move to prev/next item in completion menuone
--- jump to prev/next snippet's placeholder
_G.tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-n>"
elseif vim.fn.call("vsnip#available", {1}) == 1 then
return t "<Plug>(vsnip-expand-or-jump)"
elseif check_back_space() then
return t "<Tab>"
else
return vim.fn['compe#complete']()
end
end
_G.s_tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-p>"
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
return t "<Plug>(vsnip-jump-prev)"
else
return t "<S-Tab>"
end
end
-- Auto-complete keybinds
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
-- ===========================================================================
-- Settings
-- ========
-- ===========================================================================
-- Basic Settings
vim.o.termguicolors = true -- Set to truecolor
vim.cmd[[colorscheme gruvbox]] -- Installed with a plugin
vim.o.hidden = true -- Don't unload buffers when leaving them
vim.wo.number = true -- Show line numbers
vim.wo.relativenumber = true -- Relative numbers instead of absolute
vim.o.list = true -- Reveal whitespace with dashes
vim.o.expandtab = true -- Tabs into spaces
vim.o.shiftwidth = 4 -- Amount to shift with > key
vim.o.softtabstop = 4 -- Amount to shift with <TAB> key
vim.o.ignorecase = true -- Ignore case when searching
vim.o.smartcase = true -- Check case when using capitals in search
vim.o.infercase = true -- Don't match cases when completing suggestions
vim.o.incsearch = true -- Search while typing
vim.o.visualbell = true -- No sounds
vim.o.scrolljump = 1 -- Number of lines to scroll
vim.o.scrolloff = 3 -- Margin of lines to see while scrolling
vim.o.splitright = true -- Vertical splits on the right side
vim.o.splitbelow = true -- Horizontal splits on the bottom side
vim.o.pastetoggle = "<F3>" -- Use F3 to enter raw paste mode
vim.o.clipboard = "unnamedplus" -- Uses system clipboard for yanking
vim.o.updatetime = 300 -- Faster diagnostics
vim.o.mouse = "nv" -- Mouse interaction / scrolling
vim.o.termguicolors = true --- Set to truecolor
vim.o.hidden = true --- Don't unload buffers when leaving them
vim.wo.number = true --- Show line numbers
vim.wo.relativenumber = true --- Relative numbers instead of absolute
vim.o.list = true --- Reveal whitespace with dashes
vim.o.expandtab = true --- Tabs into spaces
vim.o.shiftwidth = 4 --- Amount to shift with > key
vim.o.softtabstop = 4 --- Amount to shift with <TAB> key
vim.o.ignorecase = true --- Ignore case when searching
vim.o.smartcase = true --- Check case when using capitals in search
vim.o.infercase = true --- Don't match cases when completing suggestions
vim.o.incsearch = true --- Search while typing
vim.o.visualbell = true --- No sounds
vim.o.scrolljump = 1 --- Number of lines to scroll
vim.o.scrolloff = 3 --- Margin of lines to see while scrolling
vim.o.splitright = true --- Vertical splits on the right side
vim.o.splitbelow = true --- Horizontal splits on the bottom side
vim.o.pastetoggle = "<F3>" --- Use F3 to enter raw paste mode
vim.o.clipboard = "unnamedplus" --- Uses system clipboard for yanking
vim.o.updatetime = 300 --- Faster diagnostics
vim.o.mouse = "nv" --- Mouse interaction / scrolling
-- Neovim features
vim.o.inccommand = "split" -- Live preview search and replace
vim.o.completeopt = "menuone,noselect" -- Required for nvim-compe completion
vim.o.inccommand = "split" --- Live preview search and replace
vim.o.completeopt = "menu,menuone,noselect" --- Required for nvim-cmp completion
-- Required until 0.6.0: do not source the default filetype.vim
vim.g.did_load_filetypes = 1
-- Remember last position when reopening file
vim.api.nvim_exec([[
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
]], false)
vim.api.nvim_exec(
[[
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
]],
false
)
-- Better backup, swap and undo storage
vim.o.backup = true -- Easier to recover and more secure
vim.bo.swapfile = false -- Instead of swaps, create backups
vim.bo.undofile = true -- Keeps undos after quit
vim.o.backup = true --- Easier to recover and more secure
vim.bo.swapfile = false --- Instead of swaps, create backups
vim.bo.undofile = true --- Keeps undos after quit
-- Create backup directories if they don't exist
vim.api.nvim_exec([[
set backupdir=~/.local/share/nvim/backup
set undodir=~/.local/share/nvim/undo
-- Should be fixed in 0.6 by https://github.com/neovim/neovim/pull/15433
vim.o.backupdir = vim.fn.stdpath("cache") .. "/backup"
vim.api.nvim_exec(
[[
if !isdirectory(&backupdir)
call mkdir(&backupdir, "p")
endif
if !isdirectory(&undodir)
call mkdir(&undodir, "p")
endif
]], false)
-- Keep selection when tabbing
vim.api.nvim_set_keymap("v", "<", "<gv", {noremap=true})
vim.api.nvim_set_keymap("v", ">", ">gv", {noremap=true})
-- Force filetype patterns that Vim doesn't know about
vim.api.nvim_exec([[
au BufRead,BufNewFile *.Brewfile setfiletype brewfile
au BufRead,BufNewFile tmux.conf* setfiletype tmux
au BufRead,BufNewFile *ignore.*link setfiletype gitignore
au BufRead,BufNewFile gitconfig.*link setfiletype gitconfig
au BufRead,BufNewFile *.toml.*link setfiletype toml
au BufRead,BufNewFile *.muttrc setfiletype muttrc
au BufRead,BufNewFile .env* set ft=text | set syntax=sh
]], false)
]],
false
)
-- LaTeX options
vim.api.nvim_exec([[
vim.api.nvim_exec(
[[
au FileType tex inoremap ;bf \textbf{}<Esc>i
au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!
]], false)
]],
false
)
-- Highlight when yanking
vim.api.nvim_exec([[
vim.api.nvim_exec(
[[
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
]], false)
-- Rust stuff
-- vim.api.nvim_exec([[
-- au BufWritePost *.rs silent! execute "%! rustfmt"
-- ]], false)
-- Auto-pairs
vim.g.AutoPairsFlyMode = 0
]],
false
)
-- Netrw
vim.g.netrw_liststyle = 3 -- Change style to 'tree' view
vim.g.netrw_banner = 0 -- Remove useless banner
vim.g.netrw_winsize = 15 -- Explore window takes % of page
vim.g.netrw_liststyle = 3 -- Change style to 'tree' view
vim.g.netrw_banner = 0 -- Remove useless banner
vim.g.netrw_winsize = 15 -- Explore window takes % of page
vim.g.netrw_browse_split = 4 -- Open in previous window
vim.g.netrw_altv = 1 -- Always split left
-- Polyglot
vim.g.terraform_fmt_on_save = 1 -- Formats with terraform plugin
vim.g.rustfmt_autosave = 1 -- Formats with rust plugin
vim.g.netrw_altv = 1 -- Always split left
-- VimWiki
vim.g.vimwiki_list = {
@ -257,18 +500,19 @@ vim.g.vimwiki_list = {
["path"] = "$NOTES_PATH",
["syntax"] = "markdown",
["index"] = "home",
["ext"] = ".md"
}
["ext"] = ".md",
},
}
vim.g.vimwiki_key_mappings = {
["all_maps"] = 1,
["mouse"] = 1,
}
vim.g.vimwiki_auto_chdir = 1 -- Set local dir to Wiki when open
vim.g.vimwiki_create_link = 0 -- Don't automatically create new links
vim.g.vimwiki_listsyms = " x" -- Set checkbox symbol progression
vim.g.vimwiki_auto_chdir = 1 -- Set local dir to Wiki when open
vim.g.vimwiki_create_link = 0 -- Don't automatically create new links
vim.g.vimwiki_listsyms = " x" -- Set checkbox symbol progression
vim.g.vimwiki_table_mappings = 0 -- VimWiki table keybinds interfere with tab completion
vim.api.nvim_exec([[
vim.api.nvim_exec(
[[
au FileType markdown inoremap ;tt <Esc>:AddTag<CR>
function! PInsert(item)
@ -277,76 +521,186 @@ vim.api.nvim_exec([[
endfunction
command! AddTag call fzf#run({'source': 'rg "#[A-Za-z/]+[ |\$]" -o --no-filename --no-line-number | sort | uniq', 'sink': function('PInsert')})
]], false)
]],
false
)
-- Lightline status bar
vim.g.lightline = {
["colorscheme"] = "jellybeans",
["active"] = {
["right"] = {
{ "lineinfo" }
},
["left"] = {
{ "mode", "paste" },
{ "readonly", "relativepath", "gitbranch", "modified" }
-- ===========================================================================
-- Custom Functions
-- ===========================================================================
grep_notes = function()
local opts = {
prompt_title = "Search Notes",
cwd = "$NOTES_PATH",
}
},
["component_function"] = {
["gitbranch"] = "fugitive#head"
},
}
require("telescope.builtin").live_grep(opts)
end
find_notes = function()
local opts = {
prompt_title = "Find Notes",
cwd = "$NOTES_PATH",
}
require("telescope.builtin").find_files(opts)
end
find_downloads = function()
local opts = {
prompt_title = "Find Downloads",
cwd = "~/Downloads",
}
require("telescope.builtin").file_browser(opts)
end
choose_project = function()
local opts = require("telescope.themes").get_ivy({
layout_config = {
bottom_pane = {
height = 10,
},
},
})
require("telescope").extensions.project.project(opts)
end
clipboard_history = function()
local opts = require("telescope.themes").get_cursor({
layout_config = {
cursor = {
width = 150,
},
},
})
require("telescope").extensions.neoclip.neoclip(opts)
end
command_history = function()
local opts = require("telescope.themes").get_ivy({
layout_config = {
bottom_pane = {
height = 15,
},
},
})
require("telescope.builtin").command_history(opts)
end
-- ===========================================================================
-- Key Mapping
-- ===========================================================================
-- Function to cut down config boilerplate
local key = function(mode, key_sequence, action, params)
params = params or {}
params["noremap"] = true
vim.api.nvim_set_keymap(mode, key_sequence, action, params)
end
-- Remap space as leader key
vim.api.nvim_set_keymap("", "<Space>", "<Nop>", {noremap=true, silent=true})
key("", "<Space>", "<Nop>", { silent = true })
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Unset search pattern register
vim.api.nvim_set_keymap("n", "<CR>", ":noh<CR><CR>", {noremap=true, silent=true})
-- Keep selection when changing indentation
key("v", "<", "<gv")
key("v", ">", ">gv")
-- Clear search register
key("n", "<CR>", ":noh<CR><CR>", { silent = true })
-- Shuffle lines around
vim.api.nvim_set_keymap("n", "<A-j>", ":m .+1<CR>==", {noremap=true})
vim.api.nvim_set_keymap("n", "<A-k>", ":m .-2<CR>==", {noremap=true})
vim.api.nvim_set_keymap("i", "<A-j>", "<Esc>:m .+1<CR>==gi", {noremap=true})
vim.api.nvim_set_keymap("i", "<A-k>", "<Esc>:m .-2<CR>==gi", {noremap=true})
vim.api.nvim_set_keymap("v", "<A-j>", ":m '>+1<CR>gv=gv", {noremap=true})
vim.api.nvim_set_keymap("v", "<A-k>", ":m '<-2<CR>gv=gv", {noremap=true})
key("n", "<A-j>", ":m .+1<CR>==")
key("n", "<A-k>", ":m .-2<CR>==")
key("i", "<A-j>", "<Esc>:m .+1<CR>==gi")
key("i", "<A-k>", "<Esc>:m .-2<CR>==gi")
key("v", "<A-j>", ":m '>+1<CR>gv=gv")
key("v", "<A-k>", ":m '<-2<CR>gv=gv")
-- Fzf (fuzzy finder)
vim.api.nvim_set_keymap("n", "<Leader>/", ":Rg<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>ff", ":Files<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>fr", ":History<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>b", ":Buffers<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>s", ":BLines<CR>", {noremap=true})
-- Telescope (fuzzy finder)
key("n", "<Leader>k", ":Telescope keymaps<CR>")
key("n", "<Leader>/", ":Telescope live_grep<CR>")
key("n", "<Leader>ff", ":Telescope find_files<CR>")
key("n", "<Leader>fp", ":Telescope git_files<CR>")
key("n", "<Leader>fN", "<Cmd>lua find_notes()<CR>")
key("n", "<Leader>N", "<Cmd>lua grep_notes()<CR>")
key("n", "<Leader>fD", "<Cmd>lua find_downloads()<CR>")
key("n", "<Leader>fa", ":Telescope file_browser<CR>")
key("n", "<Leader>fw", ":Telescope grep_string<CR>")
key("n", "<Leader>wt", ":Telescope tmux sessions<CR>")
key("n", "<Leader>ww", ":Telescope tmux windows<CR>")
key("n", "<Leader>w/", ":Telescope tmux pane_contents<CR>")
key("n", "<Leader>fz", ":Telescope zoxide list<CR>")
key("n", "<Leader>b", ":Telescope buffers<CR>")
key("n", "<Leader>hh", ":Telescope help_tags<CR>")
key("n", "<Leader>fr", ":Telescope oldfiles<CR>")
key("n", "<Leader>cc", ":Telescope commands<CR>")
key("n", "<Leader>cr", "<Cmd>lua command_history()<CR>")
key("n", "<Leader>y", "<Cmd>lua clipboard_history()<CR>")
key("i", "<c-y>", "<Cmd>lua clipboard_history()<CR>")
key("n", "<Leader>s", ":Telescope current_buffer_fuzzy_find<CR>")
key("n", "<Leader>gc", ":Telescope git_commits<CR>")
key("n", "<Leader>gf", ":Telescope git_bcommits<CR>")
key("n", "<Leader>gb", ":Telescope git_branches<CR>")
key("n", "<Leader>gs", ":Telescope git_status<CR>")
key("n", "<C-p>", "<Cmd>lua choose_project()<CR>")
-- Harpoon
key("n", "<Leader>m", "<Cmd>lua require('harpoon.mark').add_file()<CR><Esc>")
key("n", "<Leader>`", "<Cmd>lua require('harpoon.ui').toggle_quick_menu()<CR><Esc>")
key("n", "<Leader>1", "<Cmd>lua require('harpoon.ui').nav_file(1)<CR><Esc>")
key("n", "<Leader>2", "<Cmd>lua require('harpoon.ui').nav_file(2)<CR><Esc>")
key("n", "<Leader>3", "<Cmd>lua require('harpoon.ui').nav_file(3)<CR><Esc>")
-- LSP
key("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", { silent = true })
key("n", "gi", "<Cmd>lua vim.lsp.buf.implementation()<CR>", { silent = true })
key("n", "gh", "<Cmd>lua vim.lsp.buf.hover()<CR>", { silent = true })
key("n", "]e", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>", { silent = true })
key("n", "[e", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", { silent = true })
key("n", "<Leader>e", "<Cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", { silent = true })
-- File commands
vim.api.nvim_set_keymap("n", "<Leader>q", ":quit<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>Q", ":quitall<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>fs", ":write<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>fe", ":!chmod 755 %<CR><CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>fn", ":!chmod 644 %<CR><CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>fd", ":lcd %:p:h<CR>", {silent=true, noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>fu", ":lcd ..<CR>", {silent=true, noremap=true})
vim.api.nvim_set_keymap("n", "<Leader><Tab>", ":b#<CR>", {silent=true, noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", {silent=true, noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>tt", [[<Cmd>exe 'edit ~/notes/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]], {noremap=true})
key("n", "<Leader>q", ":quit<CR>")
key("n", "<Leader>Q", ":quitall<CR>")
key("n", "<Leader>fs", ":write<CR>")
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
key("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", { silent = true })
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]])
key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
-- Window commands
vim.api.nvim_set_keymap("n", "<Leader>wv", ":vsplit<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>wh", ":split<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>wm", ":only<CR>", {noremap=true})
key("n", "<Leader>wv", ":vsplit<CR>")
key("n", "<Leader>wh", ":split<CR>")
key("n", "<Leader>wm", ":only<CR>")
-- Tabularize
vim.api.nvim_set_keymap("", "<Leader>ta", ":Tabularize /", {noremap=true})
vim.api.nvim_set_keymap("", "<Leader>t#", ":Tabularize /#<CR>", {noremap=true})
vim.api.nvim_set_keymap("", "<Leader>t\"", ":Tabularize /\"<CR>", {noremap=true})
key("", "<Leader>ta", ":Tabularize /")
key("", "<Leader>t#", ":Tabularize /#<CR>")
key("", "<Leader>tl", ":Tabularize /---<CR>")
-- Vimrc
vim.api.nvim_set_keymap("n", "<Leader>fv", ":edit $MYVIMRC<CR>", {noremap=true})
vim.api.nvim_set_keymap("n", "<Leader>rr", ":luafile $MYVIMRC<CR>", {noremap=true})
-- Vimrc editing
key("n", "<Leader>fv", ":edit $MYVIMRC<CR>")
key("n", "<Leader>rr", ":luafile $MYVIMRC<CR>")
key("n", "<Leader>rp", ":luafile $MYVIMRC<CR>:PackerInstall<CR>:")
key("n", "<Leader>rc", ":luafile $MYVIMRC<CR>:PackerCompile<CR>")
-- Keep cursor in place
key("n", "n", "nzz")
key("n", "N", "Nzz")
key("n", "J", "mzJ`z") --- Mark and jump back to it
-- Add undo breakpoints
key("i", ",", ",<C-g>u")
key("i", ".", ".<C-g>u")
key("i", "!", "!<C-g>u")
key("i", "?", "?<C-g>u")
-- Other
vim.api.nvim_set_keymap("n", "<Leader><Space>", ":HopWord<CR>", {noremap=true})
vim.api.nvim_set_keymap("t", "<A-CR>", "<C-\\><C-n>", {noremap=true}) -- Exit terminal mode
vim.api.nvim_set_keymap("n", "<A-CR>", ":noh<CR>", {noremap=true, silent=true})
vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true})
key("t", "<A-CR>", "<C-\\><C-n>") --- Exit terminal mode
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
key("n", "Y", "y$") --- Copy to end of line
key("v", "<C-r>", "y<Esc>:%s/<C-r>+//gc<left><left><left>") --- Substitute selected
key("v", "D", "y'>gp") --- Duplicate selected

View File

@ -0,0 +1 @@
indent_type = "Spaces"

117
python/boto/poetry.lock generated
View File

@ -1,129 +1,120 @@
[[package]]
category = "main"
description = "The AWS SDK for Python"
name = "boto3"
version = "1.20.5"
description = "The AWS SDK for Python"
category = "main"
optional = false
python-versions = "*"
version = "1.14.46"
python-versions = ">= 3.6"
[package.dependencies]
botocore = ">=1.17.46,<1.18.0"
botocore = ">=1.23.5,<1.24.0"
jmespath = ">=0.7.1,<1.0.0"
s3transfer = ">=0.3.0,<0.4.0"
s3transfer = ">=0.5.0,<0.6.0"
[package.extras]
crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
[[package]]
category = "main"
description = "Low-level, data-driven core of boto 3."
name = "botocore"
version = "1.23.5"
description = "Low-level, data-driven core of boto 3."
category = "main"
optional = false
python-versions = "*"
version = "1.17.46"
python-versions = ">= 3.6"
[package.dependencies]
docutils = ">=0.10,<0.16"
jmespath = ">=0.7.1,<1.0.0"
python-dateutil = ">=2.1,<3.0.0"
urllib3 = ">=1.25.4,<1.27"
[package.dependencies.urllib3]
python = "<3.4.0 || >=3.5.0"
version = ">=1.20,<1.26"
[package.extras]
crt = ["awscrt (==0.12.5)"]
[[package]]
category = "main"
description = "Docutils -- Python Documentation Utilities"
name = "docutils"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
version = "0.15.2"
[[package]]
category = "main"
description = "JSON Matching Expressions"
name = "jmespath"
version = "0.10.0"
description = "JSON Matching Expressions"
category = "main"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
version = "0.10.0"
[[package]]
category = "main"
description = "Extensions to the standard Python datetime module"
name = "python-dateutil"
version = "2.8.2"
description = "Extensions to the standard Python datetime module"
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
version = "2.8.1"
[package.dependencies]
six = ">=1.5"
[[package]]
category = "main"
description = "An Amazon S3 Transfer Manager"
name = "s3transfer"
version = "0.5.0"
description = "An Amazon S3 Transfer Manager"
category = "main"
optional = false
python-versions = "*"
version = "0.3.3"
python-versions = ">= 3.6"
[package.dependencies]
botocore = ">=1.12.36,<2.0a.0"
[[package]]
category = "main"
description = "Python 2 and 3 compatibility utilities"
name = "six"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
version = "1.15.0"
[package.extras]
crt = ["botocore[crt] (>=1.20.29,<2.0a.0)"]
[[package]]
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
category = "main"
description = "HTTP library with thread-safe connection pooling, file post, and more."
marker = "python_version != \"3.4\""
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "urllib3"
version = "1.26.7"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
version = "1.25.10"
[package.extras]
brotli = ["brotlipy (>=0.6.0)"]
secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)", "ipaddress"]
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
[metadata]
content-hash = "fc1d3a2527ef475cf30a75a0bccfbe2fc3ca0ed539edb55268147bce9b170ff5"
lock-version = "1.0"
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "fc1d3a2527ef475cf30a75a0bccfbe2fc3ca0ed539edb55268147bce9b170ff5"
[metadata.files]
boto3 = [
{file = "boto3-1.14.46-py2.py3-none-any.whl", hash = "sha256:1cfbadf41777dade69a3e5eaf1b71d15b4ae616fd94d16a894b692e14319f4a2"},
{file = "boto3-1.14.46.tar.gz", hash = "sha256:cc3636828f1677ff93e8b1130c90dfe800187964e33786711450e8653d3f245f"},
{file = "boto3-1.20.5-py3-none-any.whl", hash = "sha256:81ca80fbb3d551819c35c809cb159fd0bec6701d3d8f0e5906a22da7558d098e"},
{file = "boto3-1.20.5.tar.gz", hash = "sha256:cc620c289b12d7bf7c2706b517c9f8950f9be4622aacc9e7580b8b4ee0d3bc73"},
]
botocore = [
{file = "botocore-1.17.46-py2.py3-none-any.whl", hash = "sha256:6b134681c938f00b28424abf4b46fa6034b516d8add3a3f524e2292db61aa070"},
{file = "botocore-1.17.46.tar.gz", hash = "sha256:2f15a755b990db13a7a9e06a124c6ca5fa1c4470d76672363024d7f2a6c2566c"},
]
docutils = [
{file = "docutils-0.15.2-py2-none-any.whl", hash = "sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827"},
{file = "docutils-0.15.2-py3-none-any.whl", hash = "sha256:6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0"},
{file = "docutils-0.15.2.tar.gz", hash = "sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99"},
{file = "botocore-1.23.5-py3-none-any.whl", hash = "sha256:c8eaeee0bac356396386aa9165043808fe736fb9e03ac0dedb1dfd82f41ad1a3"},
{file = "botocore-1.23.5.tar.gz", hash = "sha256:49d1f012dc8467577a5fe603fc87cc13af816dd926b2bc2e28a3b2999ab14d36"},
]
jmespath = [
{file = "jmespath-0.10.0-py2.py3-none-any.whl", hash = "sha256:cdf6525904cc597730141d61b36f2e4b8ecc257c420fa2f4549bac2c2d0cb72f"},
{file = "jmespath-0.10.0.tar.gz", hash = "sha256:b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9"},
]
python-dateutil = [
{file = "python-dateutil-2.8.1.tar.gz", hash = "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"},
{file = "python_dateutil-2.8.1-py2.py3-none-any.whl", hash = "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"},
{file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"},
{file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"},
]
s3transfer = [
{file = "s3transfer-0.3.3-py2.py3-none-any.whl", hash = "sha256:2482b4259524933a022d59da830f51bd746db62f047d6eb213f2f8855dcb8a13"},
{file = "s3transfer-0.3.3.tar.gz", hash = "sha256:921a37e2aefc64145e7b73d50c71bb4f26f46e4c9f414dc648c6245ff92cf7db"},
{file = "s3transfer-0.5.0-py3-none-any.whl", hash = "sha256:9c1dc369814391a6bda20ebbf4b70a0f34630592c9aa520856bf384916af2803"},
{file = "s3transfer-0.5.0.tar.gz", hash = "sha256:50ed823e1dc5868ad40c8dc92072f757aa0e653a192845c94a3b676f4a62da4c"},
]
six = [
{file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
{file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"},
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
]
urllib3 = [
{file = "urllib3-1.25.10-py2.py3-none-any.whl", hash = "sha256:e7983572181f5e1522d9c98453462384ee92a0be7fac5f1413a1e35c56cc0461"},
{file = "urllib3-1.25.10.tar.gz", hash = "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a"},
{file = "urllib3-1.26.7-py2.py3-none-any.whl", hash = "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844"},
{file = "urllib3-1.26.7.tar.gz", hash = "sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece"},
]

View File

@ -53,7 +53,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
[[package]]
name = "urllib3"
version = "1.26.2"
version = "1.26.5"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "main"
optional = false
@ -91,6 +91,6 @@ requests = [
{file = "requests-2.25.0.tar.gz", hash = "sha256:7f1a0b932f4a60a1a65caa4263921bb7d9ee911957e0ae4a23a6dd08185ad5f8"},
]
urllib3 = [
{file = "urllib3-1.26.2-py2.py3-none-any.whl", hash = "sha256:d8ff90d979214d7b4f8ce956e80f4028fc6860e4431f731ea4a8c08f23f99473"},
{file = "urllib3-1.26.2.tar.gz", hash = "sha256:19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08"},
{file = "urllib3-1.26.5-py2.py3-none-any.whl", hash = "sha256:753a0374df26658f99d826cfe40394a686d05985786d946fbe4165b5148f5a7c"},
{file = "urllib3-1.26.5.tar.gz", hash = "sha256:a7acd0977125325f516bda9735fa7142b909a8d01e8b2e4c8108d0984e6e0098"},
]

View File

@ -62,15 +62,10 @@ use_fish_shell() {
echo "fish ✓"
}
setup_poetry() {
poetry completions fish > "$(brew --prefix)/share/fish/vendor_completions.d/poetry.fish"
}
printf "\nbootstrapping...\n\n"
install_xcode
install_homebrew
install_brews
setup_poetry
use_fish_shell
("$DOTS/scripts/setup_symlinks")

View File

@ -6,6 +6,9 @@ defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
echo "Automatically show and hide the dock"
defaults write com.apple.dock autohide -bool true
echo "Automatically show and hide the menu bar"
defaults write NSGlobalDomain _HIHideMenuBar -bool true
echo "Make Dock icons of hidden applications translucent"
defaults write com.apple.dock showhidden -bool true
@ -111,6 +114,35 @@ echo "Set dock size"
defaults write com.apple.dock largesize -int 48
defaults write com.apple.dock tilesize -int 44
echo "Choose and order dock icons"
__dock_item() {
printf '%s%s%s%s%s' \
'<dict><key>tile-data</key><dict><key>file-data</key><dict>' \
'<key>_CFURLString</key><string>' \
"$1" \
'</string><key>_CFURLStringType</key><integer>0</integer>' \
'</dict></dict></dict>'
}
defaults write com.apple.dock persistent-apps -array \
"$(__dock_item /Applications/1Password\ 7.app)" \
"$(__dock_item /Applications/Slack.app)" \
"$(__dock_item /System/Applications/Calendar.app)" \
"$(__dock_item /Applications/Firefox.app)" \
"$(__dock_item /System/Applications/Messages.app)" \
"$(__dock_item /System/Applications/Mail.app)" \
"$(__dock_item /Applications/Mimestream.app)" \
"$(__dock_item /Applications/zoom.us.app)" \
"$(__dock_item /Applications/Obsidian.app)" \
"$(__dock_item /Applications/Alacritty.app)" \
"$(__dock_item /System/Applications/System\ Preferences.app)"
echo "No recent items in dock"
defaults write com.apple.dock show-recents -bool FALSE
echo "Switch to dark mode"
defaults write "Apple Global Domain" "AppleInterfaceStyle" "Dark"
echo "Turn on Scroll Reverser"
open /Applications/Scroll\ Reverser.app
osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/Scroll Reverser.app", hidden:false}'

5
scripts/npm Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
npm update -g
npm install -g pyright
npm install -g diagnostic-languageserver

View File

@ -1,12 +1,14 @@
#!/usr/bin/env fish
set -U FISH_DIR (readlink ~/.config/fish) # Used for getting to this repo
set -Ux DOTS (dirname $FISH_DIR) # Directory of this config repo
set -U CDPATH . $HOME # Directories available for immediate cd
set -Ux EDITOR nvim # Preferred text editor
set -U PROJ $HOME/dev/work # Projects directory
set -Ux NOTES_PATH $HOME/notes # Notes directory
set -Ux MANPAGER "nvim +Man!" # Used for reading man pages
set -Ux DOTS (dirname $FISH_DIR) # Directory of this config repo
set -U CDPATH . $HOME # Directories available for immediate cd
set -Ux EDITOR nvim # Preferred text editor
set -U PROJ $HOME/dev/work # Projects directory
set -Ux NOTES_PATH "$HOME/Library/Mobile Documents/iCloud~md~obsidian/Documents/notes" # Notes directory
set -Ux MANPAGER "nvim +Man!" # Used for reading man pages
set -Ux DIRENV_LOG_FORMAT "" # Disable direnv output
set -Ux BROWSER "/Applications/Firefox.app/Contents/MacOS/firefox"
# Load abbreviations
abbrs

View File

@ -1,6 +1,7 @@
#!/bin/sh
echo "downloading ytfzf"
curl -sL "https://raw.githubusercontent.com/pystardust/ytfzf/master/ytfzf" > ~/.local/bin/ytfzf
mkdir -p ~/.local/bin
curl -sL "https://raw.githubusercontent.com/pystardust/ytfzf/master/ytfzf" >~/.local/bin/ytfzf
chmod 755 ~/.local/bin/ytfzf
echo "ytfzf ✓"

View File

@ -20,6 +20,11 @@ bind l select-pane -R
# Split out pane
bind b break-pane
# Synchronize panes
bind S set-window-option synchronize-panes
bind C-h resize-pane -L 10
bind C-l resize-pane -R 10
# Copy mode works as Vim
bind Escape copy-mode
bind k copy-mode