From 3fcb57d09076a2fc1ba483802efee4a9aeaae07f Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Fri, 6 Oct 2023 17:47:32 -0400 Subject: [PATCH] Adds mhlink script, which still needs some work and updates to nvim config, which fixes tmux-navigator mappings --- nvim/m-housh/init.lua | 3 +++ nvim/m-housh/lazy-lock.json | 4 +-- nvim/m-housh/lua/user/mappings.lua | 11 ++++---- scripts/scripts/mhlink | 43 ++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 7 deletions(-) create mode 100755 scripts/scripts/mhlink diff --git a/nvim/m-housh/init.lua b/nvim/m-housh/init.lua index a1f8e4b..fa4aedf 100644 --- a/nvim/m-housh/init.lua +++ b/nvim/m-housh/init.lua @@ -1,3 +1,6 @@ +-- Leader needs to be set before loading plugins +vim.g.mapleader = " " +vim.g.maplocalleader = " " -- Common settings require('user.settings') diff --git a/nvim/m-housh/lazy-lock.json b/nvim/m-housh/lazy-lock.json index 1460e93..e6f3260 100644 --- a/nvim/m-housh/lazy-lock.json +++ b/nvim/m-housh/lazy-lock.json @@ -1,6 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "2c3a3a3e4fb503bf39efb61290ecfa8aae95f5eb" }, + "LuaSnip": { "branch": "master", "commit": "cdbf6f41381e5ee4810b4b09284b603d8f18365d" }, "bufdelete.nvim": { "branch": "master", "commit": "07d1f8ba79dec59d42b975a4df1c732b2e4e37b4" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-calc": { "branch": "main", "commit": "ce91d14d2e7a8b3f6ad86d85e34d41c1ae6268d9" }, @@ -14,7 +14,7 @@ "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, "go.nvim": { "branch": "master", "commit": "54387e506e597ab65a89baa1681429728f66ed71" }, "guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" }, - "lazy.nvim": { "branch": "main", "commit": "6b6f0a451200bb6abde85978c577c73ea1577758" }, + "lazy.nvim": { "branch": "main", "commit": "6687afae42b72fb660bfae2bd0eb98e77156829b" }, "lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" }, "lsp_signature.nvim": { "branch": "master", "commit": "bdf3dc7bb03edd25c2173e0e31c2fb122052ed23" }, "lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, diff --git a/nvim/m-housh/lua/user/mappings.lua b/nvim/m-housh/lua/user/mappings.lua index 7c66841..2805931 100644 --- a/nvim/m-housh/lua/user/mappings.lua +++ b/nvim/m-housh/lua/user/mappings.lua @@ -15,10 +15,10 @@ keymap('i', '', ':wa', default_options) keymap("v", "p", "\"_dP", default_options) -- buffer focus -keymap('n', '', 'j', default_options) -keymap('n', '', 'h', default_options) -keymap('n', '', 'k', default_options) -keymap('n', '', 'l', default_options) +-- keymap('n', '', 'j', default_options) +-- keymap('n', '', 'h', default_options) +-- keymap('n', '', 'k', default_options) +-- keymap('n', '', 'l', default_options) -- Resizing panes keymap("n", "", ":vertical resize +1", default_options) @@ -79,7 +79,8 @@ end, default_options) -- Find zsh config files. keymap('n', 'fz', function() telescope.find_files({ - cwd='$HOME/.dotfiles/zsh/config' + cwd = '$HOME/.dotfiles/zsh/config', + hidden = true }) end, default_options) diff --git a/scripts/scripts/mhlink b/scripts/scripts/mhlink new file mode 100755 index 0000000..b1ff31a --- /dev/null +++ b/scripts/scripts/mhlink @@ -0,0 +1,43 @@ +#!/usr/bin/env zsh + +root= +localOpt= + +zparseopts -- \ + {l,-local}=localOpt + +if [ -d "$HOME/projects/github.com/m-housh/mhoush.com" ]; then + root="$HOME/projects/github.com/m-housh/mhoush.com" +else + root="$HOME/projects/mhoush.com" +fi + +postsPath="$root/content/posts" + +# Abort early if the post path does not exist. +[ ! -d $postsPath ] \ + && echo "Could not find posts directory" \ + && exit 1 + +posts=$(find "$postsPath" -mindepth 1 -maxdepth 1 -type d -print0 | \ + xargs -0 stat -f"%m %Sm %N" | \ + sort -rn +) + +choice=$(echo "$posts" | fzf) + +[ -z $choice ] \ + && echo "No selection made." \ + && exit 1 + +# Delete everything before the last / +choice="${choice##*/}" + +prefix="https://mhoush.com" + +if [ -n "$localOpt" ]; then + prefix="http://localhost:1313" +fi + +echo "$prefix/$choice/" +