Add bin directory and spacemacs for PDF and latex

This commit is contained in:
Stochastica 2021-01-21 23:19:25 -05:00
parent 80259d0d08
commit 0a7e75655e
7 changed files with 601 additions and 523 deletions

View File

@ -27,8 +27,11 @@ The `latex` docker contains tools for compiling `latex`.
The `route` docker is used to setup a socks5 proxy server using `ssh`.
## Scripts
## Bin
The `scr/` folder contains dockerised scripts:
* `ipython.sh`: Dockerised IPython via `hub-jupyter` for syntax highlighting
and IDE support
The `bin/` folder contains dockerised scripts. They should be symlinked into
`/usr/local/bin` via `symlinks-bin.sh`, which has to be executed as root.
## Spacemacs
After setting up dependencies, execute `M-x pdf-tools-install`.

10
bin/latex-runtime.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
docker run --rm -it \
--volume "$PWD:/data" \
--volume "$HOME/.latexmkrc:/data/ro" \
--volume "$HOME/texmf:/root/texmf" \
--workdir "/data" \
--entrypoint=$1 \
latex \
${@:2}

3
bin/latexmk Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
latex-runtime.sh latexmk $@

3
bin/pdflatex Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
latex-runtime.sh pdflatex $@

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash
docker run --rm -it \
--entrypoint=ipython \
--entrypoint=python \
hub-jupyter \
-i --simple-prompt
$@
# -i --simple-prompt

View File

