Compare commits
20 Commits
649592c5ca
...
9664356438
Author | SHA1 | Date |
---|---|---|
~hedy | 9664356438 | |
~hedy | 0281b58911 | |
~hedy | f05b6aac4f | |
~hedy | 05477729cc | |
~hedy | 8264399dc6 | |
~hedy | c81b440f53 | |
~hedy | d789eddcfa | |
~hedy | 2f0171f775 | |
~hedy | c73be8fa21 | |
~hedy | bda970048d | |
~hedy | c1e5e6311d | |
~hedy | b6116d05b4 | |
~hedy | e0d6b5e6f0 | |
~hedy | e0a220df68 | |
~hedy | d745e42ad7 | |
~hedy | d6d2dde9ca | |
~hedy | 01941c3f58 | |
~hedy | e61a71db67 | |
hedy | fe4bdcf24c | |
hedy | bc40743feb |
1
.addpath
1
.addpath
|
@ -4,5 +4,6 @@ local/src/pyenv/bin
|
|||
go/bin
|
||||
.cargo/bin
|
||||
node_modules/.bin
|
||||
.local/share/pnpm
|
||||
/usr/local/go/bin
|
||||
/usr/local/sbin/
|
||||
|
|
11
.aliases
11
.aliases
|
@ -1,19 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# In addition to this file being valid POSIX, all RHS of `=` must use single
|
||||
# quotes, and must be convertible to nu and fish (also see ~/dotscripts/gen/nu
|
||||
# and check ~/.aliases.nu)
|
||||
|
||||
# Program aliases
|
||||
alias x=exit
|
||||
alias clr=clear
|
||||
alias y=yadm
|
||||
alias td=termdown
|
||||
alias hdi=howdoi
|
||||
alias bom=bombadillo
|
||||
alias syscu='systemctl --user'
|
||||
alias edoom='emacs --with-profile=doom'
|
||||
alias g=git
|
||||
alias acme='acme -f /mnt/font/FiraCode-Regular/15/font'
|
||||
alias la='ls -a'
|
||||
|
||||
# Shortcuts
|
||||
alias newvenv='python3 -m virtualenv venv && source ./venv/bin/activate.fish'
|
||||
alias localusrlocal='rsync ~/local/usr/local/ ~/local/ -avr && rm -rf ~/local/usr/local'
|
||||
alias localusr='rsync ~/local/usr/ ~/local/ -avr && rm -rf ~/local/usr'
|
||||
|
||||
alias apt-up='sudo apt update && sudo apt upgrade -y && sudo apt-get dist-upgrade -y && sudo apt autoremove'
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# DOESN"T WORK
|
||||
set document.browse.links.active_link.enable_color = 0
|
||||
set document.browse.links.active_link.invert = 0
|
||||
set document.browse.links.active_link.underline = 1
|
||||
set document.browse.links.active_link.bold = 1
|
||||
set document.colors.link = "#83c1fc"
|
||||
set document.colors.image = "gray"
|
||||
# set document.browse.links.active_link.colors.background = "#83c1fc"
|
||||
# set document.browse.links.active_link.colors.background = "#444444"
|
||||
# set document.browse.links.active_link.colors.text = "white"
|
||||
# set document.css.prefers_color_scheme = "light"
|
|
@ -1,6 +0,0 @@
|
|||
function apt-up
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
sudo apt-get dist-upgrade -y
|
||||
sudo apt autoremove
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
function condasetup
|
||||
if test -f /Users/hedy/miniconda3/bin/conda
|
||||
eval /Users/hedy/miniconda3/bin/conda "shell.fish" "hook" $argv | source
|
||||
end
|
||||
end
|
|
@ -0,0 +1,111 @@
|
|||
# Based on top of fish's built-in "informative" shell style (see fish_config)
|
||||
# I actually forgot what it's called exactly
|
||||
#
|
||||
# Most is the same. Only thing different is that it:
|
||||
# - prints leading space because my head is tired from moving to the left in
|
||||
# internet articles, terminal programs, and prompt
|
||||
# - changes the suffix to ">"
|
||||
# - fixes git clean state char
|
||||
# - makes base name blue
|
||||
# - print user@hostname in right prompt (see fish_right_prompt)
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_pipestatus $pipestatus
|
||||
|
||||
if not set -q __fish_git_prompt_show_informative_status
|
||||
set -g __fish_git_prompt_show_informative_status 1
|
||||
end
|
||||
if not set -q __fish_git_prompt_hide_untrackedfiles
|
||||
set -g __fish_git_prompt_hide_untrackedfiles 1
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_branch
|
||||
set -g __fish_git_prompt_color_branch magenta --bold
|
||||
end
|
||||
if not set -q __fish_git_prompt_showupstream
|
||||
set -g __fish_git_prompt_showupstream "informative"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_ahead
|
||||
set -g __fish_git_prompt_char_upstream_ahead "↑"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_behind
|
||||
set -g __fish_git_prompt_char_upstream_behind "↓"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_prefix
|
||||
set -g __fish_git_prompt_char_upstream_prefix ""
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_stagedstate
|
||||
set -g __fish_git_prompt_char_stagedstate "●"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_dirtystate
|
||||
set -g __fish_git_prompt_char_dirtystate "✚"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_untrackedfiles
|
||||
set -g __fish_git_prompt_char_untrackedfiles "…"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_invalidstate
|
||||
set -g __fish_git_prompt_char_invalidstate "✖"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_cleanstate
|
||||
# Switch from the check symbol to = because this fixes the width
|
||||
# calculation problem where where the last char at the right prompt
|
||||
# will be wrapped to the next line.
|
||||
# Solution from stack overflow obviously, lost link though
|
||||
set -g __fish_git_prompt_char_cleanstate "="
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_dirtystate
|
||||
set -g __fish_git_prompt_color_dirtystate blue
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_stagedstate
|
||||
set -g __fish_git_prompt_color_stagedstate yellow
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_invalidstate
|
||||
set -g __fish_git_prompt_color_invalidstate red
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_untrackedfiles
|
||||
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_cleanstate
|
||||
set -g __fish_git_prompt_color_cleanstate green --bold
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
set -l prefix
|
||||
set -l suffix
|
||||
switch "$USER"
|
||||
case root toor
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
set color_cwd_base $fish_color_cwd_root
|
||||
else
|
||||
set color_cwd $fish_color_cwd
|
||||
set color_cwd_base blue
|
||||
end
|
||||
set suffix ' #'
|
||||
case '*'
|
||||
set color_cwd $fish_color_cwd
|
||||
set color_cwd_base blue
|
||||
set suffix '>'
|
||||
end
|
||||
|
||||
# NOW we print the prompt :p
|
||||
|
||||
# PWD
|
||||
set wd (prompt_pwd)
|
||||
set_color $color_cwd
|
||||
if not [ $wd = '~' ]
|
||||
# Make basename blue just because
|
||||
echo -n (dirname $wd)'/'
|
||||
set_color $color_cwd_base
|
||||
echo -n (basename $wd)
|
||||
else
|
||||
echo -n ' ~'
|
||||
end
|
||||
set_color normal
|
||||
|
||||
printf '%s' (fish_vcs_prompt)
|
||||
|
||||
set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus)
|
||||
echo -n $pipestatus_string
|
||||
set_color normal
|
||||
|
||||
echo -n "$suffix "
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
function la --description 'List contents of directory, including hidden files in directory.'
|
||||
ls -ah $argv
|
||||
end
|
|
@ -0,0 +1,58 @@
|
|||
function pj --description "Jump to a project"
|
||||
set -l argc (count $argv)
|
||||
|
||||
if test (count $PROJECT_PATHS) -eq 0
|
||||
echo 'Add some directories to the environment variable $PROJECT_PATHS to get started!'
|
||||
echo ' set -gx PROJECT_PATHS ~/dir1 ~/dir2'
|
||||
return 1
|
||||
|
||||
else if test $argc -le 0 -o $argc -gt 2
|
||||
echo 'Usage: pj [open] [PROJECT]'
|
||||
return 1
|
||||
|
||||
else if test $argc -eq 2 -a $argv[1] != 'open'
|
||||
echo 'Usage: pj [open] [PROJECT]'
|
||||
return 1
|
||||
|
||||
else if contains -- --help $argv
|
||||
echo 'Usage: pj [open] [PROJECT]'
|
||||
|
||||
else if test $argv[1] = "open"
|
||||
set -l target (find $PROJECT_PATHS -maxdepth 1 -name $argv[2] | head -n 1)
|
||||
|
||||
if test -n "$target"
|
||||
cd $target
|
||||
eval $EDITOR $target
|
||||
else
|
||||
echo "No such project: $argv[2]"
|
||||
return 1
|
||||
end
|
||||
|
||||
else
|
||||
set -l target (find $PROJECT_PATHS -maxdepth 1 -name $argv[1] | head -n 1)
|
||||
|
||||
if test -n "$target"
|
||||
cd $target
|
||||
else
|
||||
echo "No such project: $argv[1]"
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __project_basenames --description "List of project basenames"
|
||||
set -l project_basenames
|
||||
|
||||
for pp in $PROJECT_PATHS
|
||||
set -l contains_files (ls -A $pp 2>/dev/null)
|
||||
|
||||
if test -n "$contains_files"
|
||||
set -a project_basenames (basename $pp)
|
||||
for project in (ls -d $pp/*/)
|
||||
set -a project_basenames (basename $project)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
echo $project_basenames
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
function pj --description "Go to project"
|
||||
set root "$PROJECTS_ROOT"
|
||||
if test -n root
|
||||
set root ~/projects/
|
||||
end
|
||||
if test $argv[1] = "--help" -o $argv[1] = "-h"
|
||||
echo Usage: pj project-name'[/extra/path]'
|
||||
echo
|
||||
echo Using PROJECTS_ROOT="$root"
|
||||
return
|
||||
end
|
||||
set path $root"$argv"
|
||||
if not test -d $path
|
||||
echo No such directory: $path
|
||||
return 1
|
||||
end
|
||||
cd $path
|
||||
end
|
|
@ -0,0 +1,63 @@
|
|||
# Nu #############################################
|
||||
$env.config = {
|
||||
show_banner: false
|
||||
edit_mode: vi
|
||||
cursor_shape: {
|
||||
# block, underscore, line, blink_block, blink_underscore, blink_line, inherit
|
||||
emacs: blink_line
|
||||
vi_insert: line
|
||||
vi_normal: block
|
||||
}
|
||||
color_config: {
|
||||
shape_filepath: cyan_underline
|
||||
shape_directory: green_underline
|
||||
shape_string: yellow
|
||||
shape_globpattern: cyan
|
||||
shape_flag: cyan
|
||||
|
||||
shape_externalarg: white
|
||||
shape_external: blue
|
||||
|
||||
shape_internalcall: light_cyan_bold
|
||||
shape_keyword: cyan_bold
|
||||
}
|
||||
keybindings: [
|
||||
{
|
||||
name: alt_backspace
|
||||
modifier: alt
|
||||
keycode: backspace
|
||||
mode: [emacs, vi_insert, vi_normal]
|
||||
event: { edit: backspaceword }
|
||||
}
|
||||
{
|
||||
name: alt_left
|
||||
modifier: alt
|
||||
keycode: left
|
||||
mode: [emacs, vi_insert, vi_normal]
|
||||
event: { edit: movewordleft }
|
||||
}
|
||||
{
|
||||
name: alt_right
|
||||
modifier: alt
|
||||
keycode: right
|
||||
mode: [emacs, vi_insert, vi_normal]
|
||||
event: { edit: movewordright }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
# Basics #########################################
|
||||
# Nu does not support sourcing inside blocks without creating closures.
|
||||
# https://github.com/nushell/nushell/issues/8668
|
||||
#
|
||||
# ~/.aliases.nu does not exist, I'll just have to remember to `dot gen nu`
|
||||
source ~/.aliases.nu
|
||||
|
||||
# Functions ######################################
|
||||
# Change to a project directory
|
||||
def --env pj [
|
||||
path: string # /project-dir/<project/path/here>
|
||||
]: nothing -> nothing {
|
||||
if $env.PROJECTS_ROOT == null { ~/projects/ } else { $env.PROJECTS_ROOT } | cd $"($in)/($path)"
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# Nu #############################################
|
||||
def create_left_prompt [] {
|
||||
let path_color = (if (is-admin) { ansi red } else { ansi green })
|
||||
let separator_color = (ansi white)
|
||||
|
||||
let dir = (
|
||||
if ($env.PWD != $env.HOME) {
|
||||
($env.PWD | str replace $env.HOME '~')
|
||||
} else {' ~'}
|
||||
)
|
||||
let path_segment = (
|
||||
$"($path_color)($dir)" |
|
||||
str replace -a (char path_sep) $"($separator_color)(char path_sep)($path_color)"
|
||||
)
|
||||
let last_exit_code = (
|
||||
if ($env.LAST_EXIT_CODE != 0) {
|
||||
$"(ansi rb)[($env.LAST_EXIT_CODE)](ansi reset)"
|
||||
} else { "" }
|
||||
)
|
||||
|
||||
([($path_segment) $last_exit_code (ansi reset)] | str join)
|
||||
}
|
||||
|
||||
def create_right_prompt [] {
|
||||
let time = (date now | format date '%H:%M:%S')
|
||||
$"(ansi xterm_grey35) ($env.USER)@(hostname) ($time)"
|
||||
}
|
||||
|
||||
$env.PROMPT_COMMAND = { create_left_prompt }
|
||||
$env.PROMPT_COMMAND_RIGHT = { create_right_prompt }
|
||||
|
||||
$env.PROMPT_INDICATOR = {|| "> " }
|
||||
$env.PROMPT_INDICATOR_VI_INSERT = {|| "> " }
|
||||
$env.PROMPT_INDICATOR_VI_NORMAL = {|| "= " }
|
||||
$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }
|
||||
|
||||
# Env ############################################
|
||||
# TODO: Path and envs, if/when nu is no longer run from fish
|
||||
# dotscripts/gen/nu
|
||||
# - Loop through `dotscripts/convert/addpath ' '`
|
||||
# use path add from std module to append
|
||||
# - Loop through ~/.exportenvs
|
||||
# set $env.<name>
|
||||
#
|
||||
# here
|
||||
# - source the generated files
|
|
@ -16,3 +16,9 @@ au("BufEnter", {
|
|||
pattern = "*",
|
||||
command = "set cursorline! | set cursorline!"
|
||||
})
|
||||
|
||||
vim.filetype.add {
|
||||
extension = {
|
||||
hy = "hy",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -113,6 +113,4 @@ o.wildignore = { "*.o", "*~", "*.pyc", "*/.git/*", "*/.hg/*", "*/.svn/*", "*/.DS
|
|||
|
||||
-- Not too noisy visually, but visible enough as a reminder.
|
||||
-- Underlines trailing spaces.
|
||||
-- vim.cmd [[ match Underlined '\s\+$' ]]
|
||||
--
|
||||
-- mini.trailspace FTW
|
||||
vim.cmd [[ match Underlined '\s\+$' ]]
|
||||
|
|
|
@ -86,6 +86,8 @@ return {
|
|||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
},
|
||||
-- Still need the decent (ex)C(tags) support from this one...
|
||||
{ 'preservim/tagbar' },
|
||||
-- "bling/vim-bufferline", -- I prefer this over taking over the tabline space thanks
|
||||
-- Fair well vim-bufferline! You have served my vim and nvim experience well.
|
||||
-- I've since decided to set cmdheight to 1 and put the buffers in my status
|
||||
|
@ -163,4 +165,14 @@ return {
|
|||
opts = {},
|
||||
},
|
||||
"folke/neodev.nvim",
|
||||
{ "LhKipp/nvim-nu",
|
||||
opts = {
|
||||
use_lsp_features = false,
|
||||
},
|
||||
},
|
||||
{ "stevearc/oil.nvim",
|
||||
opts = {},
|
||||
-- Optional dependencies
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
},
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ lint.linters_by_ft = {
|
|||
python = {'codespell'},
|
||||
mail = {'proselint'},
|
||||
template = {'proselint'},
|
||||
c = {'cpplint'},
|
||||
-- c = {'cpplint'},
|
||||
-- cpp = {'cpplint'},
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@ return {
|
|||
-- Neat popout window to browse dirs and manipulate within the editor!
|
||||
cmd = "MiniFiles",
|
||||
keys = { { "<leader>E", "<cmd>MiniFiles<cr>", desc = ":MiniFiles" } },
|
||||
-- Mini.files stopped working a while ago, for some reason. I've switched
|
||||
-- to oil.nvim.
|
||||
enabled = false,
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require('mini.files').setup{}
|
||||
|
@ -80,6 +83,7 @@ return {
|
|||
},
|
||||
{ "echasnovski/mini.trailspace",
|
||||
config = true,
|
||||
enabled = false, -- it doesn't seem to work, I've switched to normal `match` highlights instead
|
||||
},
|
||||
{ "echasnovski/mini.clue",
|
||||
enabled = false,
|
||||
|
|
|
@ -6,27 +6,39 @@ snippet for
|
|||
snippet read2
|
||||
int ${1:n}, ${2:m}; cin >> ${1:n} >> ${2:m};
|
||||
|
||||
snippet readvec
|
||||
snippet readv
|
||||
Vi ${1:A};
|
||||
for(int i=0; i<${2:n}; ++i) {
|
||||
int x; cin >> x;
|
||||
A.push_back(x);
|
||||
}
|
||||
|
||||
snippet FR
|
||||
snippet fr
|
||||
${1:A}.begin(), ${1:A}.end()
|
||||
|
||||
snippet pb
|
||||
push_back
|
||||
|
||||
snippet sort
|
||||
sort(${1:A}.begin(), ${1:A}.end());
|
||||
|
||||
snippet sortrev
|
||||
sort(${1:A}.begin(), ${1:A}.end(), greater<N>());
|
||||
|
||||
snippet cout
|
||||
cout << ${0:$VISUAL};
|
||||
|
||||
snippet print
|
||||
cout << ${0:$VISUAL};
|
||||
|
||||
snippet coute
|
||||
cout << ${0:$VISUAL} << endl;
|
||||
snippet cout
|
||||
cout << ${0:$VISUAL};
|
||||
|
||||
snippet cendl
|
||||
cout << endl;
|
||||
|
||||
snippet cerr
|
||||
cerr << ${0:$VISUAL};
|
||||
|
||||
snippet println
|
||||
cout << ${0:$VISUAL} << endl;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
package bass
|
||||
package pj
|
||||
package z
|
||||
theme default
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p ~/.local/senpai/
|
||||
echo "$BUFFER" '<'"$SENDER"'>' "$MESSAGE" >> ~/.local/senpai/hi
|
|
@ -0,0 +1,13 @@
|
|||
[styles.document.colors]
|
||||
background_color = [0x1e, 0x1e, 0x2e]
|
||||
text_color = [0xcd, 0xd6, 0xf4]
|
||||
link_color = [0x89, 0xb4, 0xfa]
|
||||
pre_color = [0x94, 0xe2, 0xd5]
|
||||
header1_color = [0xf5, 0xe0, 0xdc]
|
||||
header2_color = [0xf5, 0xc2, 0xe7]
|
||||
header3_color = [0xcb, 0xa6, 0xf7]
|
||||
quote_color = [0xa6, 0xe3, 0xa1]
|
||||
list_item_color = [0x74, 0xc7, 0xec]
|
||||
|
||||
[pki]
|
||||
client_certificate_path = "/Users/hedy/certkey.pem"
|
|
@ -8,4 +8,3 @@ set document.colors.image = "gray"
|
|||
# set document.browse.links.active_link.colors.background = "#83c1fc"
|
||||
# set document.browse.links.active_link.colors.background = "#444444"
|
||||
# set document.browse.links.active_link.colors.text = "white"
|
||||
set protocol.http.prefers_color_scheme = "dark"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
export EDITOR=nv
|
||||
export DOOMDIR=~/.config/doom/
|
||||
export EMACSDIR=~/.doomemacs/
|
||||
export PROJECTS_ROOT=~/projects/
|
||||
export BROWSER=w3m
|
||||
export FILEMAN=ranger
|
||||
export TERM=xterm-256color
|
||||
|
@ -31,9 +32,10 @@ export XDG_USER_CONFIG_DIR="$XDG_CONFIG_HOME"
|
|||
# Paths
|
||||
export LD_LIBRARY_PATH="$HOME/local/lib/x86_64-linux-gnu/:$HOME/local/lib:/opt/pkgsrc/opt/pkg/lib"
|
||||
export DYLD_LIBRARY_PATH="/opt/pkgsrc/opt/pkg/lib"
|
||||
export PKG_CONFIG_PATH="$HOME/local/lib/x86_64-linux-gnu/pkgconfig:$HOME/local/lib/pkgconfig"
|
||||
export PKG_CONFIG_PATH="$HOME/local/lib/x86_64-linux-gnu/pkgconfig:$HOME/local/pkgconfig:/opt/pkg/lib/pkgconfig/"
|
||||
|
||||
export NVM_DIR="$HOME/.config/nvm"
|
||||
export PNPM_HOME="$HOME/.local/share/pnpm"
|
||||
|
||||
# GPG
|
||||
export PASH_KEYID="F92200AF40D013F0"
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
pager = diff-so-fancy | less --tabs=4 -RFX
|
||||
|
||||
[user]
|
||||
name = hedy
|
||||
email = hedy@tilde.cafe # email overidden in [include]
|
||||
signingkey = B51B5A8D1B176372 # and this
|
||||
name = ~hedy
|
||||
email = hedy.dev@protonmail.com
|
||||
signingkey = B51B5A8D1B176372
|
||||
|
||||
[init]
|
||||
# I don't want people to complain and main is shorter to type so yeah
|
||||
# Well, it's shorter.
|
||||
defaultBranch = main
|
||||
|
||||
[alias]
|
||||
|
|
Binary file not shown.
12
.startup.sh
12
.startup.sh
|
@ -16,14 +16,19 @@ elif test -n "$KSH_VERSION"; then
|
|||
CURSHELL=ksh
|
||||
elif test -n "$FCEDIT"; then
|
||||
CURSHELL=ksh
|
||||
elif test -n "$NU_VERISON"; then
|
||||
CURSHELL=nu
|
||||
elif test -n "$PS3"; then
|
||||
CURSHELL=unknown
|
||||
else
|
||||
CURSHELL=sh
|
||||
fi
|
||||
|
||||
# Aliases
|
||||
source ~/.aliases
|
||||
|
||||
# Add the paths
|
||||
export PATH="$(~/bin/parse_addpath | sed 's/ /:/g'):$PATH"
|
||||
export PATH="$(~/dotscripts/convert/addpath):$PATH"
|
||||
|
||||
# Hook (the) direnv
|
||||
if ! command -v direnv &> /dev/null; then
|
||||
|
@ -36,3 +41,8 @@ fi
|
|||
# Load (the) nvm
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
[ -s "$HOME/.exportenvs" ] && \. "$HOME/.exportenvs"
|
||||
|
||||
# Pyenv
|
||||
if ! command -v pyenv &> /dev/null; then
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
s = sys.argv[1]
|
||||
else:
|
||||
s = open(0).read().strip()
|
||||
|
||||
if len(match := re.findall(f"{r'[rwx\-]'*9}", s)) == 1 and match[0] == s:
|
||||
print(sum(sum({'r':4,'w':2,'x':1,'-':0}[c]*(10**(2-n)) for c in s[3*n:3*n+3]) for n in range(3)))
|
||||
else:
|
||||
print("pipe 9-letter symbolic file mode or as first argument")
|
||||
print("chmodoctal rwxr-xr-x")
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo \
|
||||
keyserver.ubuntu.com \
|
||||
keys.openpgp.org \
|
||||
pgp.mit.edu \
|
||||
keys.gnupg.net '' \
|
||||
| xargs -n 1 -J '%' gpg --keyserver '%' --send-keys $@
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# read addpath file and return each path
|
||||
|
||||
file="$HOME/.addpath"
|
||||
paths=
|
||||
|
||||
getpaths() {
|
||||
while read line; do
|
||||
# If the path doesn't begin with / then assume it is relative to $HOME
|
||||
# Who cares if this is bashism
|
||||
if [[ ! "$line" == /* ]]; then
|
||||
line=$HOME/$line
|
||||
fi
|
||||
echo -n "$line "
|
||||
done < "$1"
|
||||
}
|
||||
|
||||
paths="$(getpaths $file)"
|
||||
if [ -f "${file}_local" ]; then
|
||||
paths="$(getpaths ${file}_local) $paths"
|
||||
fi
|
||||
paths="$HOME/bin $HOME/local/bin $paths"
|
||||
echo "$paths"
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python3
|
||||
# read addpath file and return each path
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
home = str(Path.home())
|
||||
added = {}
|
||||
|
||||
def getpaths(file: str):
|
||||
global added
|
||||
addpaths = Path(file)
|
||||
if not addpaths.exists():
|
||||
return
|
||||
|
||||
lines = addpaths.read_text(encoding="utf-8").splitlines()
|
||||
for line in lines:
|
||||
path = line.strip()
|
||||
if not path:
|
||||
continue
|
||||
if path.startswith("#"):
|
||||
continue
|
||||
if not path.startswith("/"):
|
||||
path = f"{home}/{path}"
|
||||
if not added.get(path, False):
|
||||
added[path] = True
|
||||
yield path
|
||||
|
||||
|
||||
sep = ":"
|
||||
if len(sys.argv) > 1:
|
||||
sep = sys.argv[1]
|
||||
|
||||
######
|
||||
file = f"{home}/.addpath"
|
||||
print(
|
||||
f"{home}/bin",
|
||||
f"{home}/local/bin",
|
||||
*getpaths(file),
|
||||
*getpaths(file+"_local"),
|
||||
sep=sep
|
||||
)
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
# Stubbornly translates ~/.exportenvs to ~/.exportenvs.fish
|
||||
|
||||
input=~/.exportenvs
|
||||
output="$input.fish"
|
||||
|
||||
# clear the file
|
||||
rm $output
|
||||
touch $output
|
||||
|
||||
while read fileline; do
|
||||
line=$(echo "$fileline" | sed 's/#.*//' | sed 's/export //')
|
||||
if [ -z "$line" ]; then
|
||||
continue
|
||||
fi
|
||||
tline=$(echo "$line" | sed 's/=/ /')
|
||||
echo "set -x $tline" >> $output
|
||||
done < $input
|
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# TODO: Use awk instead
|
||||
|
||||
# Stubbornly translates ~/.exportenvs to ~/.exportenvs.fish
|
||||
|
||||
echo "" > ~/.exportenvs.fish # clear the file
|
||||
|
||||
first=1
|
||||
|
||||
while read fileline; do
|
||||
if [ $first = 1 ]; then
|
||||
first=0
|
||||
continue
|
||||
fi
|
||||
line=$(echo "$fileline" | sed 's/#.*//' | sed 's/export //')
|
||||
if [ -z "$line" ]; then
|
||||
echo "Adding '$fileline' as-is"
|
||||
echo "$fileline" >> ~/.exportenvs.fish
|
||||
continue
|
||||
fi
|
||||
tline=$(echo "$line" | sed 's/=/ /')
|
||||
echo Adding "$tline"
|
||||
echo "set -x $tline" >> ~/.exportenvs.fish
|
||||
done < ~/.exportenvs
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
# Aliases
|
||||
let file = $"($env.HOME)/.aliases.nu"
|
||||
if ($"($env.HOME)/.aliases" | path exists) {
|
||||
'' | save -f $file
|
||||
for $line in (cat ~/.aliases | lines) {
|
||||
if ($line | str starts-with "alias") {
|
||||
let parts = ($line | str substring 6.. | split row '=' )
|
||||
let name = $parts.0
|
||||
mut cmd = ($parts.1 | str replace -a "'" '' | str replace -a " && " "; ")
|
||||
mut stmt = ""
|
||||
if ($cmd | str contains "; ") {
|
||||
# RHS of alias command must be a valid command. If there are
|
||||
# more commands, use a def instead.
|
||||
if ($cmd | split words | $in.0) == $name {
|
||||
$cmd = $"^($cmd)"
|
||||
}
|
||||
$stmt = $"
|
||||
# Alias of '($cmd)'
|
||||
def --env ($name) [] {
|
||||
($cmd)
|
||||
}"
|
||||
} else {
|
||||
$stmt = $"alias ($name) = ($cmd)"
|
||||
}
|
||||
$"($stmt)\n" | save -a $file
|
||||
}
|
||||
}
|
||||
}
|
|
@ -79,4 +79,16 @@ Kitty (optional)
|
|||
|
||||
END
|
||||
|
||||
cat <<END
|
||||
|
||||
todo.txt (optional)
|
||||
|
||||
cd ~/Downloads
|
||||
curl -fsSL https://github.com/todotxt/todo.txt-cli/releases/latest > todotxt.tgz
|
||||
tar xzvf todotxt.tgz
|
||||
diff todo.txt-cli*/todo.cfg ~/.config/todo/config
|
||||
rsync todo.txt-cli*/todo.sh bin/
|
||||
|
||||
END
|
||||
|
||||
echo "done!"
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo https://www.nushell.sh/book/installation.html
|
||||
echo
|
||||
echo '
|
||||
sudo cat <<END
|
||||
#!/bin/sh
|
||||
|
||||
XDG_CONFIG_HOME=~/.config /opt/homebrew/bin/nu "$@"
|
||||
END > /usr/local/bin/nu
|
||||
sudo chmod +x /usr/local/bin/nu
|
||||
'
|
||||
|
||||
echo add it to /etc/shells
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo Ensure .startup.sh is sourced, and make sure it is only sourced ONCE
|
||||
echo '(Otherwise $PATH precedence will be messed up)'
|
||||
echo
|
||||
echo Run these yourself:
|
||||
echo
|
||||
echo sudo echo "'"'[ -r "$HOME/.startup.sh" ] && . "$HOME/.startup.sh"'"'" '| tee -a /etc/profile >> /etc/bashrc'
|
||||
echo 'cat <<END
|
||||
if ! grep "startup.sh" /etc/bashrc > /dev/null; then
|
||||
source ~/.startup.sh
|
||||
fi
|
||||
END | tee -a ~/.profile >> ~/.bashrc'
|
|
@ -1,11 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# This script is meant to support both first time setup as well as refreshing
|
||||
# the ENV later on
|
||||
|
||||
PATH=~/bin:$PATH
|
||||
|
||||
setpaths() {
|
||||
fish -c 'set -Ux fish_user_paths $fish_user_paths '"$(parse_addpath)"
|
||||
}
|
||||
|
||||
if ! command -v fish &> /dev/null; then
|
||||
echo "I'm sorry but I can't help you install fish"
|
||||
echo "Please install fish before running this script lol"
|
||||
|
@ -13,17 +12,16 @@ if ! command -v fish &> /dev/null; then
|
|||
fi
|
||||
|
||||
echo "Setting up fish_user_paths..."
|
||||
fish -c 'set -Ux fish_user_paths' # clear the variable first
|
||||
setpaths
|
||||
fish -c "set -Ux fish_user_paths $(~/dotscripts/convert/addpath ' ')"
|
||||
echo "done"
|
||||
|
||||
echo Maybe add ~/local/share/man to manpath but I forgot how as of writing
|
||||
|
||||
# env
|
||||
if ! [ -f ~/.exportenvs.fish ]; then
|
||||
echo "Generating ~/.exportenvs.fish"
|
||||
~/dotscripts/gen/fish-exportenvs
|
||||
fi
|
||||
echo "Refreshing generated fish configs"
|
||||
~/dotscripts/gen/fish > /dev/null
|
||||
echo -n source ~/.exportenvs.fish | pbcopy
|
||||
echo PLEASE DO: source ~/.exportenvs.fish '(copied to clipboard)'
|
||||
|
||||
# TODO have a better check for omf existence (command -v doesnt work)
|
||||
# Although omf does this same check lol
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
print "Re-generating config files"
|
||||
~/dotscripts/gen/nu
|
||||
|
||||
print "Please reload the shell"
|
Loading…
Reference in New Issue