From fa207989f928c0975b234f99a8c1c6607759c807 Mon Sep 17 00:00:00 2001 From: CramMK Date: Tue, 9 Jun 2020 14:11:37 +0200 Subject: [PATCH] Add some pdf ncie to haves in vim and scripts --- .gitmodules | 3 +++ config.yaml | 11 ++++++++++- dotfiles/i3/config | 2 +- dotfiles/scripts/open-pdf | 11 +++++++++++ dotfiles/scripts/pandoc-comp | 23 +++++++++++++++++++++++ dotfiles/scripts/randomwallpaper | 1 + dotfiles/vim/vimrc | 8 ++++++-- 7 files changed, 55 insertions(+), 4 deletions(-) create mode 100755 dotfiles/scripts/open-pdf create mode 100755 dotfiles/scripts/pandoc-comp create mode 160000 dotfiles/scripts/randomwallpaper diff --git a/.gitmodules b/.gitmodules index 4f4e193..86a1231 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "dotfiles/zsh/ohmyzsh"] path = dotfiles/zsh/ohmyzsh url = https://github.com/ohmyzsh/ohmyzsh +[submodule "dotfiles/scripts/randomwallpaper"] + path = dotfiles/scripts/randomwallpaper + url = https://github.com/CramMK/randomwallpaper diff --git a/config.yaml b/config.yaml index f558f95..70c3660 100644 --- a/config.yaml +++ b/config.yaml @@ -6,7 +6,7 @@ actions: font-cache: fc-cache -f -v xresources-reload: xrdb ~/.Xresources config: - backup: true + backup: false create: true dotpath: dotfiles dotfiles: @@ -78,6 +78,9 @@ dotfiles: f_dir_colors: src: dir_colors/dir_colors dst: ~/.dir_colors + d_scripts: + src: scripts + dst: ~/scripts profiles: laptop: @@ -96,6 +99,7 @@ profiles: - neofetch - ranger - dir_colors + - scripts sub-win: include: - zsh @@ -104,6 +108,7 @@ profiles: - ranger - neofetch - dir_colors + - scripts work: include: - zsh @@ -114,6 +119,7 @@ profiles: - compton - tmux - dir_colors + - scripts dev: include: - vim @@ -171,3 +177,6 @@ profiles: dir_colors: dotfiles: - f_dir_colors + scripts: + dotfiles: + - d_scripts diff --git a/dotfiles/i3/config b/dotfiles/i3/config index 7d9e327..0843aec 100644 --- a/dotfiles/i3/config +++ b/dotfiles/i3/config @@ -58,7 +58,7 @@ bindsym $mod+space exec "rofi -show" bindsym $mod+c exec "rofi -show ssh" # dmenu -bindsym $mod+d exec "dmenu_run -fn 'InconsolataLGC Nerd Font Mono' -nb '#2E3440' -sb '#2E3440' -nf '#ECEFF4' -sf '#A3BE8C' -p 'ﰌ' -l 3" +bindsym $mod+d exec "dmenu_run -fn 'InconsolataLGC Nerd Font Mono' -nb '#2E3440' -sb '#2E3440' -nf '#ECEFF4' -sf '#A3BE8C' -p 'ﰌ'" # change focus bindsym $mod+h focus left diff --git a/dotfiles/scripts/open-pdf b/dotfiles/scripts/open-pdf new file mode 100755 index 0000000..b8429d4 --- /dev/null +++ b/dotfiles/scripts/open-pdf @@ -0,0 +1,11 @@ +#!/bin/sh +# opout: "open output": A general handler for opening a file's intended output. +# I find this useful especially running from vim. +# Stolen from BrodieRobertson + +basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" + +case "$1" in + *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid zathura "$basename".pdf >/dev/null 2>&1 & ;; + *.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;; +esac diff --git a/dotfiles/scripts/pandoc-comp b/dotfiles/scripts/pandoc-comp new file mode 100755 index 0000000..daa541f --- /dev/null +++ b/dotfiles/scripts/pandoc-comp @@ -0,0 +1,23 @@ +#!/bin/sh +# General handler for compiling files +# stolen from BrodieRobertson + +file=$(readlink -f "$1") +base=$(echo "$file" | sed 's/\..*//') + +handlebang() { + bang=$(head -n 1 "$file") + case "$bang" in + *!/bin/sh|*!/bin/bash|*!/bin/zsh) "$file" ;; + *!/bin/perl) perl "$file" ;; + *!/bin/python) python "$file" ;; + *) echo "Can't compile" ;; + esac +} + +case "$1" in + *.md) pandoc "$file" -o "$base".pdf ;; + *.py) python "$file" ;; + *.perl) perl "$file" ;; + *) handlebang ;; +esac diff --git a/dotfiles/scripts/randomwallpaper b/dotfiles/scripts/randomwallpaper new file mode 160000 index 0000000..0a973ca --- /dev/null +++ b/dotfiles/scripts/randomwallpaper @@ -0,0 +1 @@ +Subproject commit 0a973cafe8b64ee24f59813569c313ba96ee3ae1 diff --git a/dotfiles/vim/vimrc b/dotfiles/vim/vimrc index c1724e2..cfd2bc6 100644 --- a/dotfiles/vim/vimrc +++ b/dotfiles/vim/vimrc @@ -31,7 +31,7 @@ let g:pear_tree_pairs = { \ '"': {'closer': '"'}, \ '<': {'closer': '>'} \ } -" + " Vimwiki let g:vimwiki_list = [{'path': '~/vimwiki/', \ 'syntax': 'markdown', 'ext': '.md'}] @@ -98,7 +98,6 @@ set foldmethod=indent map :Ex let g:netrw_winsize = 25 -let g:netrw_browse_split = 4 " open in previous window let g:netrw_liststyle = 3 " Tree-like structure let g:netrw_banner = 0 " Remove useless banner at the top of netrw @@ -113,3 +112,8 @@ if has("autocmd") au BufReadPost * if line("' f\"") > 0 && line("'\"") <= line("$") \| exe "normal! g'\"" | endif endif + +" ------------------------------------- Pandoc --------------------------------- +map c :w! \| !~/scripts/pandoc-comp % +map o :!~/scripts/open-pdf % +