diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..855920c --- /dev/null +++ b/.gitignore @@ -0,0 +1,99 @@ +# ---- KDE Neon ---- +# KDE directory preferences +.directory + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# ---- macOS ---- +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# ---- IDE ---- +# Vim Artifacts +**.swp +lazy-lock.json +.luarc.json + +# VS Code Artifacts +/.vscode/ +**state.vscdb +**state.vscdb.backup +.vscode/extensions/** # Ignore all Files under .vscode/extensions/ +!.vscode/extensions/**/*.json # Only json files inside the .vscode/extensions/ folder + +# Intellij IDE Artifacts +.idea/ +*.imi +*.jar +*.tar +resharper-host/ +tasks/ + +# ---- Programming Languages ---- +# Ignore all downloaded node modules +node_modules/* +dist +dist-ssr +*.local +# Ignore all minified js files +*.min.js + +# Log files +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +# Other Files to ignore +**app_stat_v2.db +.ssh/*.pub +**/Package Control.cache +**Cache +*.db +*.qmlc +*.qml +*.jsc +**/contents/images +**/contents/fonts +*kpluginindex.json diff --git a/10x_generic_programming.sh b/10x_generic_programming.sh new file mode 100644 index 0000000..f13c72a --- /dev/null +++ b/10x_generic_programming.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +url_encode(){ + python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.stdin.read()))" <<< "$1" +} + +alias gicp="cp ~/.gitignore ." diff --git a/10x_nvim.sh b/10x_nvim.sh new file mode 100644 index 0000000..c4ace3f --- /dev/null +++ b/10x_nvim.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Nvim Distro-Switcher +alias nvim-lazy="NVIM_APPNAME=nvim-lazy nvim" +alias OldConfig="NVIM_APPNAME=oldconfig nvim" +nvims() { + items=$(find -L "$HOME"/.config -maxdepth 2 -name "init.lua" -type f -execdir sh -c 'pwd | xargs basename' \;) + config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config  " --height=~50% --layout=reverse --border --exit-0) + if [ -z "$config" ]; then + echo "Nothing selected" + return 0 + elif [ "$config" = "default" ]; then + config="" + fi + NVIM_APPNAME=$config nvim "$@" +} + diff --git a/10x_project_access.sh b/10x_project_access.sh old mode 100644 new mode 100755 index 174b04c..98f5270 --- a/10x_project_access.sh +++ b/10x_project_access.sh @@ -1,5 +1,9 @@ #!/bin/sh +# TODO: Alias to quickly add my template .gitignore file to any location +# - Create fuzzy finder for cht.sh & tldr +# - Move all dev prod scripts to its own project + op() { local chosen_project chosen_project="$(find -L ~/Code -mindepth 2 -maxdepth 2 -not -path '*/.*' -printf "%T@ %p\n" | sort -nr | cut -d ' ' -f 2- | fzf --prompt='Select a project: ')" @@ -23,23 +27,24 @@ pnew(){ fi local project_name - if [ -n "$1" ]; then - project_name="$1" - else - project_name=$(find -L "$directory" -mindepth 1 -maxdepth 1 -not -path '*/.*' -type d | fzf --print-query -e +i --prompt='Project name (AVOID EXISTING ONES BELOW): ' | head -1) - fi - if [ -z "$project_name" ]; then - echo "You did not chose a project name!!!" - return 1 - fi + # Until user provides a good directory name or cancels out + while [ -d "$directory/$project_name" ]; do + if [ -n "$1" ]; then + project_name="$1" + else + project_name=$(find -L "$directory" -mindepth 1 -maxdepth 1 -not -path '*/.*' -type d | fzf --print-query -e +i --prompt='Project name (AVOID EXISTING ONES BELOW): ' | head -1) + fi - if [ -d "$directory/$project_name" ]; then - echo "$directory/$project_name project already exists" - echo "Try again" - return 1 - # TODO: Should allow to reenter the name - fi + if [ -z "$project_name" ]; then + echo "Cancelling..." + return 0 + fi + + if [ -d "$directory/$project_name" ]; then + echo "'$directory/$project_name' already exists" + fi + done [ -d "$directory/$project_name" ] || mkdir -p "$directory/$project_name" || return diff --git a/Readme.md b/README.MD similarity index 79% rename from Readme.md rename to README.MD index a28e399..5f51921 100644 --- a/Readme.md +++ b/README.MD @@ -10,3 +10,7 @@ - Keep them as portable as possible 1. Across all *nic OS 2. Across sh, bash, zsh + +## Todo + +- [ ] Make a bootstrap file that symlinks new files to $XDG_CONFIG_HOME/shell/ diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..6d79969 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ -z "$XDG_CONFIG_HOME" ]; then + echo "Config directory (shell variable XDG_CONFIG_HOME) not setup in the computer" + return 1 +fi + +[ -d "$XDG_CONFIG_HOME/shell/" ] || mkdir "$XDG_CONFIG_HOME/shell/" || return + +for x_10 in "$PWD"/10x*.sh; do + ln -sf "$x_10" "$XDG_CONFIG_HOME/shell/" +done