Browse Source

Updates to exwm config for home pc

Simon Watson 3 năm trước cách đây
mục cha
commit
2dd42d532d
4 tập tin đã thay đổi với 345 bổ sung15 xóa
  1. 65 0
      bashrc/current-bashrc
  2. 262 0
      emacs/#.emacs-all#
  3. 7 7
      emacs/.emacs-all
  4. 11 8
      emacs/linux-load/exwm-config.el

+ 65 - 0
bashrc/current-bashrc

@@ -0,0 +1,65 @@
+# .bashrc
+
+# Source global definitions
+if [ -f /etc/bashrc ]; then
+	. /etc/bashrc
+fi
+
+if [ -f ~/.wal_alias ]; then
+	. ~/.wal_alias 
+fi
+
+
+# User specific environment
+if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
+then
+    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
+fi
+export PATH
+
+export EDITOR=/usr/bin/vim
+
+# Uncomment the following line if you don't like systemctl's auto-paging feature:
+# export SYSTEMD_PAGER=
+
+# User specific aliases and functions
+if [ -d ~/.bashrc.d ]; then
+	for rc in ~/.bashrc.d/*; do
+		if [ -f "$rc" ]; then
+			. "$rc"
+		fi
+	done
+fi
+
+unset rc
+
+[ -f ~/.fzf.bash ] && source ~/.fzf.bash
+#export PS1="\e[1;32m\u\e[0m@\h: \$PWD $ "
+PS1="[\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]]\$ "
+#PS1='\[\e]1;\s\$ \W\a\e]2;\u@\h\a\]'"$PS1"
+#export $PS1
+
+alias start_od="rclone --vfs-cache-mode writes mount ipconedrive: /home/watonsi/OneDrive/"
+alias pass_server="ssh watsonsi@ffdctpws1.ipc.com"
+alias shorten-ps1="PS1='\$ '"
+alias default-ps1="PS1='[\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]]\$ '"
+alias ls="/usr/bin/exa"
+alias ll="/usr/bin/exa -lah"
+
+cat /home/watonsi/.cache/wal/sequences
+. "$HOME/.cargo/env"
+
+alias tmux="systemd-run --scope --user tmux"
+alias tmuxn="tmux new -s $1"
+alias tmuxa="/bin/tmux attach -t $1"
+alias tmuxl="/bin/tmux ls"
+alias tmuxq="echo $TMUX"
+
+# function to set terminal title
+function set-title() {
+  if [[ -z "$ORIG" ]]; then
+    ORIG=$PS1
+  fi
+  TITLE="\[\e]2;$*\a\]"
+  PS1=${ORIG}${TITLE}
+}

+ 262 - 0
emacs/#.emacs-all#

@@ -0,0 +1,262 @@
+;;; PACKAGES
+;; Bootstrap Straight Package Manager
+(defvar bootstrap-version)
+(let ((bootstrap-file
+       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
+      (bootstrap-version 5))
+  (unless (file-exists-p bootstrap-file)
+    (with-current-buffer
+        (url-retrieve-synchronously
+         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
+         'silent 'inhibit-cookies)
+      (goto-char (point-max))
+      (eval-print-last-sexp)))
+  (load bootstrap-file nil 'nomessage))
+
+;; packages to install and load
+(straight-use-package 'auto-complete)
+(straight-use-package '(nano-theme :type git :host github
+                                   :repo "rougier/nano-theme"))
+(straight-use-package
+ '(slime-company :type git :host github :repo "anwyn/slime-company"))
+(straight-use-package 'sublimity)
+(straight-use-package 'dashboard)
+(straight-use-package 'all-the-icons)
+(straight-use-package 'neotree)
+(straight-use-package 'rust-mode)
+(straight-use-package 'powerline)
+(straight-use-package 'markdown-mode)
+(straight-use-package 'moe-theme)
+(straight-use-package 'ample-theme)
+(straight-use-package 'slime)
+(straight-use-package 'ac-slime)
+(straight-use-package 'evil)
+(straight-use-package 'dimmer)
+(straight-use-package 'magit)
+(straight-use-package 'diff-hl)
+(straight-use-package 'powerline-evil)
+(straight-use-package 'rainbow-delimiters)
+(straight-use-package 'focus)
+(straight-use-package 'solarized-theme)
+(straight-use-package 'windresize)
+(straight-use-package 'yasnippet)
+
+(require 'yasnippet)
+
+;; Configure focus
+(require 'focus)
+(add-to-list 'focus-mode-to-thing '(lisp-mode . paragraph))
+
+;; rainbow delims
+(require 'rainbow-delimiters)
+(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
+
+;; Git stuff
+(require 'magit)
+(require 'diff-hl)
+;; Just enable diff-hl per buffer,
+;; it seems expensive 
+;; (global-diff-hl-mode)
+(add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
+(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
+(diff-hl-margin-mode t)
+
+(require 'dimmer)
+(setq dimmer-fraction 0.4)
+
+;; always enable ido mode
+(require 'ido)
+(ido-mode t)
+
+(require 'evil)
+(evil-mode 1)
+
+;; Enable tab behavior like vi
+(straight-use-package '(evil-tabs :type git :host github
+                                  :repo "krisajenkins/evil-tabs"))
+(require 'evil-tabs)
+(global-evil-tabs-mode t)
+
+(require 'auto-complete)
+(global-auto-complete-mode t)
+
+(require 'slime)
+(require 'ac-slime)
+(slime-setup '(slime-fancy ac-slime))
+(add-hook 'slime-mode-hook 'set-up-slime-ac)
+(add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
+(eval-after-load "auto-complete"
+  '(add-to-list 'ac-modes 'slime-repl-mode))
+
+(require 'markdown-mode)
+
+(require 'powerline)
+;;(powerline-default-theme)
+;; Better powerline support for evil mode
+(require 'powerline-evil)
+(powerline-evil-vim-theme)
+
+(require 'neotree)
+(global-set-key [f8] 'neotree-toggle)
+
+(require 'dashboard)
+(dashboard-setup-startup-hook)
+
+(require 'all-the-icons)
+
+(require 'sublimity)
+(require 'sublimity-scroll)
+(require 'sublimity-map) ;; experimental
+(require 'sublimity-attractive)
+(setq sublimity-scroll-weight 10
+      sublimity-scroll-drift-length 5)
+(setq sublimity-map-size 30)
+(setq sublimity-map-fraction 0.3)
+(setq sublimity-map-text-scale -9)
+(sublimity-map-set-delay 0.1)
+(setq sublimity-attractive-centering-width nil)
+
+(setq backup-directory-alist
+      `((".*" . ,temporary-file-directory)))
+(setq auto-save-file-name-transforms
+      `((".*" ,temporary-file-directory t)))
+
+;;; Generic options for all OSs
+; Smooth mouse scroll a bit
+(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
+(setq mouse-wheel-progressive-speed nil)
+
+;; normal home/end behavior
+(global-set-key (kbd "<home>") 'beginning-of-line)
+(global-set-key (kbd "<end>") 'end-of-line)
+
+;; Custom functions
+(defun reload-dot-emacs ()
+  (interactive)
+  (load-file (file-truename "~/.emacs")))
+
+(defun sol-dk ()
+  (interactive)
+  (load-theme 'solarized-dark))
+
+(defun sol-l ()
+  (interactive)
+  (load-theme 'solarized-light))
+
+;; Keybinds/macros
+(global-set-key (kbd "C-c e") 'diff-hl-mode)
+(global-set-key (kbd "C-c d") 'dimmer-mode)
+(global-set-key (kbd "C-c s") 'sublimity-mode)
+(global-set-key (kbd "C-c f") 'focus-mode)
+(global-set-key (kbd "C-c r") 'reload-dot-emacs)
+(global-set-key (kbd "C-c l") 'display-line-numbers-mode)
+(global-set-key (kbd "C-c w") 'windresize)
+(global-set-key (kbd "C-c t") 'sol-dk)
+(global-set-key (kbd "C-c g") 'sol-l)
+(global-set-key (kbd "C-c y") 'evil-mode) ; Quick toggle evil-mode for slime err
+(global-set-key (kbd "C-c h") 'tramp-cleanup-connection)
+(global-set-key (kbd "C-c C-.") '(lambda ()
+				  (interactive)
+				  (switch-to-buffer "*Messages*")))
+
+;;; Can probably be replaced with
+;;; a yasnippet
+(fset 'date-to-point
+   (kmacro-lambda-form [?\C-u ?\M-! ?d ?a ?t ?e return] 0 "%d"))
+
+;;; Erc config
+(setq erc-nick "speskk")
+
+;; Allow M-up / M-down behavior to switch windows
+(windmove-default-keybindings 'meta)
+
+(display-time-mode t)
+
+;; Perl Config
+(setq
+ perl-indent-parens-as-block 0
+ perl-indent-level 8)
+
+;; Set to make mouse focus window
+(setq mouse-autoselect-window t
+      focus-follows-mouse t)
+
+;; Custom eshell prompt
+(setq eshell-prompt-function
+ (lambda nil
+   " λ > "))
+(setq eshell-prompt-regexp "^ λ > ")
+
+(set-language-environment "UTF-8")
+
+;; Simple rclone cli wrapper
+(load "~/Repos/dotfiles/emacs/elisp/rclone.el")
+(global-set-key (kbd "C-c o") 'rclone-copy-buffer)
+
+
+;; Load for macOS
+;;; Slime/etc
+(if (eq system-type 'darwin)
+    (progn
+      ;; Configure yasnippet
+      (setq yas-snippet-dirs
+	    '("~/Repos/dotfiles/emacs/yasnippets/"))
+      (yas-global-mode 1)
+      
+      (setq inferior-lisp-program "/opt/homebrew/bin/sbcl")
+      (load (expand-file-name "~/.local/opt/quicklisp/slime-helper.el"))
+      (load "/Users/swatson/.emacs.d/.erc-auth.el")
+      ;; Font/themes/etc
+      (load "/Users/swatson/Repos/dotfiles/emacs/mac-load/customs.el")
+
+      ;; Custom Commands
+      (defun connect-to-libera-erc () (interactive)
+	(erc :server "irc.libera.chat" :port "6667"
+             :nick "speskk" :password *libera-chat*))
+
+      ;; Easily set cua mode on/off so that I don't have to
+      ;; use shift+insert for paste on mac
+      (global-set-key (kbd "C-c c") 'cua-mode)
+      ;; Graphic Display
+      (if (display-graphic-p)
+	  (progn
+	    (load-theme 'solarized-dark t)))))
+
+;; Load for Windows10
+(if (eq system-type 'windows-nt)
+    (progn
+      ;; Configure yasnippet
+      (setq yas-snippet-dirs
+	    '("C:/Users/watsonsi/Documents/Github/dotfiles/emacs/yasnippets/"))
+      (yas-global-mode 1):q!
+
+      (load "C:/Users/watsonsi/Documents/GitHub/dotfiles/emacs/windows-load/customs.el")
+      (setq visible-bell 1)
+      (load-theme 'solarized-light t)))
+
+;; Load for GUI Linux
+(if (eq system-type 'gnu/linux)
+    (if (display-graphic-p)
+	(progn
+	  (setq yas-snippet-dirs
+	    '("~/Repos/dotfiles/emacs/yasnippets/"))
+	  (yas-global-mode 1)
+
+	  (straight-use-package 'exwm)
+	  (require 'exwm)
+
+	  ;(require 'exwm-systemtray)
+	  ;(exwm-systemtray-enable)
+
+	  (load "~/Repos/dotfiles/emacs/linux-load/exwm-config.el")
+	  
+	  (require 'exwm-config-spw)
+	  (exwm-config-spw)
+
+	  (setq visible-bell 1)
+	  (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
+	  (load-theme 'solarized-light t))))
+      
+;; Load for Term
+(unless (display-graphic-p)
+  (xterm-mouse-mode t))

+ 7 - 7
emacs/.emacs-all

@@ -1,4 +1,4 @@
-;;; Packages
+;;; PACKAGES
 ;; Bootstrap Straight Package Manager
 (defvar bootstrap-version)
 (let ((bootstrap-file
@@ -166,6 +166,12 @@
 
 ;;; Erc config
 (setq erc-nick "speskk")
+(if (file-exists-p "~/.emacs.d/.erc-auth.el")
+    (progn
+      (load "~/.emacs.d/.erc-auth.el")
+      (defun connect-to-libera-erc () (interactive)
+	(erc :server "irc.libera.chat" :port "6667"
+             :nick "speskk" :password *libera-chat*))))
 
 ;; Allow M-up / M-down behavior to switch windows
 (windmove-default-keybindings 'meta)
@@ -205,15 +211,9 @@
       
       (setq inferior-lisp-program "/opt/homebrew/bin/sbcl")
       (load (expand-file-name "~/.local/opt/quicklisp/slime-helper.el"))
-      (load "/Users/swatson/.emacs.d/.erc-auth.el")
       ;; Font/themes/etc
       (load "/Users/swatson/Repos/dotfiles/emacs/mac-load/customs.el")
 
-      ;; Custom Commands
-      (defun connect-to-libera-erc () (interactive)
-	(erc :server "irc.libera.chat" :port "6667"
-             :nick "speskk" :password *libera-chat*))
-
       ;; Easily set cua mode on/off so that I don't have to
       ;; use shift+insert for paste on mac
       (global-set-key (kbd "C-c c") 'cua-mode)

+ 11 - 8
emacs/linux-load/exwm-config.el

@@ -45,15 +45,18 @@
             ([?\C-v] . [next])
             ([?\C-d] . [delete])
             ([?\C-k] . [S-end delete]))))
+ 
+  (if (file-exists-p "~/.exwm-work")
+      (progn
+	(require 'exwm-randr)
+	(setq exwm-randr-workspace-output-plist
+	      '(0 "DisplayPort-0" 1 "DVI-0"))
+	(add-hook 'exwm-randr-screen-change-hook
+		  (lambda ()
+      		    (start-process-shell-command 
+       		     "xrandr" nil "xrandr --output DisplayPort-0 --below DVI-0")))
+	(exwm-randr-enable)))
   
-  (require 'exwm-randr)
-  (setq exwm-randr-workspace-output-plist
-	'(0 "DisplayPort-0" 1 "DVI-0"))
-  (add-hook 'exwm-randr-screen-change-hook
-	    (lambda ()
-	      (start-process-shell-command 
-	       "xrandr" nil "xrandr --output DisplayPort-0 --below DVI-0")))
-  (exwm-randr-enable)
 
   ;; Enable EXWM
   (exwm-enable)