summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGilles Castel <gilles@castel.dev>2019-06-22 13:21:14 +0200
committerGilles Castel <gilles@castel.dev>2019-06-22 13:21:14 +0200
commit3250d9d9b745eb70438ec340e00511f820cdcf32 (patch)
tree0706e6e18db49394d768915c6aaac13aa34d796b /examples
parentd6342e2bbab143835a77de8e8cb2c4c7ac4da473 (diff)
Explain minimal-vimrc and window positioning
Diffstat (limited to 'examples')
-rw-r--r--examples/config.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/config.py b/examples/config.py
index fa062fc..4e25ca3 100644
--- a/examples/config.py
+++ b/examples/config.py
@@ -1,6 +1,46 @@
import subprocess
+
def open_editor(filename):
+ # I created a .minimal-tex-vimrc, a vim config file that only includes stuff
+ # relevant to LaTeX. This way, the popup opens instantly. Some of the
+ # noteworthy commands include:
+ #
+ # set ft=tex
+ # " Quickly closing the window by jamming wq
+ # inoremap wq <Esc>:wq<CR>
+ # nnoremap wq :wq<CR>
+ # inoremap qw <Esc>:wq<CR>
+ # nnoremap qw :wq<CR>
+ #
+ # " Start insert mode between $$'s
+ # autocmd BufEnter * startinsert | call cursor(1, 2)
+ #
+ # nnoremap j gj
+ # nnoremap k gk
+ #
+ # I load this config using the -u flag.
+
+ # I position the window by adding a name to the terminal window. As I'm using
+ # bspwm, adding the following:
+ #
+ # #! /bin/bash
+ #
+ # wid=$1
+ # class=$2
+ # instance=$3
+ #
+ #
+ # if [ "$instance" = "popup-bottom-center" ]; then
+ # echo "state=floating"
+ # read W H <<< $(xdotool getdisplaygeometry)
+ # eval "$(xdotool getwindowgeometry --shell $wid )"
+ # xdotool windowmove $wid $(($W / 2 - $WIDTH / 2)) $(($H - $HEIGHT))
+ # fi
+ #
+ # to ~/.config/bspwm/external_rules makes all windows with the
+ # popup-bottom-center name floating and centered at the bottom of my screen.
+
subprocess.run([
'urxvt',
'-fn', 'xft:Iosevka Term:pixelsize=24',
@@ -11,6 +51,7 @@ def open_editor(filename):
f"{filename}",
])
+
def latex_document(latex):
return r"""
\documentclass[12pt,border=12pt]{standalone}