From 9172051b795785cf73b6a775465785af8423ee01 Mon Sep 17 00:00:00 2001 From: spinach <19keegandeppe@gmail.com> Date: Thu, 9 Mar 2023 00:18:12 -0500 Subject: [PATCH] added markdown preview and script for i3 as well as i3 startup changes --- .gitmodules | 6 ++++++ bin/markdown-preview.sh | 9 +++++++++ editors/nvim/config/lua/keymap.lua | 13 +++++++++++++ editors/nvim/config/lua/transparent.lua | 1 - editors/nvim/config/lua/tree.lua | 4 ++-- editors/nvim/site/after/ftplugin/typescript.lua | 2 ++ .../site/pack/markdown/start/markdown-preview.nvim | 1 + .../nvim/site/pack/typescript/opt/vim-typescript | 1 + gui/i3/base.conf | 8 ++++---- meta/configs/scripts.yaml | 1 + shells/zsh/zshrc | 3 ++- 11 files changed, 41 insertions(+), 8 deletions(-) create mode 100755 bin/markdown-preview.sh create mode 100644 editors/nvim/site/after/ftplugin/typescript.lua create mode 160000 editors/nvim/site/pack/markdown/start/markdown-preview.nvim create mode 160000 editors/nvim/site/pack/typescript/opt/vim-typescript diff --git a/.gitmodules b/.gitmodules index ab39d6b..bda481f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -92,3 +92,9 @@ [submodule "editors/nvim/site/pack/statusbar/start/vim-airline"] path = editors/nvim/site/pack/statusbar/start/vim-airline url = https://github.com/vim-airline/vim-airline.git +[submodule "editors/nvim/site/pack/typescript/opt/vim-typescript"] + path = editors/nvim/site/pack/typescript/opt/vim-typescript + url = https://github.com/leafgarland/typescript-vim.git +[submodule "editors/nvim/site/pack/markdown/start/markdown-preview.nvim"] + path = editors/nvim/site/pack/markdown/start/markdown-preview.nvim + url = https://github.com/iamcco/markdown-preview.nvim.git diff --git a/bin/markdown-preview.sh b/bin/markdown-preview.sh new file mode 100755 index 0000000..aad7464 --- /dev/null +++ b/bin/markdown-preview.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [ -n "$1" ] ; then + URL="$1" +fi + +i3-msg "workspace 1; exec brave --new-window $URL" +sleep 0.3 +i3-msg "[class=st-256color] focus" diff --git a/editors/nvim/config/lua/keymap.lua b/editors/nvim/config/lua/keymap.lua index f3f86c5..c33647f 100644 --- a/editors/nvim/config/lua/keymap.lua +++ b/editors/nvim/config/lua/keymap.lua @@ -18,3 +18,16 @@ function spellToggle() vim.o.spell = true end end + +-- markdown preview + +vim.keymap.set("n", "p", ":MarkdownPreviewToggle") + +-- custom shell script to move windows +vim.cmd([[ + function OpenMarkdownPreview (url) + execute "silent ! markdown-preview.sh " . a:url + endfunction +]]) + +vim.g.mkdp_browserfunc = 'OpenMarkdownPreview' diff --git a/editors/nvim/config/lua/transparent.lua b/editors/nvim/config/lua/transparent.lua index a691ebe..d4ef570 100644 --- a/editors/nvim/config/lua/transparent.lua +++ b/editors/nvim/config/lua/transparent.lua @@ -1,4 +1,3 @@ - function toggleTransparent() transparent = not transparent if transparent then diff --git a/editors/nvim/config/lua/tree.lua b/editors/nvim/config/lua/tree.lua index f562094..85e6479 100644 --- a/editors/nvim/config/lua/tree.lua +++ b/editors/nvim/config/lua/tree.lua @@ -1,4 +1,5 @@ require('nvim-tree').setup({ + open_on_tab = false, filters = { dotfiles = true, }, @@ -8,6 +9,7 @@ require('nvim-tree').setup({ }, }, }) + showHiddenFiles = false local function open_nvim_tree(data) @@ -16,7 +18,6 @@ local function open_nvim_tree(data) local directory = vim.fn.isdirectory(data.file) == 1 local empty_file = data.file == "" - print(empty_file) if not directory and not empty_file then return @@ -24,7 +25,6 @@ local function open_nvim_tree(data) if directory then vim.cmd.cd(data.file) - end vim.cmd.enew() vim.cmd.bw(data.buf) diff --git a/editors/nvim/site/after/ftplugin/typescript.lua b/editors/nvim/site/after/ftplugin/typescript.lua new file mode 100644 index 0000000..5fff3c0 --- /dev/null +++ b/editors/nvim/site/after/ftplugin/typescript.lua @@ -0,0 +1,2 @@ +-- adding packages +vim.cmd('packadd vim-typescript') diff --git a/editors/nvim/site/pack/markdown/start/markdown-preview.nvim b/editors/nvim/site/pack/markdown/start/markdown-preview.nvim new file mode 160000 index 0000000..02cc387 --- /dev/null +++ b/editors/nvim/site/pack/markdown/start/markdown-preview.nvim @@ -0,0 +1 @@ +Subproject commit 02cc3874738bc0f86e4b91f09b8a0ac88aef8e96 diff --git a/editors/nvim/site/pack/typescript/opt/vim-typescript b/editors/nvim/site/pack/typescript/opt/vim-typescript new file mode 160000 index 0000000..52f3ca3 --- /dev/null +++ b/editors/nvim/site/pack/typescript/opt/vim-typescript @@ -0,0 +1 @@ +Subproject commit 52f3ca3474d51f5021696ffb7297d989e49121ac diff --git a/gui/i3/base.conf b/gui/i3/base.conf index 581e95c..b742192 100644 --- a/gui/i3/base.conf +++ b/gui/i3/base.conf @@ -21,11 +21,11 @@ exec --no-startup-id dex --autostart --environment i3 exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock-blur --nofork # auto starting default applications -assign [class="st-256color"] 1 -assign [class="Brave-browser"] 2 +# assign [class="st-256color"] 1 +# assign [title="startup-browser"] 2 -exec --no-startup-id st -e tmux -exec --no-startup-id brave +exec --no-startup-id i3-msg "workspace 1; exec st -e tmux" +exec --no-startup-id i3-msg "workspace 2; exec brave" # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status diff --git a/meta/configs/scripts.yaml b/meta/configs/scripts.yaml index 691b8af..9422c89 100644 --- a/meta/configs/scripts.yaml +++ b/meta/configs/scripts.yaml @@ -11,6 +11,7 @@ ~/.local/bin/i3-scratchpad.sh: bin/i3-scratchpad.sh ~/.local/bin/todo_display.sh: bin/todo_display.sh ~/.local/bin/display_uptime: bin/display_uptime + ~/.local/bin/markdown-preview.sh: bin/markdown-preview.sh ~/.local/bin/docker_check: bin/docker_check ~/.local/bin/seafile_check: bin/seafile_check ~/.local/bin/watertracker: src/watertracker/watertracker diff --git a/shells/zsh/zshrc b/shells/zsh/zshrc index defd3a5..97ee9ed 100644 --- a/shells/zsh/zshrc +++ b/shells/zsh/zshrc @@ -126,6 +126,8 @@ source $ZSH/oh-my-zsh.sh # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" # +# switching to vimrc +alias vim="nvim" # helpful aliasis alias ifconfig="/sbin/ifconfig" # git stuff @@ -156,7 +158,6 @@ export FZF_DEFAULT_OPTS='--layout=reverse --border' #alias bat="batcat" Only needed on ubuntu/debian - # vim wiki alias alias vimwiki="nvim $HOME/vimwiki/index.md"