From 55d73a764a52bb1b3a81fc17f116754a64e2042b Mon Sep 17 00:00:00 2001 From: Leni Ven Date: Wed, 7 Dec 2022 20:04:44 -0800 Subject: [PATCH] Restructure; Separate spacemacs config files --- README.md | 23 +- home/fish/functions/fish_prompt.fish | 6 +- home/fish/functions/ssh-forward.fish | 7 + home/rustfmt.toml | 4 + home/{spacemacs => spacemacs/init.el} | 360 -------------------------- home/spacemacs/layers.el | 167 ++++++++++++ home/spacemacs/spacemacs.el | 50 ++++ home/spacemacs/user-config.el | 113 ++++++++ symlinks.sh => setup-home.sh | 11 +- symlinks-bin.sh | 12 - 10 files changed, 368 insertions(+), 385 deletions(-) create mode 100644 home/fish/functions/ssh-forward.fish create mode 100644 home/rustfmt.toml rename home/{spacemacs => spacemacs/init.el} (53%) create mode 100644 home/spacemacs/layers.el create mode 100644 home/spacemacs/spacemacs.el create mode 100644 home/spacemacs/user-config.el rename symlinks.sh => setup-home.sh (77%) delete mode 100755 symlinks-bin.sh diff --git a/README.md b/README.md index d203bf4..cc30bc7 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ -# Config +# Configurations and Setups Common configuration files for: * Vim +* Spacemacs * Docker images * Fish shell ## Setup -Execute `symlinks.sh` to create symbolic links. +Execute `setup-home.sh` to create symbolic links. ## Docker Images -`hub-jupyter` and `hub-jupyter-spark` are images based on cudnn docker image +* `hub-jupyter` and `hub-jupyter-spark` are images based on cudnn docker image for jupyter. To use them with GPU, add the following to `/etc/docker/daemon.json` and restart the docker daemon: ```json @@ -23,15 +24,19 @@ for jupyter. To use them with GPU, add the following to } } ``` -The `latex` docker contains tools for compiling `latex`. - -The `route` docker is used to setup a socks5 proxy server using `ssh`. +* `latex` docker contains tools for compiling `latex`. It is usually not used +* due to the stability of latex. +* `route` docker is used to setup a socks5 proxy server using `ssh`. ## Bin -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. +The `bin/` folder contains dockerised scripts. They should be symbolically +linked 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`. +After setting up dependencies, execute `M-x pdf-tools-install` to have +`pdf-tools`. Note that spacemacs adds cache lines to the `.spacemacs` file so +it is copied over and not version controlled. The individual configurations are +however version controlled. diff --git a/home/fish/functions/fish_prompt.fish b/home/fish/functions/fish_prompt.fish index 06c3acc..d3d9ebb 100755 --- a/home/fish/functions/fish_prompt.fish +++ b/home/fish/functions/fish_prompt.fish @@ -24,7 +24,7 @@ function prompt_abbr for d in $PROMPTDIRS set -l kv (string split -m 1 ":" $d) - + switch "$in" case "$kv[2]/*" set in (string replace $kv[2] $kv[1] $in) @@ -41,7 +41,7 @@ end function fish_prompt # set_color white # echo -n '[' - + set -l FishStatusCodeCache $status set_color -o 00FF00 @@ -55,7 +55,7 @@ function fish_prompt set_color white echo -n ':' - + set_color 8787FF echo -n (prompt_abbr $PWD) diff --git a/home/fish/functions/ssh-forward.fish b/home/fish/functions/ssh-forward.fish new file mode 100644 index 0000000..5d4a7ae --- /dev/null +++ b/home/fish/functions/ssh-forward.fish @@ -0,0 +1,7 @@ +#!/bin/fish + +function ssh-forward + set HOST $argv[1] + set PORT $argv[2] + autossh -N -M 0 -L $PORT:$HOST:$PORT +end diff --git a/home/rustfmt.toml b/home/rustfmt.toml new file mode 100644 index 0000000..5abe125 --- /dev/null +++ b/home/rustfmt.toml @@ -0,0 +1,4 @@ +# Allman style +brace_style = "AlwaysNextLine" +hard_tabs = true +tab_spaces = 2 diff --git a/home/spacemacs b/home/spacemacs/init.el similarity index 53% rename from home/spacemacs rename to home/spacemacs/init.el index 31322ab..ef9cd24 100644 --- a/home/spacemacs +++ b/home/spacemacs/init.el @@ -1,177 +1,3 @@ -;; -*- mode: emacs-lisp; lexical-binding: t -*- -;; 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." - (setq-default - ;; Base distribution to use. This is a layer contained in the directory - ;; `+distribution'. For now available distributions are `spacemacs-base' - ;; or `spacemacs'. (default 'spacemacs) - dotspacemacs-distribution 'spacemacs - - ;; Lazy installation of layers (i.e. layers are installed only when a file - ;; with a supported type is opened). Possible values are `all', `unused' - ;; and `nil'. `unused' will lazy install only unused layers (i.e. layers - ;; not listed in variable `dotspacemacs-configuration-layers'), `all' will - ;; lazy install any layer that support lazy installation even the layers - ;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy - ;; installation feature and you have to explicitly list a layer in the - ;; variable `dotspacemacs-configuration-layers' to install it. - ;; (default 'unused) - dotspacemacs-enable-lazy-installation 'unused - - ;; If non-nil then Spacemacs will ask for confirmation before installing - ;; a layer lazily. (default t) - dotspacemacs-ask-for-lazy-installation t - - ;; List of additional paths where to look for configuration layers. - ;; Paths must have a trailing slash (i.e. `~/.mycontribs/') - dotspacemacs-configuration-layer-path '() - - ;; List of configuration layers to load. - dotspacemacs-configuration-layers - '( - ;; ---------------------------------------------------------------- - ;; 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. - ;; ---------------------------------------------------------------- - - ;; Install the packages from 'Required:' before using spacemacs. - - ;; 3 Checker - (spell-checking :variables ;; Required: aspell - spell-checking-enable-by-default t - spell-checking-enable-auto-dictionary t) - syntax-checking - ;; 4 Completion - auto-completion - helm - - ;; 6 Emacs - org - semantic - tabs - - ;; 7 File trees - treemacs - neotree - - ;; 8 Fonts - unicode-fonts - ;; 9 Fun - emoji - ;; 11 Miscellaneous - multiple-cursors - - ;; 12 Music - alda ;; Required: alda - - ;; 15 Programming Languages - - ;; Markdown - markdown - yaml - html - csv - bibtex - (latex :variables - ;latex-build-command 'latexmk - latex-enable-folding t - latex-enable-magic t - ) - - ;; Scripting Languages - shell-scripts - sql - emacs-lisp - gpu ;; CUDA, OpenGL shaders - javascript - typescript - - ;; Others - coq - (python :variables - python-backend 'lsp - python-lsp-server 'pyright - python-shell-interpreter "python-runtime.sh" - python-shell-interpreter-args "-m IPython --simple-prompt -i") - (c-c++ :variables ;; Required: LLVM - c-c++-adopt-subprojects t - c-c++-default-mode-for-headers 'c++-mode - c-c++-enable-clang-support t - c-c++-backend 'lsp-clangd - c-c++-enable-clang-format-on-save t - clang-format-style "file" - c-c++-lsp-enable-semantic-highlight 'rainbow) - - ;; 16 Readers - pdf - - ;; 18 Source Control - git - version-control - - ;; 20 Tagging - cscope - - ;; 22 Tools - (cmake :variables - cmake-backend 'lsp) - debug - docker - finance ;; Required: ledger - lsp - nginx - (shell :variables - shell-default-height 30 - shell-default-position 'bottom) - systemd - - ) - - - ;; List of additional packages that will be installed without being wrapped - ;; in a layer (generally the packages are installed only and should still be - ;; loaded using load/require/use-package in the user-config section below in - ;; this file). If you need some configuration for these packages, then - ;; consider creating a layer. You can also put the configuration in - ;; `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 - '( - all-the-icons - centaur-tabs - company-statistics - highlight-doxygen - smart-tabs-mode - tablist - exec-path-from-shell - ) - - ;; A list of packages that cannot be updated. - dotspacemacs-frozen-packages '() - - ;; A list of packages that will not be installed and loaded. - ;; Exclude orgit to fix mode problem in PDFView - dotspacemacs-excluded-packages '(orgit) - - ;; Defines the behaviour of Spacemacs when installing packages. - ;; Possible values are `used-only', `used-but-keep-unused' and `all'. - ;; `used-only' installs only explicitly used packages and deletes any unused - ;; packages as well as their unused dependencies. `used-but-keep-unused' - ;; installs only the used packages but won't delete unused ones. `all' - ;; installs *all* packages supported by Spacemacs and never uninstalls them. - ;; (default is `used-only') - dotspacemacs-install-packages 'used-only) - - ) - -(defun dotspacemacs/init () "Initialization: This function is called at the very beginning of Spacemacs startup, @@ -579,189 +405,3 @@ It should only modify the values of Spacemacs settings." ;; If nil the home buffer shows the full path of agenda items ;; and todos. If non nil only the file name is shown. dotspacemacs-home-shorten-agenda-source nil) - - ) - -(defun dotspacemacs/user-env () - "Environment variables setup. -This function defines the environment variables for your Emacs session. By -default it calls `spacemacs/load-spacemacs-env' which loads the environment -variables declared in `~/.spacemacs.env' or `~/.spacemacs.d/.spacemacs.env'. -See the header of this file for more information." - (spacemacs/load-spacemacs-env)) - -(defun dotspacemacs/user-init () - "Initialization for user code: -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." - - ;; Centaur - (setq - centaur-tabs-set-icons t - centaur-tabs-set-bar 'over - centaur-tabs-set-close-button t - centaur-tabs-style "wave" - centaur-tabs-set-bar 'under - centaur-tabs-set-modified-marker t - centaur-tabs-modified-marker "*" - centaur-tabs-cycle-scope 'tabs) - ) - -(defun dotspacemacs/user-load () - "Library to load while dumping. -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 - pdf-sync-forward-display-action t) - ) - -(defun dotspacemacs/user-config () - "Configuration for user code: -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." - (exec-path-from-shell-initialize) - - ;; Key Bindings - (evil-ex-define-cmd "q" 'kill-this-buffer) - (evil-ex-define-cmd "quit" 'evil-quit) - - (setq centaur-tabs-style "wave") - - ;; Ensures the pdf view mode doesn't get into emacs state. - ;; If it does get into emacs state, checked by - ;; (describe-variable 'evil-state) - ;; Use M-x evil-normal-state or M-x evil-force-evilified-state to revert. - (evil-set-initial-state 'pdf-view-mode 'evilified) - - ;; 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 [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") - (set-face-attribute 'whitespace-line nil - :background "gray20" - :foreground nil) - ;; Disabling this since we use smart indenting - (set-face-attribute 'whitespace-indentation nil - :background nil - :foreground "gray30") - ;; Syntax highlighting - (set-face-attribute 'font-lock-type-face nil - :foreground "#55fe55") - (set-face-attribute 'font-lock-constant-face nil - :foreground "#ecbd3d") - - ;(add-hook 'after-make-frame-functions 'spacemacs/enable-transparency) - (spacemacs/enable-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" - c-basic-offset 2 - lsp-clients-clangd-args - '("-j=4" - "--clang-tidy" - "--header-insertion=never" - "--pch-storage=memory" - )) - - (setq css-indent-offset 2) - (smart-tabs-insinuate - 'c - 'c++ - 'java - 'javascript) - (add-hook 'after-init-hook #'company-statistics-mode) - (add-hook 'text-mode-hook #'display-fill-column-indicator-mode) - (add-hook 'prog-mode-hook #'display-fill-column-indicator-mode) - (add-hook 'LaTeX-mode-hook - (lambda () - (setq indent-tabs-mode t))) - - (highlight-doxygen-global-mode 1) - (set-face-attribute 'highlight-doxygen-comment nil - :background nil - :slant 'italic) - - ;;(setq opam-share (substring (shell-command-to-string - ;; "opam config var share 2> /dev/null") 0 -1)) - ;;(add-to-list 'load-path (concat opam-share "/emacs/site-lisp")) - ;;(with-eval-after-load 'merlin - ;; (setq merlin-command 'opam)) - ;;(require 'merlin) - - ;; Prevent creation of lockfiles for angular - (setq create-lockfiles nil) - ) - -;; Do not write anything past this comment. This is where Emacs will -;; auto-generate custom variable definitions. -(defun dotspacemacs/emacs-custom-settings () - "Emacs custom settings. -This is an auto-generated function, do not modify its content directly, use -Emacs customize menu instead. -This function is called at the very end of Spacemacs initialization." -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(helm-completion-style 'emacs) - '(package-selected-packages - '(csv-mode yapfify yaml-mode xterm-color ws-butler winum which-key web-mode web-beautify volatile-highlights vi-tilde-fringe uuidgen use-package undo-tree toc-org tide typescript-mode tagedit systemd sql-indent spaceline smeargle smart-tabs-mode slim-mode shell-pop scss-mode sass-mode restart-emacs rainbow-delimiters pyvenv pytest pyenv-mode py-isort pug-mode popwin pip-requirements persp-mode pcre2el paradox spinner orgit org-ref citeproc htmlize string-inflection queue org-plus-contrib org-bullets open-junk-file nginx-mode neotree multi-term move-text mmm-mode markdown-toc markdown-mode macrostep lorem-ipsum livid-mode skewer-mode simple-httpd live-py-mode linum-relative link-hint ledger-mode js2-refactor yasnippet multiple-cursors js2-mode js-doc insert-shebang indent-guide hydra lv hy-mode hungry-delete hl-todo highlight-parentheses highlight-numbers parent-mode highlight-indentation highlight-doxygen helm-themes helm-swoop helm-pydoc helm-projectile projectile helm-mode-manager helm-make request helm-flx helm-descbinds helm-css-scss helm-bibtex bibtex-completion parsebib helm-ag haml-mode google-translate golden-ratio with-editor gh-md flycheck-pos-tip pos-tip flycheck-ledger flycheck pkg-info epl flx-ido flx fish-mode fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist highlight evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state smartparens evil-indent-plus evil-iedit-state iedit evil-exchange evil-escape evil-ediff evil-args evil-anzu anzu evil goto-chg eval-sexp-fu eshell-z eshell-prompt-extras esh-help emmet-mode elisp-slime-nav dumb-jump dockerfile-mode docker transient tablist json-mode docker-tramp aio json-snatcher disaster diminish diff-hl define-word cython-mode company-statistics company column-enforce-mode coffee-mode cmake-mode clean-aindent-mode clang-format centaur-tabs powerline bind-map bind-key biblio biblio-core auto-highlight-symbol ht auto-compile packed compat auctex-latexmk auctex anaconda-mode pythonic f dash s all-the-icons aggressive-indent adaptive-wrap ace-window ace-link ace-jump-helm-line helm avy popup helm-core async)) - '(warning-suppress-types '((use-package))) - '(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 - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(highlight-parentheses-highlight ((nil (:weight ultra-bold))) t)) -) -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(package-selected-packages - '(yapfify yaml-mode xterm-color ws-butler winum which-key web-mode web-beautify volatile-highlights vi-tilde-fringe uuidgen use-package undo-tree toc-org tide typescript-mode tagedit systemd sql-indent spaceline smeargle smart-tabs-mode slim-mode shell-pop scss-mode sass-mode restart-emacs rainbow-delimiters pyvenv pytest pyenv-mode py-isort pug-mode popwin pip-requirements persp-mode pcre2el paradox spinner orgit org-ref citeproc htmlize string-inflection queue org-plus-contrib org-bullets open-junk-file nginx-mode neotree multi-term move-text mmm-mode markdown-toc markdown-mode macrostep lorem-ipsum livid-mode skewer-mode simple-httpd live-py-mode linum-relative link-hint ledger-mode js2-refactor yasnippet multiple-cursors js2-mode js-doc insert-shebang indent-guide hydra lv hy-mode hungry-delete hl-todo highlight-parentheses highlight-numbers parent-mode highlight-indentation highlight-doxygen helm-themes helm-swoop helm-pydoc helm-projectile projectile helm-mode-manager helm-make request helm-flx helm-descbinds helm-css-scss helm-bibtex bibtex-completion parsebib helm-ag haml-mode google-translate golden-ratio with-editor gh-md flycheck-pos-tip pos-tip flycheck-ledger flycheck pkg-info epl flx-ido flx fish-mode fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist highlight evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state smartparens evil-indent-plus evil-iedit-state iedit evil-exchange evil-escape evil-ediff evil-args evil-anzu anzu evil goto-chg eval-sexp-fu eshell-z eshell-prompt-extras esh-help emmet-mode elisp-slime-nav dumb-jump dockerfile-mode docker transient tablist json-mode docker-tramp aio json-snatcher disaster diminish diff-hl define-word cython-mode company-statistics company column-enforce-mode coffee-mode cmake-mode clean-aindent-mode clang-format centaur-tabs powerline bind-map bind-key biblio biblio-core auto-highlight-symbol ht auto-compile packed compat auctex-latexmk auctex anaconda-mode pythonic f dash s all-the-icons aggressive-indent adaptive-wrap ace-window ace-link ace-jump-helm-line helm avy popup helm-core async))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) diff --git a/home/spacemacs/layers.el b/home/spacemacs/layers.el new file mode 100644 index 0000000..15a8a18 --- /dev/null +++ b/home/spacemacs/layers.el @@ -0,0 +1,167 @@ + "Layer configuration: +This function should only modify configuration layer settings." + (setq-default + ;; Base distribution to use. This is a layer contained in the directory + ;; `+distribution'. For now available distributions are `spacemacs-base' + ;; or `spacemacs'. (default 'spacemacs) + dotspacemacs-distribution 'spacemacs + + ;; Lazy installation of layers (i.e. layers are installed only when a file + ;; with a supported type is opened). Possible values are `all', `unused' + ;; and `nil'. `unused' will lazy install only unused layers (i.e. layers + ;; not listed in variable `dotspacemacs-configuration-layers'), `all' will + ;; lazy install any layer that support lazy installation even the layers + ;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy + ;; installation feature and you have to explicitly list a layer in the + ;; variable `dotspacemacs-configuration-layers' to install it. + ;; (default 'unused) + dotspacemacs-enable-lazy-installation 'unused + + ;; If non-nil then Spacemacs will ask for confirmation before installing + ;; a layer lazily. (default t) + dotspacemacs-ask-for-lazy-installation t + + ;; List of additional paths where to look for configuration layers. + ;; Paths must have a trailing slash (i.e. `~/.mycontribs/') + dotspacemacs-configuration-layer-path '() + + ;; List of configuration layers to load. + dotspacemacs-configuration-layers + '( + ;; ---------------------------------------------------------------- + ;; 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. + ;; ---------------------------------------------------------------- + + ;; Install the packages from 'Required:' before using spacemacs. + + ;; 3 Checker + (spell-checking :variables ;; Required: aspell + spell-checking-enable-by-default t + spell-checking-enable-auto-dictionary t) + syntax-checking + ;; 4 Completion + auto-completion + helm + + ;; 6 Emacs + org + semantic + tabs + + ;; 7 File trees + treemacs + neotree + + ;; 8 Fonts + unicode-fonts + ;; 9 Fun + emoji + ;; 11 Miscellaneous + multiple-cursors + + ;; 12 Music + alda ;; Required: alda + + ;; 15 Programming Languages + + ;; Markdown + markdown + yaml + html + csv + bibtex + (latex :variables + ;latex-build-command 'latexmk + latex-enable-folding t + latex-enable-magic t + ) + + ;; Scripting Languages + shell-scripts + sql + emacs-lisp + gpu ;; CUDA, OpenGL shaders + javascript + typescript + + ;; Others + coq + (python :variables + python-backend 'lsp + python-lsp-server 'pyright) + ;python-shell-interpreter "python-runtime.sh" + ;python-shell-interpreter-args "-m IPython --simple-prompt -i") + rust ;; Required: See rust page + (c-c++ :variables ;; Required: LLVM + c-c++-adopt-subprojects t + c-c++-backend 'lsp-clangd + c-c++-default-mode-for-headers 'c++-mode + c-c++-enable-clang-format-on-save t + c-c++-enable-clang-support t + c-c++-lsp-enable-semantic-highlight 'rainbow + clang-format-style "file" + ) + + ;; 16 Readers + pdf + + ;; 18 Source Control + git + version-control + + ;; 20 Tagging + cscope + + ;; 22 Tools + (cmake :variables + cmake-backend 'lsp) + debug + docker + finance ;; Required: ledger + lsp + nginx + (shell :variables + shell-default-height 30 + shell-default-position 'bottom) + systemd + + ) + + + ;; List of additional packages that will be installed without being wrapped + ;; in a layer (generally the packages are installed only and should still be + ;; loaded using load/require/use-package in the user-config section below in + ;; this file). If you need some configuration for these packages, then + ;; consider creating a layer. You can also put the configuration in + ;; `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 + '( + all-the-icons + centaur-tabs + company-statistics + highlight-doxygen + smart-tabs-mode + tablist + exec-path-from-shell + mini-frame + ) + + ;; A list of packages that cannot be updated. + dotspacemacs-frozen-packages '() + + ;; A list of packages that will not be installed and loaded. + ;; Exclude orgit to fix mode problem in PDFView + dotspacemacs-excluded-packages '(orgit) + + ;; Defines the behaviour of Spacemacs when installing packages. + ;; Possible values are `used-only', `used-but-keep-unused' and `all'. + ;; `used-only' installs only explicitly used packages and deletes any unused + ;; packages as well as their unused dependencies. `used-but-keep-unused' + ;; installs only the used packages but won't delete unused ones. `all' + ;; installs *all* packages supported by Spacemacs and never uninstalls them. + ;; (default is `used-only') + dotspacemacs-install-packages 'used-only) diff --git a/home/spacemacs/spacemacs.el b/home/spacemacs/spacemacs.el new file mode 100644 index 0000000..6db5228 --- /dev/null +++ b/home/spacemacs/spacemacs.el @@ -0,0 +1,50 @@ +;; -*- mode: emacs-lisp; lexical-binding: t -*- +;; This file is loaded by Spacemacs at startup. +;; It must be stored in your home directory. + + +(defun dotspacemacs/layers () + (load "~/common/home/spacemacs/layers.el") + ) + +(defun dotspacemacs/init () + (load "~/common/home/spacemacs/init.el") + ) + +(defun dotspacemacs/user-env () + "Environment variables setup. +This function defines the environment variables for your Emacs session. By +default it calls `spacemacs/load-spacemacs-env' which loads the environment +variables declared in `~/.spacemacs.env' or `~/.spacemacs.d/.spacemacs.env'. +See the header of this file for more information." + (spacemacs/load-spacemacs-env)) + +(defun dotspacemacs/user-init () + "Initialization for user code: +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." + ) + +(defun dotspacemacs/user-load () + "Library to load while dumping. +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." + ) + +(defun dotspacemacs/user-config () + "Configuration for user code: +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." + (exec-path-from-shell-initialize) + (load "~/common/home/spacemacs/user-config.el") + + ) + +;; This is the stub that spacemacs works with. +(defun dotspacemacs/emacs-custom-settings () + ) diff --git a/home/spacemacs/user-config.el b/home/spacemacs/user-config.el new file mode 100644 index 0000000..d8a9ecf --- /dev/null +++ b/home/spacemacs/user-config.el @@ -0,0 +1,113 @@ +;; Centaur +(setq + centaur-tabs-set-icons t + centaur-tabs-set-bar 'over + centaur-tabs-set-close-button t + centaur-tabs-style "wave" + centaur-tabs-set-bar 'under + centaur-tabs-set-modified-marker t + centaur-tabs-modified-marker "*" + centaur-tabs-cycle-scope 'tabs) +(setq + pdf-sync-backward-display-action t + pdf-sync-forward-display-action t) + + +;; Key Bindings +(evil-ex-define-cmd "q" 'kill-this-buffer) +(evil-ex-define-cmd "quit" 'evil-quit) + +(setq centaur-tabs-style "wave") + +;; Ensures the pdf view mode doesn't get into emacs state. +;; If it does get into emacs state, checked by +;; (describe-variable 'evil-state) +;; Use M-x evil-normal-state or M-x evil-force-evilified-state to revert. +(evil-set-initial-state 'pdf-view-mode 'evilified) + +;; 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 [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") +(set-face-attribute 'whitespace-line nil + :background "gray20" + :foreground nil) +;; Disabling this since we use smart indenting +(set-face-attribute 'whitespace-indentation nil + :background nil + :foreground "gray30") +;; Syntax highlighting +(set-face-attribute 'font-lock-type-face nil + :foreground "#55fe55") +(set-face-attribute 'font-lock-constant-face nil + :foreground "#ecbd3d") + +;(add-hook 'after-make-frame-functions 'spacemacs/enable-transparency) +(spacemacs/enable-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" + c-basic-offset 2 + lsp-clients-clangd-args + '("-j=4" + "--clang-tidy" + "--header-insertion=never" + "--pch-storage=memory" + )) + +(setq css-indent-offset 2) +(smart-tabs-insinuate + 'c + 'c++ + 'java + 'javascript) +(add-hook 'after-init-hook #'company-statistics-mode) +(add-hook 'text-mode-hook #'display-fill-column-indicator-mode) +(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode) +(add-hook 'LaTeX-mode-hook + (lambda () + (setq indent-tabs-mode t))) + +(highlight-doxygen-global-mode 1) +(set-face-attribute 'highlight-doxygen-comment nil + :background nil + :slant 'italic) + +;;(setq opam-share (substring (shell-command-to-string +;; "opam config var share 2> /dev/null") 0 -1)) +;;(add-to-list 'load-path (concat opam-share "/emacs/site-lisp")) +;;(with-eval-after-load 'merlin +;; (setq merlin-command 'opam)) +;;(require 'merlin) + +;; Prevent creation of lockfiles for angular +(setq create-lockfiles nil) diff --git a/symlinks.sh b/setup-home.sh similarity index 77% rename from symlinks.sh rename to setup-home.sh index f46fa58..22d551a 100755 --- a/symlinks.sh +++ b/setup-home.sh @@ -7,8 +7,10 @@ pushd $HOME >> /dev/null ln -vs $BASE/home/bashrc .bashrc ln -vs $BASE/home/clang-format .clang-format ln -vs $BASE/home/latexmkrc .latexmkrc -ln -vs $BASE/home/spacemacs .spacemacs ln -vs $BASE/home/vimrc .vimrc + +# This is copied because spacemacs generates its own metadata +cp $BASE/home/spacemacs/spacemacs.el .spacemacs popd >> /dev/null # Create ftplugin links @@ -35,3 +37,10 @@ ln -vs $BASE/home/fish/config.fish . ln -vs $BASE/home/fish/fishd_color . ln -vs $BASE/home/fish/functions . popd >> /dev/null + +DIR=$HOME/.config/rustfmt +BASE=$(realpath --relative-to=$DIR $PWD) +mkdir -p $DIR +pushd $DIR >> /dev/null +ln -vs $BASE/home/rustfmt.toml . +popd >> /dev/null diff --git a/symlinks-bin.sh b/symlinks-bin.sh deleted file mode 100755 index 4e27c96..0000000 --- a/symlinks-bin.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Calculate directory relative to $HOME -IMAGES=$PWD/images -LOCAL_BIN=/usr/local/bin - -pushd $LOCAL_BIN >> /dev/null -ln -vs $IMAGES/hub-jupyter/python-runtime.sh . -ln -vs $IMAGES/latex/latex-runtime.sh . -ln -vs $IMAGES/latex/latexmk . -ln -vs $IMAGES/latex/pdflatex . -popd >> /dev/null