diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-11-19 16:30:21 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-11-19 16:30:21 +0100 |
commit | ac82416ba14d4cfc2f47ab1d607501bfd899781f (patch) | |
tree | ac0ecd986284f5ae73b413143739281b9f8577bd /config/essentials | |
parent | ff3a8bb2d62f5a7e1759eb3d9e0834f4396e833d (diff) | |
parent | 822f8dbf4db697c7a2bfbd675374bfaa7080ce82 (diff) |
Merge branch 'main' of /var/git/dotfiles
Diffstat (limited to 'config/essentials')
-rw-r--r-- | config/essentials/nvim/after/plugin/colorizer.lua.disabled (renamed from config/essentials/nvim/after/plugin/colorizer.lua) | 0 | ||||
-rw-r--r-- | config/essentials/nvim/after/plugin/luasnip.lua | 324 | ||||
-rw-r--r-- | config/essentials/nvim/after/plugin/plantuml.lua | 10 | ||||
-rw-r--r-- | config/essentials/nvim/after/plugin/telescope.lua | 1 | ||||
-rw-r--r-- | config/essentials/nvim/after/plugin/treesitter.lua | 11 | ||||
-rw-r--r-- | config/essentials/nvim/lua/user/cmp/html.lua | 5 | ||||
-rw-r--r-- | config/essentials/nvim/lua/user/init.lua | 1 | ||||
-rw-r--r-- | config/essentials/nvim/lua/user/lazy.lua | 98 | ||||
-rw-r--r-- | config/essentials/nvim/lua/user/packer.lua | 30 | ||||
-rw-r--r-- | config/essentials/nvim/lua/user/remap.lua | 9 | ||||
-rw-r--r-- | config/essentials/nvim/lua/user/treesitter.lua | 17 | ||||
-rw-r--r-- | config/essentials/nvim/lua/user/zk.lua | 5 | ||||
-rw-r--r-- | config/essentials/zsh/.zshrc | 49 | ||||
-rw-r--r-- | config/essentials/zsh/aliases.sh | 60 | ||||
-rw-r--r-- | config/essentials/zsh/functions.zsh | 32 |
15 files changed, 431 insertions, 221 deletions
diff --git a/config/essentials/nvim/after/plugin/colorizer.lua b/config/essentials/nvim/after/plugin/colorizer.lua.disabled index 6ca374f..6ca374f 100644 --- a/config/essentials/nvim/after/plugin/colorizer.lua +++ b/config/essentials/nvim/after/plugin/colorizer.lua.disabled diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua index 319a68c..9119264 100644 --- a/config/essentials/nvim/after/plugin/luasnip.lua +++ b/config/essentials/nvim/after/plugin/luasnip.lua @@ -29,33 +29,33 @@ vim.keymap.set({"i", "s"}, "<C-k>", "<Plug>luasnip-expand-or-jump", { noremap = vim.keymap.set({"i", "s"}, "<C-j>", "<Plug>luasnip-jump-prev", { noremap = true }) vim.keymap.set({"i", "s"}, "<C-l>", "<Plug>luasnip-next-choice", { noremap = true }) vim.keymap.set("n", "<leader><leader>s", function() - ls.cleanup() - vim.cmd("source ~/.config/nvim/after/plugin/luasnip.lua") - print("snippets reloaded.") + ls.cleanup() + vim.cmd("source ~/.config/nvim/after/plugin/luasnip.lua") + print("snippets reloaded.") end, { noremap = true }) ls.add_snippets("lua", { - -- print - s("pt", fmt("print({}){}", { i(1, "\"Hello World!\"") , i(0) })), - -- local function - parse("lf", "local $1 = function($2)\n\t$3\nend$0", {}), - -- require - s("lrq", fmt("local {} = require('{}')", { i(1), rep(1) })), - parse("rq", "require('$1')$0", {}), - parse("rqs", "require('$1').setup {\n\t$2\n}$0", {}), - parse("use", "use('$1')$0", {}), - -- function - s("fn", fmt( - [[ - function {}({}) - {} - end{} - ]], - { i(1), i(2), i(3), i(0) })), - parse("sn", "s(\"$1\", fmt(\n[[\n$2\n]],\n{ $3 })),$0", {}), + -- print + s("pt", fmt("print({}){}", { i(1, "\"Hello World!\"") , i(0) })), + -- local function + parse("lf", "local $1 = function($2)\n\t$3\nend$0", {}), + -- require + s("lrq", fmt("local {} = require('{}')", { i(1), rep(1) })), + parse("rq", "require('$1')$0", {}), + parse("rqs", "require('$1').setup {\n\t$2\n}$0", {}), + parse("use", "use('$1')$0", {}), + -- function + parse("fn", + [[ + function $1($2) + end$0 + ]], {}), + parse("sn", "s(\"$1\", fmt(\n[[\n$2\n]],\n{ $3 })),$0", {}), }) -ls.add_snippets("html", { +local languages = {'php', 'html'} +for language = 1,#languages do +ls.add_snippets(languages[language], { s("<!DOCTYPE>", fmt( [[ <!DOCTYPE html> @@ -64,166 +64,166 @@ ls.add_snippets("html", { <meta charset="UTF-8"> <meta name="viewport" content="width-device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> - <title>{}</title>{} + <title>{}</title> </head> <body> <h1>{}</h1>{} </body> </html> ]], - {i(1, "title"), i(2), i(3, "Header"), i(0)})), - s("sty", fmt( + {i(1, "title"), rep(1), i(0)})), + parse("sty", [[ - <link rel="stylesheet" type="text/css" href="{}">{} - ]], - { i(1), i(0) })), + <link rel="stylesheet" type="text/css" href="$1">$0 + ]], {}), }) +end ls.add_snippets("java", { - -- function - s("fn", fmt( - [[ - {}{} {}({}) - {{ - {} - }} - ]], - { - c(1, {t "public ", t "private ", t ""}), - i(2, "type"), - i(3, "f"), - i(4), i(0) - })), - -- setter function - s("psv", fmt( - [[ - public class Main - {{ - public static void main (String[] args) - {{ - {} - }} - }} - ]], - { i(0) })), - -- constructor - s("class", fmt( - [[ - {}class {} - {{ - {} - }}{} - ]], - { c(1, {t "public ", t "private ", t ""}), i(2), i(3), i(0)})), - -- StringBuilder - s("sb", fmt( - [[ - public void print() - {{ - StringBuilder sb = new StringBuilder(30); - sb.append({}); - sb.append(", ").append({});{} - System.out.print(sb.toString()); - }}{} - ]], - { i(1), i(2), i(3), i(0)})), - -- print - parse("pt", "System.out.println($1);$0", {}), - parse("pti", "System.out.println(\"$1: \" + $1);$0", {}), - -- quickies - s("pr", t "private "), - s("ob", fmt( - [[ - {} {} = new {}({}); - {} - ]], - { i(1), i(2), rep(1), i(3), i(0) })), - parse("abs", "Math.abs($1);$0", {}), + -- function + s("fn", fmt( + [[ + {}{} {}({}) + {{ + {} + }} + ]], + { + c(1, {t "public ", t "private ", t ""}), + i(2, "type"), + i(3, "f"), + i(4), i(0) + })), + -- setter function + s("psv", fmt( + [[ + public class Main + {{ + public static void main (String[] args) + {{ + {} + }} + }} + ]], + { i(0) })), + -- constructor + s("class", fmt( + [[ + {}class {} + {{ + {} + }}{} + ]], + { c(1, {t "public ", t "private ", t ""}), i(2), i(3), i(0)})), + -- StringBuilder + s("sb", fmt( + [[ + public void print() + {{ + StringBuilder sb = new StringBuilder(30); + sb.append({}); + sb.append(", ").append({});{} + System.out.print(sb.toString()); + }}{} + ]], + { i(1), i(2), i(3), i(0)})), + -- print + parse("pt", "System.out.println($1);$0", {}), + parse("pti", "System.out.println(\"$1: \" + $1);$0", {}), + -- quickies + s("pr", t "private "), + s("ob", fmt( + [[ + {} {} = new {}({}); + {} + ]], + { i(1), i(2), rep(1), i(3), i(0) })), + parse("abs", "Math.abs($1);$0", {}), }) ls.add_snippets("sh", { - s("TD", t "THISDIR=\"$(dirname \"$(readlink -f \"$0\")\")\""), - parse("pf", ">&2 printf '$1\\n'$0", {}), - parse("fn", "$1 ()\n{\n\t$2\n}$0", {}), - -- Functions - parse("rchar", - [[ - read_char () - { - old_stty_cfg=$(stty -g) - stty raw -echo - dd ibs=1 count=1 2> /dev/null - stty \$old_stty_cfg - } - ]], {}), - parse("fdie", - [[ - die () { >&2 printf '%s\n' "\$@"; exit 1; } - ]], {}), - parse("flogn", - [[ - logn () { >&2 printf '%s\n' "\$@"; } - ]], {}), - parse("flog", - [[ - log () { >&2 printf '%s' "\$@"; } - ]], {}), - s("inp", fmt( - [[ - test -z "${{{}:=$1}}" && - {}="$(cat /dev/stdin)" - echo "{}: ${}" 1>&2{} - ]], - { i(1), rep(1), rep(1), rep(1), i(0) })), + s("TD", t "THISDIR=\"$(dirname \"$(readlink -f \"$0\")\")\""), + parse("pf", ">&2 printf '$1\\n'$0", {}), + parse("fn", "$1 ()\n{\n\t$2\n}$0", {}), + -- Functions + parse("rchar", + [[ + read_char () + { + old_stty_cfg=$(stty -g) + stty raw -echo + dd ibs=1 count=1 2> /dev/null + stty \$old_stty_cfg + } + ]], {}), + parse("fdie", + [[ + die () { >&2 printf '%s\n' "\$@"; exit 1; } + ]], {}), + parse("flogn", + [[ + logn () { >&2 printf '%s\n' "\$@"; } + ]], {}), + parse("flog", + [[ + log () { >&2 printf '%s' "\$@"; } + ]], {}), + s("inp", fmt( + [[ + test -z "${{{}:=$1}}" && + {}="$(cat /dev/stdin)" + echo "{}: ${}" 1>&2{} + ]], + { i(1), rep(1), rep(1), rep(1), i(0) })), }) ls.add_snippets("javascript", { - -- print - s("pt", fmt("console.log({});{}", { i(1, "\"Hello World!\"") , i(0) })), - s("rq", fmt("const {} = require('{}');", { i(1), rep(1) })), - s("dbconn", fmt( - [[ - let conn = null; - try {{ - conn = await dbConnect();{} - conn.end() - }} catch(err) {{ - console.error('Error:', err); - }} - ]], - { i(0) })), - s("apr", fmt( - [[ - app.get('{}', (req, res) => {{ - {} - }});{} - ]], - { i(1), i(2, "res.send(\"Hello world!\")"), i(0) })), - s("cerr", t "console.error('Error:', err);"), - s("gel", fmt( - [[ - let {} = document.getElementById('{}');{} - ]], - { i(1), rep(1), i(0) })), + -- print + s("pt", fmt("console.log({});{}", { i(1, "\"Hello World!\"") , i(0) })), + s("rq", fmt("const {} = require('{}');", { i(1), rep(1) })), + s("dbconn", fmt( + [[ + let conn = null; + try {{ + conn = await dbConnect();{} + conn.end() + }} catch(err) {{ + console.error('Error:', err); + }} + ]], + { i(0) })), + s("apr", fmt( + [[ + app.get('{}', (req, res) => {{ + {} + }});{} + ]], + { i(1), i(2, "res.send(\"Hello world!\")"), i(0) })), + s("cerr", t "console.error('Error:', err);"), + s("gel", fmt( + [[ + let {} = document.getElementById('{}');{} + ]], + { i(1), rep(1), i(0) })), }) ls.add_snippets("cs", { - parse("cw", "Console.WriteLine($1);$0"), + parse("cw", "Console.WriteLine($1);$0"), }) ls.add_snippets("telekasten", { - --link - parse("ln", "[[$0]]", {}), - s("cln", fmt( - [[ - [{}]({}){} - ]], - { - i(1), - f(function () - return vim.fn.getreg('+') - end), - i(0) - } - )), + --link + parse("ln", "[[$0]]", {}), + s("cln", fmt( + [[ + [{}]({}){} + ]], + { + i(1), + f(function () + return vim.fn.getreg('+') + end), + i(0) + } + )), }) diff --git a/config/essentials/nvim/after/plugin/plantuml.lua b/config/essentials/nvim/after/plugin/plantuml.lua new file mode 100644 index 0000000..da14862 --- /dev/null +++ b/config/essentials/nvim/after/plugin/plantuml.lua @@ -0,0 +1,10 @@ +require('plantuml').setup +{ + renderer = { + type = 'text', + options = { + split_cmd = 'split', -- Allowed values: `split`, `vsplit`. + } + }, + render_on_write = true, -- Set to false to disable auto-rendering. +} diff --git a/config/essentials/nvim/after/plugin/telescope.lua b/config/essentials/nvim/after/plugin/telescope.lua index 06c5a03..7a2ef34 100644 --- a/config/essentials/nvim/after/plugin/telescope.lua +++ b/config/essentials/nvim/after/plugin/telescope.lua @@ -1,4 +1,3 @@ -require('telescope').load_extension('fzf') require('telescope').load_extension('media_files') require('telescope').setup({ diff --git a/config/essentials/nvim/after/plugin/treesitter.lua b/config/essentials/nvim/after/plugin/treesitter.lua deleted file mode 100644 index e18368e..0000000 --- a/config/essentials/nvim/after/plugin/treesitter.lua +++ /dev/null @@ -1,11 +0,0 @@ -require'nvim-treesitter.configs'.setup { - ensure_installed = { "c", "lua", "vim", "diff"}, - - sync_install = false, - auto_install = true, - - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - } -} diff --git a/config/essentials/nvim/lua/user/cmp/html.lua b/config/essentials/nvim/lua/user/cmp/html.lua index 69ed29d..d3c99df 100644 --- a/config/essentials/nvim/lua/user/cmp/html.lua +++ b/config/essentials/nvim/lua/user/cmp/html.lua @@ -2,6 +2,7 @@ local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true -require'lspconfig'.html.setup { - capabilities = capabilities, +require 'lspconfig'.html.setup { + capabilities = capabilities, + filetypes = { "html", "php" }, } diff --git a/config/essentials/nvim/lua/user/init.lua b/config/essentials/nvim/lua/user/init.lua index 2f29b87..972cb67 100644 --- a/config/essentials/nvim/lua/user/init.lua +++ b/config/essentials/nvim/lua/user/init.lua @@ -1,5 +1,6 @@ require("user.packer") require("user.remap") +require("user.treesitter") require("user.set") require("user.cmp") require("user.zk") diff --git a/config/essentials/nvim/lua/user/lazy.lua b/config/essentials/nvim/lua/user/lazy.lua new file mode 100644 index 0000000..5c3148c --- /dev/null +++ b/config/essentials/nvim/lua/user/lazy.lua @@ -0,0 +1,98 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + -- Example using a list of specs with the default options + "folke/which-key.nvim", + + -- telescope + { + 'nvim-telescope/telescope.nvim', + tag = '0.1.4', + dependencies = { 'nvim-lua/plenary.nvim' } + }, + "nvim-telescope/telescope-ui-select.nvim", + "nvim-telescope/telescope-media-files.nvim", + + "nvim-telescope/telescope-symbols.nvim", + "theprimeagen/harpoon", + + -- colors + "shaunsingh/nord.nvim", + { 'uZer/pywal16.nvim', name = 'pywal16' }, + "norcalli/nvim-colorizer.lua", + + { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, + "nvim-treesitter/playground", + + -- syntax + "sheerun/vim-polyglot", + "theRealCarneiro/hyprland-vim-syntax", + + "mbbill/undotree", + + "tpope/vim-capslock", + "tpope/vim-commentary", + -- "tpope/vim-endwise", + "tpope/vim-fugitive", + "lewis6991/gitsigns.nvim", + "tpope/vim-repeat", + "tpope/vim-surround", + "tpope/vim-vinegar", + "m4xshen/autoclose.nvim", + + "christoomey/vim-tmux-navigator", + + -- utils + "godlygeek/tabular", + "renerocksai/calendar-vim", + "ojroques/vim-oscyank", + "potamides/pantran.nvim", + "alx741/vinfo", + + -- "github/copilot.vim", + -- + { + 'https://gitlab.com/itaranto/plantuml.nvim', + config = function() require('plantuml').setup() end + }, + + -- objects + "michaeljsmith/vim-indent-object", + + -- completion + "neovim/nvim-lspconfig", + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-nvim-lsp-signature-help", + "alvan/vim-closetag", + + -- debugging + "mfussenegger/nvim-dap", + { "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap" } }, + + -- java + "mfussenegger/nvim-jdtls", + + -- snippets + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + + -- notes + "renerocksai/telekasten.nvim", + +}) diff --git a/config/essentials/nvim/lua/user/packer.lua b/config/essentials/nvim/lua/user/packer.lua index 36f9ec0..edb763d 100644 --- a/config/essentials/nvim/lua/user/packer.lua +++ b/config/essentials/nvim/lua/user/packer.lua @@ -4,11 +4,11 @@ return require('packer').startup(function(use) -- files use { 'nvim-telescope/telescope.nvim', tag = '0.1.2', - requires = { {'nvim-lua/plenary.nvim'} } + requires = { { 'nvim-lua/plenary.nvim' } } } - use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } - use {'nvim-telescope/telescope-ui-select.nvim' } - use {'nvim-telescope/telescope-media-files.nvim'} + use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use { 'nvim-telescope/telescope-ui-select.nvim' } + use { 'nvim-telescope/telescope-media-files.nvim' } use('nvim-telescope/telescope-symbols.nvim') use('theprimeagen/harpoon') @@ -18,20 +18,11 @@ return require('packer').startup(function(use) use { 'uZer/pywal16.nvim', as = 'pywal16' } use('norcalli/nvim-colorizer.lua') - use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) + use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) use('nvim-treesitter/playground') use('theRealCarneiro/hyprland-vim-syntax') use('mbbill/undotree') - use { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - requires = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - } - } use('tpope/vim-capslock') use('tpope/vim-commentary') @@ -48,10 +39,17 @@ return require('packer').startup(function(use) -- utils use('godlygeek/tabular') use('renerocksai/calendar-vim') - use('ojroques/vim-oscyank', {branch = "main"}) + use('ojroques/vim-oscyank', { branch = "main" }) use("potamides/pantran.nvim") use('alx741/vinfo') + -- use('sheerun/vim-polyglot') TODO: fix error conflicting with telekasten -- use('github/copilot.vim') + -- + use { + 'https://gitlab.com/itaranto/plantuml.nvim', + tag = '*', + config = function() require('plantuml').setup() end + } -- objects use('michaeljsmith/vim-indent-object') @@ -69,7 +67,7 @@ return require('packer').startup(function(use) -- debugging use('mfussenegger/nvim-dap') - use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } + use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } } -- java use('mfussenegger/nvim-jdtls') diff --git a/config/essentials/nvim/lua/user/remap.lua b/config/essentials/nvim/lua/user/remap.lua index fadca21..0c3d9a6 100644 --- a/config/essentials/nvim/lua/user/remap.lua +++ b/config/essentials/nvim/lua/user/remap.lua @@ -54,9 +54,14 @@ end, { noremap = true }) -- utils vim.keymap.set("i", "<LocalLeader>r", "<cmd>r!echo -n $RANDOM<cr><esc>kJA", { noremap = true }) + +-- FORMATTING -- ordered list vim.keymap.set("n", "<LocalLeader>n", "<C-v>I0. <esc>gvg<C-a>", { noremap = true }) vim.keymap.set("v", "<Leader>u", "<cmd>'<,'>s/^[0-9]\\+\\. //<cr><esc>", { noremap = true }) +-- table +vim.keymap.set("v", "<LocalLeader>t", "!column -t -s '|' -o '|'<cr>", { noremap = true }) + -- scripts vim.keymap.set("n", "<Leader>x", "<cmd>!chmod +x %<cr>", { noremap = true, silent = true}) -- replace @@ -73,8 +78,8 @@ vim.keymap.set("n", "<LocalLeader>s", function () print("sourced.") end, { noremap = true }) --- Packer -vim.keymap.set("n", "<Leader>P", "<cmd>PackerSync<cr>", { noremap = true }) +-- Lazy +vim.keymap.set("n", "<Leader>P", "<cmd>Lazy<cr>", { noremap = true }) -- spelling vim.keymap.set("n", "<C-s>s", "<cmd>setlocal spell!<cr>", { noremap = true }) diff --git a/config/essentials/nvim/lua/user/treesitter.lua b/config/essentials/nvim/lua/user/treesitter.lua new file mode 100644 index 0000000..2355215 --- /dev/null +++ b/config/essentials/nvim/lua/user/treesitter.lua @@ -0,0 +1,17 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + indent = { enable = on }, + + highlight = { enable = true, }, + + additional_vim_regex_highlighting = false, +} diff --git a/config/essentials/nvim/lua/user/zk.lua b/config/essentials/nvim/lua/user/zk.lua index 98476ca..3641025 100644 --- a/config/essentials/nvim/lua/user/zk.lua +++ b/config/essentials/nvim/lua/user/zk.lua @@ -41,6 +41,11 @@ require("telekasten").setup({ media_previewer = "telescope-media-files", follow_url_fallback = nil, vaults = { + Ideas = { + home = home .. "/" .. "Ideas", + template_new_note = home .. "/" .. "templates/new_note.md", + new_note_filename = "title", + }, Driving = { home = home .. "/" .. "Driving", template_new_note = home .. "/" .. "templates/new_note.md", diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 76ff87f..c590d54 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -15,13 +15,56 @@ autoload -U select-word-style autoload -z edit-command-line zle -N edit-command-line zstyle ':compinstall' filename '/home/aluc/.zshrc' + +### Completion +# cache +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path "$ZDOTDIR/zcompcache" + +# completers +zstyle ':completion:*' completer _extensions _complete + +# format +zstyle ':completion:*:*:*:*:descriptions' format '%F{blue}-- %D%d --%f' +zstyle ':completion:*:*:*:*:messages' format '%F{purple}-- %d --%f' +zstyle ':completion:*:*:*:*:warnings' format '%F{red}-- no matches found --%f' +zstyle ':completion:*:default' list-prompt '%S%M matches%s' +# show a 'ls -a' like outptut when listing files +zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS} + +# Group completions by categories +zstyle ':completion:*' group-name '' +zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands + +zstyle ':completion:*' squeeze-slashes true + +# Prefer completing for an option (think cd -) +zstyle ':completion:*' complete-options true + +# keep prefix when completing +zstyle ':completion:*' keep-prefix true + +# ui zstyle ':completion:*' menu select -autoload -Uz compinit +# Move around using h j k l in completion menu +zmodload zsh/complist +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect '^xg' clear-screen +# interactive mode +bindkey -M menuselect '^xi' vi-insert +bindkey -M menuselect '^xh' accept-and-hold # Hold +bindkey -M menuselect '^xn' accept-and-infer-next-history # Next +bindkey -M menuselect '^xu' undo # Undo + +autoload -Uz compinit; compinit + autoload -Uz surround zle -N delete-surround surround zle -N add-surround surround zle -N change-surround surround -compinit # Source files . $ZDOTDIR/functions.zsh @@ -110,7 +153,7 @@ command_not_found_handler () { } # prompt -PS1=' %B%(#.%F{1}.%F{13})[%n%b%f@%B%F{6}%m]%b%f %3~ ' +PS1=' %B%(#.%F{1}.%F{13})%n%b%f@%B%F{6}%m%b%f %3~ ' RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)' setopt prompt_subst diff --git a/config/essentials/zsh/aliases.sh b/config/essentials/zsh/aliases.sh index e9c7e2f..3d23cf4 100644 --- a/config/essentials/zsh/aliases.sh +++ b/config/essentials/zsh/aliases.sh @@ -17,18 +17,13 @@ then alias calc='bc <<<' - if [ "$WAYLAND_DISPLAY" ] - then - alias -g clipp='wl-copy -n' - alias -g clipo='wl-paste -n' - else + if [ -z "$WAYLAND_DISPLAY" ] + then if which devour > /dev/null 2>&1 then alias mpv='devour mpv' alias zathura='devour zathura' fi - alias -g clipp='xclip -selection clipboard -r' - alias -g clipo='xclip -o -selection clipboard -r' fi alias clipic='clipo > /tmp/pic.png' @@ -174,9 +169,7 @@ alias ch='chown ${USER}:${USER} -R' alias kll='killall' alias pi='ping 9.9.9.9 -c4' alias sba='source env/bin/activate || source bin/activate' -alias smc='systemctl' -alias dsmc='doas systemctl' -alias smcu='smc --user' + alias zsr='source ${ZDOTDIR:-~}/.zshrc && rehash' alias rh='rehash' alias wf='doas wipefs -a' @@ -187,9 +180,40 @@ alias gdate='date +%y_%m_%d-%T' alias tpid='tail -f /dev/null --pid' alias pwdcp='pwd | clipp' alias gw="grep -ri" -alias srcsupd='echo ~/src/{installdrier,dotfiles,password-store} | supd' -alias nextdeadline='sed -n "/$(grep '\''^#'\'' ~/docs/filios/deadlines | sort -t '\''/'\'' -k 3 -k 2 -k 1 -n | head -n 1 | sed '\''s@/@.@g'\'')/,/^#\|^$/p" ~/docs/filios/deadlines | head -n -1' +alias srcsupd='echo ~/src/{installdrier,dotfiles,password-store} ~/.config/emacs | supd' +# systemctl aliases +alias smc='systemctl' +alias smcs='systemctl status' +alias smcst='systemctl start' +alias smcS='systemctl stop' +alias smcr='systemctl restart' +alias smcrl='systemctl reload' +alias smcd='systemctl daemon-reload' +alias smce='systemctl edit' +alias smcen='systemctl enable' +#user +alias smcu='systemctl --user' +alias smcus='systemctl --user status' +alias smcust='systemctl --user start' +alias smcuS='systemctl --user stop' +alias smcur='systemctl --user restart' +alias smcurl='systemctl --user reload' +alias smcud='systemctl --user daemon-reload' +alias smcue='systemctl --user edit' +alias smcuen='systemctl --user enable' +#doas +alias dsmc='doas systemctl' +alias dsmcs='doas systemctl status' +alias dsmcst='doas systemctl start' +alias dsmcS='doas systemctl stop' +alias dsmcr='doas systemctl restart' +alias dsmcrl='doas systemctl reload' +alias dsmcd='doas systemctl daemon-reload' +alias dsmce='doas systemctl edit' +alias dsmcen='doas systemctl enable' + +# virtualbox aliases alias vbm='vboxmanage' alias vbls='vbm list vms' alias vblsr='vbm list runningvms' @@ -244,21 +268,27 @@ alias czo='cd ~/zot/' alias cdpw='cd ${PASSWORD_STORE_DIR:-~/.password-store}' alias cdng='cd /etc/nginx' alias cdrs='cd /srv/' +alias cdv='cd ~/vids' alias god='cd "$(find . -mindepth 1 -maxdepth 1 -type d | fzf)"' +alias gov='go ~/vids d' # fzf aliases alias ppj='cd ~/proj/personal/"$(find ~/proj/personal -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | fzf)"' alias ppjs='cd ~/proj/personal/scripts/"$(find ~/proj/personal/scripts -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | fzf)"' alias scr='edit_in_dir ~/proj/personal/scripts/' alias fil='edit_in_dir ~/docs/filios/' -alias cfg='edit_in_dir ~/src/dotfiles' alias fzps='ps aux | tail +2 | fzf | tee /dev/stderr | awk '\''{print $2}'\'' | clipp' alias asf='alias | fzf' alias fzh="tac $HISTFILE | fzf | tee /dev/stderr | clipp" alias ffwin='hyprctl clients -j | jq '\''.[].pid'\'' | fzf --preview "hyprctl clients -j | jq '\''.[] | select(.pid == {}) | {class, title, workspace, xwayland}'\''"' alias pff='find ${PASSWORD_STORE_DIR:=~/src/password-store/} -name "*.gpg" | sed -e "s@$PASSWORD_STORE_DIR/@@" -e '\''s/\.gpg$//'\'' | fzf | xargs pass show -c' alias fzps='fzf --print0 | xargs -0I{}' -alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s - %(title)s.%(ext)s"' +alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s/%(title)s.%(ext)s"' + +# emacs aliases +alias emacsd='emacs --daemon' +alias emacsdbg='emacs --debug-init' +alias e='emacsclient -c -a "emacs"' # docker aliases alias dcb='docker build' @@ -279,6 +309,7 @@ alias dbsmu='rsync -aPz db:/media/basilisk/music/ /media/kilimanjaro/music' # oh-my-zsh git aliases alias config='GIT_WORK_TREE=~/src/dotfiles/ GIT_DIR=~/src/dotfiles/.git' +alias cfg='$EDITOR ~/src/dotfiles/"$(config git ls-files | fzf || exit)"' alias gmod='git status --short | sed '\''/^\s*M/!d;s/^\s*M\s*//'\'' | fzf | xargs $EDITOR' alias g='git' alias ga='git add' @@ -318,6 +349,7 @@ alias gcasm='git commit --all --signoff --message' alias gcb='git checkout -b' alias gcf='git config --list' alias gcl='git clone' +alias gclc='git clone "$(clipo)"' alias gclr='git clone --recurse-submodules' alias gc1='git clone --depth 1' alias gclean='git clean --interactive -d' diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 9783794..8bf6c43 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -242,10 +242,17 @@ pacsize() mime-default () { - logn "Setting '$1' as default for its mimetypes" - grep "MimeType=" /usr/share/applications/"$1".desktop | + local mime + [ "${mime:=$1}" ] || + mime="$(find /usr/share/applications/ -iname '*.desktop' -printf '%f\n' | + sed 's/\.desktop$//' | + fzf)" + + logn "Setting '$mime' as default for its mimetypes" + [ "$mime" ] || exit 1 + grep "MimeType=" /usr/share/applications/"$mime".desktop | cut -d '=' -f 2- | tr ';' '\0' | - xargs -0I{} xdg-mime default "$1".desktop "{}" + xargs -0I{} xdg-mime default "$mime".desktop "{}" logn "Done." } @@ -270,13 +277,13 @@ fpass() { muttmail() { - log "email set: " - ls $HOME/.config/mutt/configs | - fzf | - tee /dev/stderr | - xargs -I {} ln -sf "$HOME/.config/mutt/configs/{}" $HOME/.config/mutt/muttrc - log 'Press [Enter to login]' - read && mutt + local config + local mail + config="$HOME/.config/mutt" + mail="$(find "$config"/configs -type f -printf '%f\n' | fzf)" + [ "$mail" ] || return 1 + ln -sf "$config/configs/$mail" "$config"/muttrc + mutt } resize() @@ -292,3 +299,8 @@ edit_in_dir() { [ -f "$file" ] || return 1 $EDITOR "$file" } + +to_webm() +{ + ffmpeg -y -i "$1" -vcodec libvpx -cpu-used -12 -deadline realtime "${1%.*}".webm +} |