Restructure spacemacs and add macOS version of setup-home

This commit is contained in:
Leni Ven 2022-12-14 18:52:44 -05:00
parent 48ddd656f3
commit eb798b6a55
6 changed files with 91 additions and 62 deletions

View File

@ -8,7 +8,8 @@ Common configuration files for:
## Setup
Execute `setup-home.sh` to create symbolic links.
Execute `setup-home.sh` to create symbolic links. Note that macOS users will
need to install `coreutils` to provide the `grealpath` utility.
## Docker Images

View File

@ -38,15 +38,18 @@ This function should only modify configuration layer settings."
;; 3 Checker
(spell-checking :variables ;; Required: aspell
spell-checking-enable-by-default t
spell-checking-enable-auto-dictionary t)
spell-checking-enable-by-default t)
syntax-checking
;; 4 Completion
auto-completion
helm
;; 6 Emacs
org
(org :variables
org-enable-notifications 't
org-start-notification-daemon-on-startup 't
org-enable-org-journal-support 't
)
semantic
tabs

13
home/spacemacs/setup-macos.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
relative() {
grealpath --relative-to=$1 $2
}
DIR=~/Library/LaunchAgents/
BASE=$(relative $DIR $PWD)
ln -s $BASE/daemon.plist ~/Library/LaunchAgents/gnu.emacs.daemon.plist
DIR=~/Applications
BASE=$(relative $DIR $PWD)
ln -s $BASE/emacsclient.applescript ~/Applications/Spacemacs.app

View File

@ -40,9 +40,7 @@ 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.

View File

@ -1,31 +1,23 @@
;; 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)
;; Spacemacs itself
(exec-path-from-shell-initialize)
;; Typing
(setq evil-indent-convert-tabs nil)
(setq-default indent-tabs-mode t)
(setq-default tab-width 2)
;; Key Bindings
(evil-ex-define-cmd "q" 'kill-this-buffer)
(evil-ex-define-cmd "quit" 'evil-quit)
(setq centaur-tabs-style "wave")
;; 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))))
;; 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
;; Display
(spacemacs/toggle-whitespace-globally-on)
(setq whitespace-display-mappings
;; all numbers are Unicode codepoint in decimal. ⁖ (insert-char 182 1)
@ -60,29 +52,39 @@
(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))))
;; Org mode
(setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0))
;; Spellchecking
(setq ispell-dictionary "english")
;; 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)
;; 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)
;; 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
@ -97,6 +99,16 @@
(lambda ()
(setq indent-tabs-mode t)))
;; C/C++
(setq
-default-style "stroustrup"
-basic-offset 2
lsp-clients-clangd-args
'("-j=4"
"--clang-tidy"
"--header-insertion=never"
"--pch-storage=memory"
))
(highlight-doxygen-global-mode 1)
(set-face-attribute 'highlight-doxygen-comment nil
:background nil
@ -108,6 +120,3 @@
;;(with-eval-after-load 'merlin
;; (setq merlin-command 'opam))
;;(require 'merlin)
;; Prevent creation of lockfiles for angular
(setq create-lockfiles nil)

View File

@ -1,9 +1,21 @@
#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then
relative() {
grealpath --relative-to=$1 $2
}
else
relative() {
realpath --relative-to=$1 $2
}
fi
# Calculate directory relative to $HOME
DIR=$HOME
BASE=$(realpath --relative-to=$DIR $PWD)
BASE=$(relative $DIR $PWD)
pushd $HOME >> /dev/null
ln -vs $BASE/home/rustfmt.toml .rustfmt.toml
ln -vs $BASE/home/bashrc .bashrc
ln -vs $BASE/home/clang-format .clang-format
ln -vs $BASE/home/latexmkrc .latexmkrc
@ -13,34 +25,27 @@ ln -vs $BASE/home/vimrc .vimrc
cp $BASE/home/spacemacs/spacemacs.el .spacemacs
popd >> /dev/null
# Create ftplugin links
# Vim
DIR=$HOME/.vim/after/ftplugin
BASE=$(realpath --relative-to=$DIR $PWD)
BASE=$(relative $DIR $PWD)
mkdir -p $DIR
pushd $DIR >> /dev/null
ln -vs $BASE/home/vim/after/ftplugin/tex.vim .
popd >> /dev/null
DIR=$HOME/.vim/colors
BASE=$(realpath --relative-to=$DIR $PWD)
BASE=$(relative $DIR $PWD)
mkdir -p $DIR
pushd $DIR >> /dev/null
ln -vs $BASE/home/vim/vim-amino/amino.vim .
popd >> /dev/null
# Fish
DIR=$HOME/.config/fish
BASE=$(realpath --relative-to=$DIR $PWD)
BASE=$(relative $DIR $PWD)
mkdir -p $DIR
pushd $DIR >> /dev/null
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