From 835432435f4cbe962e4f598b083e87827a169d0c Mon Sep 17 00:00:00 2001 From: pika Date: Sun, 27 Oct 2024 11:35:35 +0100 Subject: [PATCH] addet snippets for scissors --- .gitignore | 2 -- lua/pika/core/options.lua | 3 ++- snippets/lua.json | 1 + snippets/package.json | 1 + snippets/sh.json | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 snippets/lua.json create mode 100644 snippets/package.json create mode 100644 snippets/sh.json diff --git a/.gitignore b/.gitignore index 420f64f..55d79fe 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,3 @@ lazy-lock.json cd-project.nvim.json - -snippets/ diff --git a/lua/pika/core/options.lua b/lua/pika/core/options.lua index 6f258b0..76e7b5c 100644 --- a/lua/pika/core/options.lua +++ b/lua/pika/core/options.lua @@ -75,7 +75,8 @@ vim.cmd([[ if vim.g.neovide then -- vim.g.neovide_transparency = 0.35 vim.g.neovide_transparency = 1 - vim.g.neovide_theme = "auto" + vim.g.neovide_theme = "dark" vim.g.neovide_refresh_rate = 90 vim.g.neovide_cursor_vfx_mode = "torpedo" + vim.g.neovide_cursor_smooth_blink = true end diff --git a/snippets/lua.json b/snippets/lua.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/snippets/lua.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/snippets/package.json b/snippets/package.json new file mode 100644 index 0000000..6a471a1 --- /dev/null +++ b/snippets/package.json @@ -0,0 +1 @@ +{"contributes":{"snippets":[{"language":["sh"],"path":".\/sh.json"},{"language":["lua"],"path":".\/lua.json"}]},"name":"my-snippets","description":"This package.json has been generated by nvim-scissors."} \ No newline at end of file diff --git a/snippets/sh.json b/snippets/sh.json new file mode 100644 index 0000000..00285f9 --- /dev/null +++ b/snippets/sh.json @@ -0,0 +1 @@ +{"command_exists":{"prefix":"command_exists","body":["# ─< Check if the given command exists silently >─────────────────────────────────────────","command_exists() {"," command -v \"\\$@\" >\/dev\/null 2>&1","}"]},"posix echo essentials + echos":{"body":["# ─< ANSI color codes >───────────────────────────────────────────────────────────────────","RED='\\033[0;31m'","CYAN='\\033[0;36m'","YELLOW='\\033[0;33m'","LIGHT_GREEN='\\033[0;92m'","BOLD='\\033[1m'","NC='\\033[0m' # No Color","","echo_error() {"," printf \"\\${BOLD}\\${RED}ERROR: \\${NC}\\${RED}%s\\${NC}\\n\" \"\\$1\" >&2","}","","echo_info() {"," printf \"\\${BOLD}\\${CYAN}INFO: \\${NC}\\${CYAN}%s\\${NC}\\n\" \"\\$1\"","}","","echo_warning() {"," printf \"\\${BOLD}\\${YELLOW}WARNING: \\${NC}\\${YELLOW}%s\\${NC}\\n\" \"\\$1\"","}","","echo_note() {"," printf \"\\${BOLD}\\${LIGHT_GREEN}NOTE: \\${NC}\\${LIGHT_GREEN}%s\\${NC}\\n\" \"\\$1\"","}"],"prefix":["posix echo essentials","echos"]},"posix logging essentials + logging":{"body":["# ─< ANSI color codes >───────────────────────────────────────────────────────────────────","RED='\\033[0;31m'","CYAN='\\033[0;36m'","YELLOW='\\033[0;33m'","LIGHT_GREEN='\\033[0;92m'","BOLD='\\033[1m'","NC='\\033[0m'","","# ─< Initialize storage variables >───────────────────────────────────────────────────────","_STORED_ERRORS=\"\"","_STORED_WARNINGS=\"\"","_STORED_INFOS=\"\"","_STORED_NOTES=\"\"","","# ─< echo functions that store and display messages >────────────────────────────","echo_error() {"," local message=\"\\${RED}\\$1\\${NC}\\n\""," printf \"\\$message\" >&2"," _STORED_ERRORS=\"\\${_STORED_ERRORS}\\${message}\"","}","","echo_warning() {"," local message=\"\\${YELLOW}\\$1\\${NC}\\n\""," printf \"\\$message\""," _STORED_WARNINGS=\"\\${_STORED_WARNINGS}\\${message}\"","}","","echo_info() {"," local message=\"\\${CYAN}\\$1\\${NC}\\n\""," printf \"\\$message\""," _STORED_INFOS=\"\\${_STORED_INFOS}\\${message}\"","}","","echo_note() {"," local message=\"\\${LIGHT_GREEN}\\$1\\${NC}\\n\""," printf \"\\$message\""," _STORED_NOTES=\"\\${_STORED_NOTES}\\${message}\"","}","","# ─< Improved display function that only shows categories with content >──────────────────","display_stored_messages() {"," local has_messages=0",""," # ─< First check if we have any messages at all >─────────────────────────────────────────"," if [ -z \"\\$_STORED_ERRORS\" ] && [ -z \"\\$_STORED_WARNINGS\" ] && [ -z \"\\$_STORED_INFOS\" ] && [ -z \"\\$_STORED_NOTES\" ]; then"," return 0"," fi",""," # ─< Now display each non-empty category with proper spacing >────────────────────────────"," if [ -n \"\\$_STORED_ERRORS\" ]; then"," printf \"\\n\\${BOLD}\\${RED}=== Errors ===\\${NC}\\n\""," printf \"\\$_STORED_ERRORS\""," has_messages=1"," fi",""," if [ -n \"\\$_STORED_WARNINGS\" ]; then"," [ \"\\$has_messages\" -eq 1 ] && printf \"\\n\""," printf \"\\${BOLD}\\${YELLOW}=== Warnings ===\\${NC}\\n\""," printf \"\\$_STORED_WARNINGS\""," has_messages=1"," fi",""," if [ -n \"\\$_STORED_INFOS\" ]; then"," [ \"\\$has_messages\" -eq 1 ] && printf \"\\n\""," printf \"\\${BOLD}\\${CYAN}=== Info ===\\${NC}\\n\""," printf \"\\$_STORED_INFOS\""," has_messages=1"," fi",""," if [ -n \"\\$_STORED_NOTES\" ]; then"," [ \"\\$has_messages\" -eq 1 ] && printf \"\\n\""," printf \"\\${BOLD}\\${LIGHT_GREEN}=== Notes ===\\${NC}\\n\""," printf \"\\$_STORED_NOTES\""," fi","}"],"prefix":["posix logging essentials","logging"]},"posix check_root + cr":{"prefix":["posix check_root","cr"],"body":["# ─< Check if the user is root and set sudo variable if necessary >───────────────────────","check_root() {"," if [ \"\\$(id -u)\" -ne 0 ]; then"," if command_exists sudo; then"," echo_binfo \"User is not root. Using sudo for privileged operations.\""," _sudo=\"sudo\""," else"," echo_error \"No sudo found and you're not root! Can't install packages.\""," return 1"," fi"," else"," echo_binfo \"Root access confirmed.\""," _sudo=\"\""," fi","}"]},"posix packager detection + get_packager":{"prefix":["posix packager detection","get_packager"],"body":["# ─< Distribution detection and installation >────────────────────────────────────────","get_packager() {"," if [ -e \/etc\/os-release ]; then"," echo_info \"Detecting distribution...\""," . \/etc\/os-release",""," # ─< Convert \\$ID and \\$ID_LIKE to lowercase >──────────────────────────────────────────────"," ID=\\$(printf \"%s\" \"\\$ID\" | tr '[:upper:]' '[:lower:]')"," ID_LIKE=\\$(printf \"%s\" \"\\$ID_LIKE\" | tr '[:upper:]' '[:lower:]')",""," case \"\\$ID\" in"," ubuntu | pop) inst_ubuntu ;;"," debian) inst_debian ;;"," fedora) inst_fedora ;;"," alpine) inst_alpine ;;"," arch | manjaro | garuda | endeavour) inst_arch ;;"," opensuse*) inst_opensuse ;;"," *)"," if [ \"\\${ID_LIKE#*debian}\" != \"\\$ID_LIKE\" ]; then"," inst_debian"," elif [ \"\\${ID_LIKE#*ubuntu}\" != \"\\$ID_LIKE\" ]; then"," inst_ubuntu"," elif [ \"\\${ID_LIKE#*arch}\" != \"\\$ID_LIKE\" ]; then"," inst_arch"," elif [ \"\\${ID_LIKE#*fedora}\" != \"\\$ID_LIKE\" ]; then"," inst_fedora"," elif [ \"\\${ID_LIKE#*suse}\" != \"\\$ID_LIKE\" ]; then"," inst_opensuse"," else"," echo_error \"Unsupported distribution: \\$ID\""," exit 1"," fi"," ;;"," esac"," else"," echo_error \"Unable to detect distribution. \/etc\/os-release not found.\""," exit 1"," fi","}"]}} \ No newline at end of file