2018-04-25 19:26:53 +02:00
|
|
|
;;; misc.el --- Hosting miscellaneous configuration -*- lexical-binding: t -*-
|
|
|
|
;; Author: William Carroll <wpcarro@gmail.com>
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; This is the home of any configuration that couldn't find a better home.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
;; disable custom variable entries from being written to ~/.emacs.d/init.el
|
|
|
|
(setq custom-file "~/.emacs.d/custom.el")
|
|
|
|
(load custom-file 'noerror)
|
|
|
|
|
2019-01-13 20:33:17 +01:00
|
|
|
;; integrate Emacs with X11 clipboard
|
|
|
|
(setq x-select-enable-primary t)
|
|
|
|
(setq x-select-enable-clipboard t)
|
|
|
|
(general-def 'insert
|
|
|
|
"s-v" #'x-clipboard-yank
|
|
|
|
"C-S-v" #'x-clipboard-yank)
|
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
;; transparently edit compressed files
|
|
|
|
(auto-compression-mode t)
|
|
|
|
|
2019-01-13 20:33:17 +01:00
|
|
|
;; autowrap when over the fill-column
|
2019-03-20 16:07:07 +01:00
|
|
|
(add-hook 'fundamental-mode-hook 'turn-on-auto-fill)
|
2019-01-13 20:33:17 +01:00
|
|
|
|
2018-10-02 15:57:15 +02:00
|
|
|
;; link to Emacs source code
|
|
|
|
(setq find-function-C-source-directory "~/programming/emacs/src")
|
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
;; change emacs prompts from "yes or no" -> "y or n"
|
|
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
|
|
|
;; open photos in Emacs
|
|
|
|
(auto-image-file-mode 1)
|
|
|
|
|
|
|
|
;; disable line-wrapping
|
|
|
|
(setq-default truncate-lines 1)
|
|
|
|
|
|
|
|
;; shell file indentation
|
|
|
|
(setq sh-basic-offset 2)
|
|
|
|
(setq sh-indentation 2)
|
|
|
|
|
2019-03-20 16:32:38 +01:00
|
|
|
;; disable company mode when editing markdown
|
|
|
|
;; TODO: move this out of wpc-misc.el and into a later file to call
|
|
|
|
;; `(disable company-mode)'
|
|
|
|
(add-hook 'markdown-mode-hook (company-mode -1))
|
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
;; create file bookmarks
|
|
|
|
(set-register ?e '(file . "~/.emacs.d/wpc/packages"))
|
2019-01-13 20:33:17 +01:00
|
|
|
(set-register ?n '(file . "~/programming/nixify/configuration.nix"))
|
Drop OSX support; support desktop, laptop, cloudtop
Dropping support for OSX. Moving forward these dotfiles will depend on Linux
systems. Furthermore, since I'm support a ~/bin, the machines that consume these
dotfiles depend on i386 architectures. Linux and i386 are two dependencies that
I'm okay with since the leverage this assumption provides, makes their existence
tolerable.
There is some Google leakage herein, which includes aliases, functions, and
mentions of cloudtop. For now, this is okay. I may break the Google specific
code into its own repository, but for now, this is less maintenance.
This also introduces a ~/.profile instead of erroneously defining environment
variables in my zshrc file, which was unadvised.
This is a large commit and also introduces new aliases, variables, functions
that I accumulated over the past week or so while migrating away from OSX and
onto my new setup. Hopefully in the future I'll be more precise with my commits.
2019-03-18 15:14:26 +01:00
|
|
|
(set-register ?d '(file . "~/Dropbox/dotfiles"))
|
2018-09-04 21:01:07 +02:00
|
|
|
(set-register ?s '(file . "~/.slate.js"))
|
2018-04-25 19:26:53 +02:00
|
|
|
(set-register ?D '(file . "~/Dropbox"))
|
Drop OSX support; support desktop, laptop, cloudtop
Dropping support for OSX. Moving forward these dotfiles will depend on Linux
systems. Furthermore, since I'm support a ~/bin, the machines that consume these
dotfiles depend on i386 architectures. Linux and i386 are two dependencies that
I'm okay with since the leverage this assumption provides, makes their existence
tolerable.
There is some Google leakage herein, which includes aliases, functions, and
mentions of cloudtop. For now, this is okay. I may break the Google specific
code into its own repository, but for now, this is less maintenance.
This also introduces a ~/.profile instead of erroneously defining environment
variables in my zshrc file, which was unadvised.
This is a large commit and also introduces new aliases, variables, functions
that I accumulated over the past week or so while migrating away from OSX and
onto my new setup. Hopefully in the future I'll be more precise with my commits.
2019-03-18 15:14:26 +01:00
|
|
|
(set-register ?o '(file . "~/Dropbox/org/")) ;; TODO: change this to `(getenv "ORG_DIRECTORY")'
|
2019-03-06 17:54:51 +01:00
|
|
|
|
|
|
|
(set-register ?v '(file . "~/.config/nvim/init.vim"))
|
|
|
|
(set-register ?e '(file . "~/.emacs.d/init.el"))
|
|
|
|
(set-register ?z '(file . "~/.zshrc"))
|
|
|
|
(set-register ?a '(file . "~/aliases.zsh"))
|
|
|
|
(set-register ?f '(file . "~/functions.zsh"))
|
|
|
|
(set-register ?l '(file . "~/variables.zsh"))
|
|
|
|
(set-register ?x '(file . "~/.Xresources"))
|
2019-03-23 17:31:59 +01:00
|
|
|
(set-register ?i '(file . "~/.config/i3/config.shared"))
|
Drop OSX support; support desktop, laptop, cloudtop
Dropping support for OSX. Moving forward these dotfiles will depend on Linux
systems. Furthermore, since I'm support a ~/bin, the machines that consume these
dotfiles depend on i386 architectures. Linux and i386 are two dependencies that
I'm okay with since the leverage this assumption provides, makes their existence
tolerable.
There is some Google leakage herein, which includes aliases, functions, and
mentions of cloudtop. For now, this is okay. I may break the Google specific
code into its own repository, but for now, this is less maintenance.
This also introduces a ~/.profile instead of erroneously defining environment
variables in my zshrc file, which was unadvised.
This is a large commit and also introduces new aliases, variables, functions
that I accumulated over the past week or so while migrating away from OSX and
onto my new setup. Hopefully in the future I'll be more precise with my commits.
2019-03-18 15:14:26 +01:00
|
|
|
(set-register ?m '(file . "~/.tmux.conf"))
|
2019-03-06 17:54:51 +01:00
|
|
|
|
2018-06-15 20:23:41 +02:00
|
|
|
(set-register ?p `(file . ,wpc/current-project))
|
2018-04-25 19:26:53 +02:00
|
|
|
|
|
|
|
;; persist history etc b/w Emacs sessions
|
|
|
|
(setq desktop-save 'if-exists)
|
|
|
|
(desktop-save-mode 1)
|
|
|
|
(setq desktop-globals-to-save
|
|
|
|
(append '((extended-command-history . 30)
|
|
|
|
(file-name-history . 100)
|
|
|
|
(grep-history . 30)
|
|
|
|
(compile-history . 30)
|
|
|
|
(minibuffer-history . 50)
|
|
|
|
(query-replace-history . 60)
|
|
|
|
(read-expression-history . 60)
|
|
|
|
(regexp-history . 60)
|
|
|
|
(regexp-search-ring . 20)
|
|
|
|
(search-ring . 20)
|
|
|
|
(shell-command-history . 50)
|
|
|
|
tags-file-name
|
|
|
|
register-alist)))
|
|
|
|
|
|
|
|
;; config Emacs to use $PATH values
|
|
|
|
(use-package exec-path-from-shell
|
|
|
|
:if (memq window-system '(mac ns))
|
|
|
|
:config
|
|
|
|
(exec-path-from-shell-initialize))
|
|
|
|
|
|
|
|
;; Emacs autosave, backup, interlocking files
|
|
|
|
(setq auto-save-default nil
|
|
|
|
make-backup-files nil
|
|
|
|
create-lockfiles nil)
|
|
|
|
|
|
|
|
;; ensure code wraps at 80 characters by default
|
2018-08-09 18:02:18 +02:00
|
|
|
(setq-default fill-column wpc/fill-column)
|
2018-04-25 19:26:53 +02:00
|
|
|
|
|
|
|
(put 'narrow-to-region 'disabled nil)
|
|
|
|
|
|
|
|
;; trim whitespace on save
|
|
|
|
(add-hook 'before-save-hook #'delete-trailing-whitespace)
|
|
|
|
|
|
|
|
;; use tabs instead of spaces
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
|
|
|
|
;; automatically follow symlinks
|
|
|
|
(setq vc-follow-symlinks t)
|
|
|
|
|
|
|
|
;; fullscreen settings
|
|
|
|
(setq ns-use-native-fullscreen nil)
|
|
|
|
|
|
|
|
;; auto-close parens, brackets, quotes
|
|
|
|
(electric-pair-mode 1)
|
|
|
|
|
|
|
|
(use-package oauth2
|
|
|
|
:init
|
|
|
|
;; necessary to remove warnings: https://emacs.stackexchange.com/questions/37036/where-are-these-variables-defined-bytecomp-warnings
|
|
|
|
(defvar url-http-extra-headers ())
|
|
|
|
(defvar oauth--token-data ())
|
|
|
|
(defvar url-callback-function ())
|
|
|
|
(defvar url-callback-arguments ()))
|
|
|
|
|
2019-01-13 20:33:17 +01:00
|
|
|
; (use-package smex
|
|
|
|
; :config
|
|
|
|
; (general-define-key "M-x" #'smex)
|
|
|
|
; (general-add-hook 'ido-setup-hook #'wpc/bind-ido-keys)
|
|
|
|
; (smex-initialize))
|
2018-04-25 19:26:53 +02:00
|
|
|
|
|
|
|
(use-package flx-ido
|
|
|
|
:after (smex)
|
|
|
|
:config
|
|
|
|
(flx-ido-mode 1)
|
|
|
|
(setq ido-enable-flex-matching t
|
|
|
|
ido-use-faces nil))
|
|
|
|
|
|
|
|
(use-package swiper
|
2019-01-13 20:33:17 +01:00
|
|
|
:config
|
|
|
|
(general-define-key
|
|
|
|
"C-s" #'swiper
|
|
|
|
"C-r" #'swiper))
|
2018-04-25 19:26:53 +02:00
|
|
|
|
|
|
|
(use-package yasnippet
|
|
|
|
:config
|
|
|
|
(yas-global-mode 1))
|
|
|
|
|
|
|
|
(use-package ace-window
|
|
|
|
:config
|
2019-01-13 20:33:17 +01:00
|
|
|
(general-define-key "C-x o" #'ace-window)
|
2018-04-25 19:26:53 +02:00
|
|
|
(setq aw-keys '(?a ?s ?d ?f ?j ?k ?k ?\;)))
|
|
|
|
|
|
|
|
(use-package projectile
|
|
|
|
:config
|
|
|
|
(projectile-mode t))
|
|
|
|
|
|
|
|
(use-package counsel
|
|
|
|
:config
|
|
|
|
(defun wpc/counsel-git-grep ()
|
|
|
|
(interactive)
|
|
|
|
(let ((maybe-symbol (wpc/string-symbol-at-point)))
|
|
|
|
(if (string= maybe-symbol "nil")
|
|
|
|
(counsel-git-grep)
|
|
|
|
(counsel-git-grep nil maybe-symbol)))))
|
|
|
|
|
|
|
|
;; search Google, Stackoverflow from within Emacs
|
|
|
|
(use-package engine-mode
|
|
|
|
:config
|
|
|
|
(defengine google
|
|
|
|
"http://www.google.com/search?ie=utf-8&oe=utf-8&q=%s"
|
|
|
|
:keybinding "g")
|
|
|
|
(defengine stack-overflow
|
|
|
|
"https://stackoverflow.com/search?q=%s"
|
|
|
|
:keybinding "s"))
|
|
|
|
|
2018-09-04 21:01:07 +02:00
|
|
|
;; Microsoft's Language Server Protocol (LSP)
|
|
|
|
(use-package lsp-ui
|
|
|
|
:config
|
|
|
|
(add-hook 'lsp-mode-hook #'lsp-ui-mode))
|
|
|
|
(use-package company-lsp
|
|
|
|
:config
|
|
|
|
(push 'company-lsp company-backends))
|
|
|
|
|
2019-03-08 19:18:30 +01:00
|
|
|
(defun wpc/frame-name ()
|
|
|
|
"Return the name of the current frame."
|
|
|
|
(frame-parameter nil 'name))
|
|
|
|
|
2019-03-20 19:38:02 +01:00
|
|
|
;; Having difficulty starting the server using systemd or calling
|
|
|
|
;; `emacs --daemon' in ~/.profile, ~/.xsessionrc, and similar files.
|
|
|
|
|
|
|
|
;; systemd has issues syncing the socket-name, so it becomes messy. I also
|
|
|
|
;; experienced strange initialization where things like wpc-org and other
|
|
|
|
;; modules wouldn't get loaded.
|
|
|
|
;;
|
|
|
|
;; Even if I resolved the socket-name resolution issue, I couldn't find an
|
|
|
|
;; elegant way to reuse GUI frames. GUIs for me have the advantage of supporting
|
|
|
|
;; True Color, support additional keys for KBDs (i.e. super), and aren't limited
|
|
|
|
;; by the terminal for rendering certain things.
|
|
|
|
;;
|
|
|
|
;; For these reasons, it seems preferable to start the server from here. I'm
|
|
|
|
;; considering starting emacs in my ~/.xsessionrc so that the server will be
|
|
|
|
;; running after X initializes.
|
|
|
|
(server-start)
|
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
(provide 'wpc-misc)
|
2018-09-04 21:01:07 +02:00
|
|
|
;;; wpc-misc.el ends here
|