@ -2,6 +2,7 @@
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
@ -32,44 +33,56 @@ This function should only modify configuration layer settings."
;; List of configuration layers to load.
dotspacemacs-configuration-layers
'(yaml
shell-scripts
;; ----------------------------------------------------------------
'(;; ----------------------------------------------------------------
;; Example of useful layers you may want to use right away.
;; Uncomment some layer names and press `SPC f e R' (Vim style) or
;; `M-m f e R' (Emacs style) to install them.
;; ----------------------------------------------------------------
;; auto-completion
;; better-defaults
emacs-lisp
;; git
helm
;; lsp
;; markdown
lsp
multiple-cursors
;; org
;; (shell :variables
;; shell-default-height 30
;; shell-default-position 'bottom)
(shell :variables
shell-default-height 30
shell-default-position 'bottom)
;; spell-checking
;; syntax-checking
;; version-control
syntax-checking
treemacs
tabs
bibtex
git
latex
markdown
(ocaml :variables
ocaml-format-on-save t
)
python
neotree
tabs
pdf
;; Systems and interfaces
docker
git
version-control
unicode-fonts
;; Language support
emacs-lisp
bibtex
(latex :variables
latex-enable-folding t
latex-enable-auto-fill t
latex-enable-magic t)
markdown
yaml
shell-scripts
(python :variables
python-shell-interpreter "/home/hsv/common/scr/python.sh"
python-shell-interpreter-args "-m IPython --simple-prompt -i")
(ocaml :variables
ocaml-format-on-save t)
(c-c++ :variables
c-c++-adopt-subprojects t
c-c++-backend 'lsp-clangd
c-c++-lsp-enable-semantic-highlight 'rainbow)
javascript
typescript
html
)
@ -81,7 +94,11 @@ This function should only modify configuration layer settings."
;; `dotspacemacs/user-config'. To use a local version of a package, use the
;; `:location' property: '(your-package :location "~/path/to/your-package/")
;; Also include the dependencies as they will not be resolved automatically.
dotspacemacs-additional-packages '()
dotspacemacs-additional-packages
'(
smart-tabs-mode
tablist
)
;; A list of packages that cannot be updated.
dotspacemacs-frozen-packages '()
@ -521,7 +538,8 @@ This function is called immediately after `dotspacemacs/init', before layer
configuration.
It is mostly for variables that should be set before packages are loaded.
If you are unsure, try setting them in `dotspacemacs/user-config' first."
(setq python-shell-interpreter "/home/hsv/common/scr/ipython.sh")
(add-to-list 'TeX-view-program-selection '(output-pdf "Emacs"))
(add-to-list 'TeX-view-program-list '("Emacs" "emacsclient -n %o"))
)
(defun dotspacemacs/user-load ()
@ -529,6 +547,8 @@ If you are unsure, try setting them in `dotspacemacs/user-config' first."
This function is called only while dumping Spacemacs configuration. You can
`require' or `load' the libraries of your choice that will be included in the
dump."
(setq pdf-sync-backward-display-action t)
(setq pdf-sync-forward-display-action t)
)
(defun dotspacemacs/user-config ()
@ -537,27 +557,53 @@ This function is called at the very end of Spacemacs startup, after layer
configuration.
Put your configuration code here, except for variables that should be set
before packages are loaded."
;; Key Bindings
(global-set-key (kbd "<next>") 'centaur-tabs-forward)
(global-set-key (kbd "<prior>") 'centaur-tabs-backward)
(evil-ex-define-cmd "q" 'kill-this-buffer)
(evil-ex-define-cmd "quit" 'evil-quit)
;; Displaying whitespaces
(spacemacs/toggle-whitespace-globally-on)
(setq whitespace-display-mappings
;; all numbers are Unicode codepoint in decimal. ⁖ (insert-char 182 1)
'(
(space-mark 32 [183] [46]) ; 32 SPACE 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
(newline-mark 10 [182 10]) ; 10 LINE FEED
(tab-mark 9 [172 9] [92 9]) ; 9 TAB, 172 Not Sign「¬
(newline-mark 10 [172 10]) ; 10 LINE FEED, 172 Not Sign「¬」
(tab-mark 9 [10141 9] [92 9]) ; 9 TAB, 10141 Triangle-headed rightwards arrow 「➝
))
(set-face-attribute 'whitespace-space nil
:background nil
:foreground "gray30")
(set-face-attribute 'whitespace-space-after-tab nil
:background nil
:foreground "gray30")
(set-face-attribute 'whitespace-tab nil
:background nil
:foreground "gray30")
(set-face-attribute 'whitespace-newline nil
:background nil
:foreground "gray30")
(spacemacs/toggle-transparency)
;; Auto save upon defocus
(add-hook 'focus-out-hook
(defun save-current-buffer-if-needed ()
(interactive)
(when (and (buffer-file-name) (buffer-modified-p))
(save-buffer))))
;; Mixed indent mode (in conjunction with smart-tabs-mode)
(setq evil-indent-convert-tabs nil)
(setq-default indent-tabs-mode t)
(setq-default tab-width 2)
(setq c-default-style "stroustrup")
(setq c-basic-offset 2)
(setq css-indent-offset 2)
(smart-tabs-insinuate 'c 'c++ 'java 'javascript)
(add-hook 'prog-mode-hook #'origami-mode)
)
;; Do not write anything past this comment. This is where Emacs will
@ -575,7 +621,7 @@ This function is called at the very end of Spacemacs initialization."
'(evil-want-Y-yank-to-eol nil)
'(helm-completion-style 'emacs)
'(package-selected-packages
'(centaur-tabs yaml-mode yasnippet-snippets lsp-ui lsp-python-ms lsp-pyright lsp-origami origami lsp-latex helm-lsp helm-company helm-c-yasnippet fuzzy flycheck-ycmd flycheck-rtags flycheck-pos-tip pos-tip flycheck-ocaml dap-mode lsp-treemacs bui treemacs cfrs pfuture posframe company-ycmd company-rtags company-reftex company-math company-c-headers company-auctex company-anaconda ccls lsp-mode ht dash-functional auto-yasnippet yasnippet ac-ispell auto-complete neotree insert-shebang helm-gtags ggtags flycheck-bashate fish-mode counsel-gtags counsel swiper company-shell company ycmd request-deferred yapfify sphinx-doc pytest pyenv-mode py-isort poetry pippel pipenv pyvenv pip-requirements org-ref pdf-tools key-chord ivy htmlize tablist mmm-mode math-symbol-lists markdown-toc live-py-mode importmagic epc ctable concurrent deferred helm-rtags rtags helm-pydoc helm-bibtex bibtex-completion biblio parsebib biblio-core google-c-style gh-md disaster cython-mode cpp-auto-include blacken auctex anaconda-mode pythonic utop tuareg caml treemacs-magit smeargle ocp-indent ocamlformat merlin-eldoc merlin magit-svn magit-section magit-gitflow magit-popup helm-gitignore helm-git-grep gitignore-templates gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link forge markdown-mode ghub closql emacsql-sqlite emacsql treepy evil-magit magit git-commit with-editor transient dune ws-butler writeroom-mode winum which-key volatile-highlights vi-tilde-fringe uuidgen use-package undo-tree treemacs-projectile treemacs-persp treemacs-icons-dired treemacs-evil toc-org symon symbol-overlay string-inflection spaceline-all-the-icons restart-emacs request rainbow-delimiters popwin pcre2el password-generator paradox overseer org-superstar open-junk-file nameless move-text macrostep lorem-ipsum link-hint indent-guide hybrid-mode hungry-delete hl-todo highlight-parentheses highlight-numbers highlight-indentation helm-xref helm-themes helm-swoop helm-purpose helm-projectile helm-org helm-mode-manager helm-make helm-ls-git helm-flx helm-descbinds helm-ag google-translate golden-ratio font-lock+ flycheck-package flycheck-elsa flx-ido fancy-battery eyebrowse expand-region evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-textobj-line evil-surround evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state evil-lion evil-indent-plus evil-iedit-state evil-goggles evil-exchange evil-escape evil-ediff evil-easymotion evil-cleverparens evil-args evil-anzu eval-sexp-fu emr elisp-slime-nav editorconfig dumb-jump dotenv-mode dired-quick-sort diminish devdocs define-word column-enforce-mode clean-aindent-mode centered-cursor-mode auto-highlight-symbol auto-compile aggressive-indent ace-link ace-jump-helm-line))
'(unicode-fonts ucs-utils font-utils persistent-soft pcache git-gutter-fringe+ fringe-helper git-gutter+ dockerfile-mode docker docker-tramp browse-at-remote xterm-color vterm terminal-here smart-tabs-mode shell-pop multi-term eshell-z eshell-prompt-extras esh-help company-web web-completion-data centaur-tabs yaml-mode yasnippet-snippets lsp-ui lsp-python-ms lsp-pyright lsp-origami origami lsp-latex helm-lsp helm-company helm-c-yasnippet fuzzy flycheck-ycmd flycheck-rtags flycheck-pos-tip pos-tip flycheck-ocaml dap-mode lsp-treemacs bui treemacs cfrs pfuture posframe company-ycmd company-rtags company-reftex company-math company-c-headers company-auctex company-anaconda ccls lsp-mode ht dash-functional auto-yasnippet yasnippet ac-ispell auto-complete neotree insert-shebang helm-gtags ggtags flycheck-bashate fish-mode counsel-gtags counsel swiper company-shell company ycmd request-deferred yapfify sphinx-doc pytest pyenv-mode py-isort poetry pippel pipenv pyvenv pip-requirements org-ref pdf-tools key-chord ivy htmlize tablist mmm-mode math-symbol-lists markdown-toc live-py-mode importmagic epc ctable concurrent deferred helm-rtags rtags helm-pydoc helm-bibtex bibtex-completion biblio parsebib biblio-core google-c-style gh-md disaster cython-mode cpp-auto-include blacken auctex anaconda-mode pythonic utop tuareg caml treemacs-magit smeargle ocp-indent ocamlformat merlin-eldoc merlin magit-svn magit-section magit-gitflow magit-popup helm-gitignore helm-git-grep gitignore-templates gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link forge markdown-mode ghub closql emacsql-sqlite emacsql treepy evil-magit magit git-commit with-editor transient dune ws-butler writeroom-mode winum which-key volatile-highlights vi-tilde-fringe uuidgen use-package undo-tree treemacs-projectile treemacs-persp treemacs-icons-dired treemacs-evil toc-org symon symbol-overlay string-inflection spaceline-all-the-icons restart-emacs request rainbow-delimiters popwin pcre2el password-generator paradox overseer org-superstar open-junk-file nameless move-text macrostep lorem-ipsum link-hint indent-guide hybrid-mode hungry-delete hl-todo highlight-parentheses highlight-numbers highlight-indentation helm-xref helm-themes helm-swoop helm-purpose helm-projectile helm-org helm-mode-manager helm-make helm-ls-git helm-flx helm-descbinds helm-ag google-translate golden-ratio font-lock+ flycheck-package flycheck-elsa flx-ido fancy-battery eyebrowse expand-region evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-textobj-line evil-surround evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state evil-lion evil-indent-plus evil-iedit-state evil-goggles evil-exchange evil-escape evil-ediff evil-easymotion evil-cleverparens evil-args evil-anzu eval-sexp-fu emr elisp-slime-nav editorconfig dumb-jump dotenv-mode dired-quick-sort diminish devdocs define-word column-enforce-mode clean-aindent-mode centered-cursor-mode auto-highlight-symbol auto-compile aggressive-indent ace-link ace-jump-helm-line))
'(whitespace-style
'(face trailing tabs spaces lines newline empty indentation space-after-tab space-before-tab space-mark tab-mark newline-mark)))
(custom-set-faces

11
symlinks-bin.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# Calculate directory relative to $HOME
COMMON_BIN=$PWD/bin
LOCAL_BIN=/usr/local/bin
pushd $LOCAL_BIN >> /dev/null
ln -vs $COMMON_BIN/latex-runtime.sh .
ln -vs $COMMON_BIN/latexmk .
ln -vs $COMMON_BIN/pdflatex .
popd >> /dev/null