Compare commits
13 commits
63edfe28ce
...
2755f69cd8
| Author | SHA1 | Date | |
|---|---|---|---|
| 2755f69cd8 | |||
| a7a99e16d0 | |||
| 8000173917 | |||
| cf51aa4842 | |||
| 7882a3cbe2 | |||
| ff6fd2b144 | |||
| 6da50c9bac | |||
| d23aa40709 | |||
| fb1d4a8e03 | |||
| f2ec3982d2 | |||
| 843767fdb8 | |||
| b095833f8e | |||
| 22eda7e6ed |
90 changed files with 647 additions and 2540 deletions
26
modules/emacs.lua
Normal file
26
modules/emacs.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
local git = require "lib.git"
|
||||
|
||||
local emacs_dir = os.getenv "HOME" .. "/.emacs.d"
|
||||
if not configz.is_directory(emacs_dir .. "/straight") then
|
||||
configz.directory(emacs_dir .. "/straight")
|
||||
end
|
||||
|
||||
if not configz.is_file(emacs_dir .. "/init.el") then
|
||||
configz.link(emacs_dir .. "/init.el", {
|
||||
source = os.getenv "PWD" .. "/site-modules/core/files/emacs/init.el",
|
||||
})
|
||||
end
|
||||
|
||||
if not configz.is_directory(emacs_dir .. "/mbwatch") then
|
||||
configz.link(emacs_dir .. "/mbwatch", {
|
||||
source = os.getenv "PWD" .. "/site-modules/core/files/emacs/mbwatch",
|
||||
})
|
||||
end
|
||||
|
||||
if not configz.is_directory(emacs_dir .. "/straight/versions") then
|
||||
configz.link(emacs_dir .. "/straight/versions", {
|
||||
source = os.getenv "PWD" .. "/site-modules/core/files/emacs/straight/versions",
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ local start_plugins = {
|
|||
["cmp-nvim-lsp"] = { url = "https://github.com/hrsh7th/cmp-nvim-lsp.git", revision = "main" },
|
||||
["cmp-path"] = { url = "https://github.com/hrsh7th/cmp-path.git", revision = "main" },
|
||||
["Comment.nvim"] = { url = "https://github.com/numToStr/Comment.nvim.git" },
|
||||
["ferret"] = { url = "https://github.com/wincent/ferret.git" },
|
||||
["ferret"] = { url = "https://github.com/wincent/ferret.git", revision = "main" },
|
||||
["LuaSnip"] = { url = "https://github.com/L3MON4D3/LuaSnip.git" },
|
||||
["nvim-cmp"] = { url = "https://github.com/hrsh7th/nvim-cmp.git", revision = "main" },
|
||||
["nvim-lint"] = { url = "https://github.com/mfussenegger/nvim-lint.git" },
|
||||
|
|
@ -41,7 +41,6 @@ local start_plugins = {
|
|||
["nvim-treesitter"] = { url = "https://github.com/nvim-treesitter/nvim-treesitter.git" },
|
||||
["nvim-treesitter-textobjects"] = { url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects.git" },
|
||||
["vim-surround"] = { url = "https://github.com/tpope/vim-surround.git" },
|
||||
["vim-tmux-navigator"] = { url = "https://github.com/christoomey/vim-tmux-navigator.git" },
|
||||
["cmp-cmdline"] = { url = "https://github.com/hrsh7th/cmp-cmdline.git", revision = "main" },
|
||||
["copilot"] = { url = "https://github.com/zbirenbaum/copilot.lua.git" },
|
||||
["copilot-cmp"] = { url = "https://github.com/zbirenbaum/copilot-cmp.git" },
|
||||
|
|
@ -54,6 +53,7 @@ local start_plugins = {
|
|||
|
||||
local opt_plugins = {
|
||||
["command-t"] = { url = "https://github.com/wincent/command-t.git" },
|
||||
["vim-tmux-navigator"] = { url = "https://github.com/christoomey/vim-tmux-navigator.git" },
|
||||
}
|
||||
|
||||
-- Install all of the plugins I want to start at boot
|
||||
|
|
@ -82,3 +82,4 @@ configz.run(string.format("rm -rf %s/vim-puppet", nvim_plugin_dir_start))
|
|||
configz.run(string.format("rm -rf %s/base16-vim", nvim_plugin_dir_start))
|
||||
configz.run(string.format("rm -rf %s/vim-fugitive", nvim_plugin_dir_start))
|
||||
configz.run(string.format("rm -rf %s/vim-rhubarb", nvim_plugin_dir_start))
|
||||
configz.run(string.format("rm -rf %s/vim-tmux-navigator", nvim_plugin_dir_start))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Cli app for managing files with puppet
|
||||
# Cli app for managing files with configz
|
||||
# see https://github.com/adeattwood/dotfiles
|
||||
# see https://github.com/adeattwood/configz
|
||||
#
|
||||
# Author: Ade Attwood <code@adeattwood.co.uk>
|
||||
# Version: 0.0.2
|
||||
|
|
@ -11,26 +12,22 @@
|
|||
SCRIPT="$(realpath "$(readlink -f "$0")")";
|
||||
DOTFILES_DIR=${SCRIPT%%site-modules/core/files/bin/dotfiles*}
|
||||
|
||||
MODULES="$(ls -1 "$DOTFILES_DIR"/modules)"
|
||||
MODULES="${MODULES//.lua/}"
|
||||
|
||||
case $1 in
|
||||
apply)
|
||||
shift
|
||||
cd "$DOTFILES_DIR"
|
||||
bolt module install
|
||||
bolt apply manifests/root.pp --targets localhost --run-as root --sudo-password-prompt
|
||||
bolt apply manifests/workstation.pp --targets localhost
|
||||
RUST_LOG=info configz --module manifests/configz-user
|
||||
exit 0;
|
||||
;;
|
||||
apply-root)
|
||||
cd "$DOTFILES_DIR"
|
||||
bolt apply manifests/root.pp --targets localhost --run-as root --sudo-password-prompt
|
||||
exit 0;
|
||||
;;
|
||||
apply-user)
|
||||
cd "$DOTFILES_DIR"
|
||||
bolt apply manifests/workstation.pp --targets localhost
|
||||
RUST_LOG=info configz --module manifests/configz-user
|
||||
for module in $@; do
|
||||
RUST_LOG=info configz --module "modules.$module";
|
||||
done
|
||||
exit 0;
|
||||
;;
|
||||
list)
|
||||
echo "$MODULES" | column
|
||||
exit 0;
|
||||
;;
|
||||
esac
|
||||
|
||||
cat << HELP
|
||||
|
|
@ -45,13 +42,12 @@ Usage: dotfiles <command>
|
|||
Author: Ade Attwood <code@adeattwood.co.uk>
|
||||
|
||||
Commands:
|
||||
apply Applies a puppet configuration with the dotfiles config and facts
|
||||
apply-root Applies the root puppet manifestes
|
||||
apply-user Applies the user puppet manifestes
|
||||
list List all of the available configz modules
|
||||
apply Apply a configz module
|
||||
|
||||
Examples:
|
||||
|
||||
Apply all of the puppet config
|
||||
$ dotfiles apply
|
||||
Apply the zsh configz module
|
||||
$ dotfiles apply zsh
|
||||
|
||||
HELP
|
||||
|
|
|
|||
|
|
@ -1,146 +1,485 @@
|
|||
;;; init.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
;; ;;; Commentary:
|
||||
;;
|
||||
;; The entrypoint to AMACS
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; (setq user-emacs-directory "~/development/emacs")
|
||||
;; (customize-set-value 'custom-theme-directory user-emacs-directory)
|
||||
;;; Package management
|
||||
(defvar bootstrap-version)
|
||||
(let ((bootstrap-file
|
||||
(expand-file-name
|
||||
"straight/repos/straight.el/bootstrap.el"
|
||||
(or (bound-and-true-p straight-base-dir)
|
||||
user-emacs-directory)))
|
||||
(bootstrap-version 7))
|
||||
(unless (file-exists-p bootstrap-file)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
|
||||
'silent 'inhibit-cookies)
|
||||
(goto-char (point-max))
|
||||
(eval-print-last-sexp)))
|
||||
(load bootstrap-file nil 'nomessage))
|
||||
|
||||
;; Load package loading with `use-package` this must be the first
|
||||
;; thing loaded so we can install the packages with `use-package`
|
||||
(load-file (expand-file-name "src/packages.el" user-emacs-directory))
|
||||
(straight-use-package 'use-package)
|
||||
|
||||
;; Load the ui tweeks and theme to limit the time we see a big white
|
||||
;; screen
|
||||
(load-file (expand-file-name "src/ui.el" user-emacs-directory))
|
||||
;;; UI Setup
|
||||
|
||||
;; Load the personal config if its available where all of the secrets
|
||||
;; source is
|
||||
(let ((personal-init (expand-file-name "init-personal.el" user-emacs-directory)))
|
||||
(when (file-exists-p personal-init)
|
||||
(load-file personal-init)))
|
||||
(tooltip-mode -1) ; Disable tooltips
|
||||
(menu-bar-mode -1) ; Disable the menu bar
|
||||
(scroll-bar-mode -1) ; Disable visible scrollbar
|
||||
(tool-bar-mode -1) ; Disable the toolbar
|
||||
|
||||
;; Genral and main configuration
|
||||
(load-file (expand-file-name "src/general.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/file-operations.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/evil.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/ivy.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/treemacs.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/term.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/language-tool.el" user-emacs-directory))
|
||||
(defun aa/set-font (a-font-size)
|
||||
"Sets the font size for the whole of emacs setting the font faces
|
||||
|
||||
;; Set up puppet for editing the dotfiles config
|
||||
(load-file (expand-file-name "src/puppet.el" user-emacs-directory))
|
||||
This is better than the `C-x +` and C-x - because this is global to emacs not
|
||||
just in in the current buffer."
|
||||
(interactive "nFont Size: ")
|
||||
|
||||
;; Email configuration
|
||||
(load-file (expand-file-name "src/notmuch.el" user-emacs-directory))
|
||||
(setq aa-font "DejaVu Sans Mono")
|
||||
(setq aa-v-font "Sans Serif")
|
||||
;; (setq aa-v-font "Ubuntu")
|
||||
|
||||
;; Org mode
|
||||
(load-file (expand-file-name "src/org.el" user-emacs-directory))
|
||||
(set-face-attribute 'default nil :font aa-font :height a-font-size)
|
||||
(set-face-attribute 'fixed-pitch nil :font aa-font :height a-font-size)
|
||||
(set-face-attribute 'variable-pitch nil :font aa-v-font :height a-font-size :weight 'regular))
|
||||
|
||||
;; Development configuration
|
||||
(load-file (expand-file-name "src/format.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/development.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/zoekt.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/php.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/c-sharp.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/js-ts.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/yaml.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/json.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/web.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/go.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/docker.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/shell.el" user-emacs-directory))
|
||||
(load-file (expand-file-name "src/lang/c.el" user-emacs-directory))
|
||||
;; Set the default font size when emacs starts
|
||||
(aa/set-font 100)
|
||||
|
||||
;; Load the projectile module last so we can override compilation errors regexp
|
||||
;; without other modules affecting it after
|
||||
(load-file (expand-file-name "src/projectile.el" user-emacs-directory))
|
||||
(use-package all-the-icons
|
||||
:straight t
|
||||
:if (display-graphic-p))
|
||||
|
||||
(use-package doom-modeline
|
||||
:straight t
|
||||
:init (doom-modeline-mode 1))
|
||||
|
||||
(use-package doom-themes
|
||||
:straight t
|
||||
:config
|
||||
;; Global settings (defaults)
|
||||
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
|
||||
doom-themes-enable-italic t) ; if nil, italics is universally disabled
|
||||
(load-theme 'doom-nord-light t)
|
||||
|
||||
;; Enable flashing mode-line on errors
|
||||
(doom-themes-visual-bell-config)
|
||||
;; Corrects (and improves) org-mode's native fontification.
|
||||
(doom-themes-org-config))
|
||||
|
||||
;;; General Setup
|
||||
|
||||
;; Disable .# lock files. Then sends all directory watch tasks crazy. It also
|
||||
;; make compiling applications fail when you have unsaved files
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
;; Make ESC quit prompts
|
||||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
||||
|
||||
(setq browse-url-browser-function 'browse-url-chrome)
|
||||
|
||||
(use-package which-key
|
||||
:straight t
|
||||
:init (which-key-mode)
|
||||
:diminish which-key-mode
|
||||
:config
|
||||
(setq which-key-idle-delay 1))
|
||||
|
||||
;;; Org
|
||||
|
||||
(straight-use-package 'org)
|
||||
|
||||
(require 'org-habit)
|
||||
(require 'org-id)
|
||||
(require 'org-protocol)
|
||||
(require 'org-tempo)
|
||||
|
||||
(defun aa/org-roam-update-tasklist-tag ()
|
||||
"Add or remove the 'tasklist' filetag based on the presence of TODO items in
|
||||
the current buffer. Ensure the filetag is inserted right under the title if
|
||||
not present."
|
||||
(when (org-roam-file-p) ; Ensure this only runs on Org-roam files
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
;; Locate the title or the first heading
|
||||
(let ((has-title (re-search-forward "^#\\+title:" nil t))
|
||||
(has-todo nil))
|
||||
;; Check for TODOs in the file
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward org-todo-regexp nil t)
|
||||
(setq has-todo t))
|
||||
|
||||
;; Determine the correct place for filetags (right below the title or
|
||||
;; first heading)
|
||||
(goto-char (point-min))
|
||||
(when has-title
|
||||
(re-search-forward "^#\\+title:.*$" nil t))
|
||||
|
||||
;; Insert filetags if missing
|
||||
(unless (re-search-forward "^#\\+filetags:" (save-excursion (outline-next-heading) (point)) t)
|
||||
;; Move under title or first heading
|
||||
(end-of-line)
|
||||
(insert "\n#+filetags:"))
|
||||
|
||||
;; Go to the filetags line and modify based on presence of TODOs
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "^#\\+filetags:.*$" nil t)
|
||||
(let ((tags-line (match-string 0)))
|
||||
(if has-todo
|
||||
(unless (string-match-p ":tasklist:" tags-line)
|
||||
;; Add the tasklist tag if not present and TODOs exist
|
||||
(end-of-line)
|
||||
(insert " :tasklist:"))
|
||||
(when (string-match-p ":tasklist:" tags-line)
|
||||
;; Remove the tasklist tag if no TODOs exist
|
||||
(replace-match (replace-regexp-in-string ":tasklist:" "" tags-line) nil nil nil 0)))))))))
|
||||
|
||||
;; Add the function to before-save-hook so it runs on every save
|
||||
(add-hook 'before-save-hook 'aa/org-roam-update-tasklist-tag)
|
||||
|
||||
(defun aa/org-roam-tasklist-files ()
|
||||
"Return a list of note files containing 'tasklist' tag."
|
||||
(seq-uniq
|
||||
(seq-map
|
||||
#'car
|
||||
(org-roam-db-query
|
||||
[:select [nodes:file]
|
||||
:from tags
|
||||
:left-join nodes
|
||||
:on (= tags:node-id nodes:id)
|
||||
:where (like tag (quote "%\"tasklist\"%"))]))))
|
||||
|
||||
(defun aa/org-agenda-files (&rest _)
|
||||
"Update the value of `org-agenda-files'."
|
||||
(setq org-agenda-files
|
||||
(append (aa/org-roam-tasklist-files) (list org-directory))))
|
||||
|
||||
(advice-add 'org-agenda :before #'aa/org-agenda-files)
|
||||
(advice-add 'org-todo-list :before #'aa/org-agenda-files)
|
||||
|
||||
(setq org-directory "~/Org"
|
||||
org-todo-keywords '((sequence "TODO" "WAITING" "REVIEW" "|" "DONE" "ARCHIVED"))
|
||||
org-hide-emphasis-markers t
|
||||
org-agenda-window-setup 'current-window
|
||||
org-export-with-broken-links "mark"
|
||||
org-export-with-section-numbers nil
|
||||
org-export-with-sub-superscripts nil
|
||||
org-export-with-toc nil
|
||||
org-html-head "<style>body { font-family: system-ui; }</style>")
|
||||
|
||||
(setq org-agenda-custom-commands
|
||||
'(("d" "Dashboard"
|
||||
((agenda "" ((org-deadline-warning-days 7)))
|
||||
(todo "WAITING"
|
||||
((org-agenda-overriding-header "Waiting on External")))
|
||||
(todo "TODO"
|
||||
((org-agenda-overriding-header "Scheduled")
|
||||
(org-agenda-skip-function '(org-agenda-skip-entry-if 'nottimestamp))))
|
||||
(todo "TODO"
|
||||
((org-agenda-overriding-header "Backlog")
|
||||
(org-agenda-todo-list-sublevels nil)
|
||||
(org-agenda-skip-function '(org-agenda-skip-entry-if 'timestamp))))))))
|
||||
|
||||
(setq org-capture-templates
|
||||
'(("t" "Todo" entry (file+headline "Todo.org" "Inbox")
|
||||
"* TODO %?\n\n %a")))
|
||||
|
||||
(setq org-roam-dailies-capture-templates
|
||||
'(("d" "default" entry
|
||||
"* %?"
|
||||
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))
|
||||
("t" "todo" entry
|
||||
"* TODO %?\n\n %a"
|
||||
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))))
|
||||
|
||||
(setq org-refile-targets
|
||||
`((,(concat (file-name-as-directory org-directory) "Todo.org") :maxlevel . 1)))
|
||||
|
||||
(add-hook 'org-mode-hook (lambda ()
|
||||
(electric-pair-mode)
|
||||
(org-indent-mode)
|
||||
(flyspell-mode)))
|
||||
|
||||
;; Open file links in current window, rather than new ones
|
||||
;; https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L632
|
||||
(setf (alist-get 'file org-link-frame-setup) #'find-file)
|
||||
|
||||
(use-package org-bullets
|
||||
:straight t
|
||||
:after org
|
||||
:config
|
||||
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
|
||||
|
||||
(use-package org-roam
|
||||
:straight t
|
||||
:custom
|
||||
(setq org-roam-completion-everywhere t)
|
||||
(org-roam-directory (concat (file-name-as-directory org-directory) "Roam"))
|
||||
(org-roam-completion-everywhere t)
|
||||
:config
|
||||
(org-roam-db-autosync-mode)
|
||||
(aa/org-agenda-files)
|
||||
(require 'org-roam-protocol))
|
||||
|
||||
(use-package org-roam-ui
|
||||
:straight t
|
||||
:after org-roam
|
||||
:config
|
||||
(setq org-roam-ui-sync-theme t
|
||||
org-roam-ui-follow t
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start t))
|
||||
|
||||
(use-package org-download
|
||||
:straight t
|
||||
:config
|
||||
(setq-default org-download-image-dir (concat (file-name-as-directory org-directory) "Attachments")
|
||||
org-download-heading-lvl nil))
|
||||
|
||||
;;; Completion
|
||||
|
||||
(use-package company
|
||||
:straight t
|
||||
:config
|
||||
(setq completion-ignore-case t)
|
||||
(setq company-idle-delay 0.4)
|
||||
(add-to-list 'company-backends 'company-capf)
|
||||
(global-company-mode 1))
|
||||
|
||||
(use-package company-box
|
||||
:straight t
|
||||
:hook (company-mode . company-box-mode))
|
||||
|
||||
(use-package ivy
|
||||
:straight t
|
||||
:diminish
|
||||
:bind (:map ivy-minibuffer-map
|
||||
("TAB" . ivy-alt-done)
|
||||
("C-l" . ivy-alt-done)
|
||||
("C-j" . ivy-next-line)
|
||||
("C-k" . ivy-previous-line)
|
||||
:map ivy-switch-buffer-map
|
||||
("C-k" . ivy-previous-line)
|
||||
("C-l" . ivy-done)
|
||||
("C-d" . ivy-switch-buffer-kill)
|
||||
:map ivy-reverse-i-search-map
|
||||
("C-k" . ivy-previous-line)
|
||||
("C-d" . ivy-reverse-i-search-kill))
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
|
||||
(use-package counsel
|
||||
:straight t
|
||||
:config
|
||||
(counsel-mode 1))
|
||||
|
||||
;;; Evil
|
||||
|
||||
(use-package evil
|
||||
:straight t
|
||||
:init
|
||||
(setq evil-want-keybinding nil)
|
||||
(setq evil-want-C-u-scroll t)
|
||||
(setq evil-want-C-i-jump nil)
|
||||
:config
|
||||
(evil-mode 1)
|
||||
|
||||
;; Set window movement to CTRL hjkl to emulate tmux vim interaction
|
||||
(global-set-key (kbd "C-h") 'evil-window-left)
|
||||
(global-set-key (kbd "C-j") 'evil-window-down)
|
||||
(global-set-key (kbd "C-l") 'evil-window-right)
|
||||
(global-set-key (kbd "C-k") 'evil-window-up)
|
||||
|
||||
(evil-set-initial-state 'messages-buffer-mode 'normal)
|
||||
(evil-set-initial-state 'dashboard-mode 'normal))
|
||||
|
||||
(use-package evil-collection
|
||||
:straight t
|
||||
:after evil
|
||||
:config
|
||||
(evil-collection-init))
|
||||
|
||||
(use-package evil-org
|
||||
:straight t
|
||||
:after evil org
|
||||
:hook (org-mode . (lambda () evil-org-mode))
|
||||
:config
|
||||
(require 'evil-org-agenda)
|
||||
(evil-org-set-key-theme)
|
||||
(evil-org-agenda-set-keys))
|
||||
|
||||
;; Ensure org-agenda starts in evil-normal-state
|
||||
(defun aa/org-agenda-setup ()
|
||||
"Start org-agenda in evil-normal-state."
|
||||
(evil-org-mode)
|
||||
(evil-set-initial-state 'org-agenda-mode 'normal))
|
||||
|
||||
(add-hook 'org-agenda-mode-hook 'aa/org-agenda-setup)
|
||||
|
||||
;;; Email
|
||||
|
||||
(use-package counsel-notmuch
|
||||
:straight t
|
||||
:defer t)
|
||||
|
||||
(use-package notmuch
|
||||
;; Use the notmuch package that is installed
|
||||
:load-path "/usr/share/emacs/site-lisp"
|
||||
:config
|
||||
(setq notmuch-saved-searches '((:name "inbox"
|
||||
:key "i"
|
||||
:query "query:inbox"
|
||||
:sort-order oldest-first)))
|
||||
|
||||
(evil-define-key 'normal notmuch-search-mode-map
|
||||
"d" 'aa/notmuch-search-delete)
|
||||
(evil-define-key 'visual notmuch-search-mode-map
|
||||
"d" 'aa/notmuch-search-delete))
|
||||
|
||||
(defun aa/notmuch-search-inbox ()
|
||||
"Helper function to search for the inbox messages (oldest message first).
|
||||
This query is defined in the notmuch config to make it easier to search for
|
||||
inbox messages."
|
||||
(interactive)
|
||||
(notmuch-search "query:inbox" t))
|
||||
|
||||
(defun aa/notmuch-search-delete ()
|
||||
"When deleting messages we want to also make them unread. When a new message
|
||||
comes in the thread notmuch will show you all the messages, this makes it
|
||||
easier to see what is new."
|
||||
(interactive)
|
||||
(notmuch-search-tag (list "+deleted" "-inbox" "-unread"))
|
||||
(notmuch-tree-next-message))
|
||||
|
||||
(defun org-notmuch-open (id)
|
||||
"Visit the notmuch message or thread with id ID."
|
||||
(notmuch-show id))
|
||||
|
||||
(defun org-notmuch-store-link ()
|
||||
"Store a link to a notmuch mail message."
|
||||
(cl-case major-mode
|
||||
('notmuch-show-mode
|
||||
;; Store link to the current message
|
||||
(let* ((id (notmuch-show-get-message-id))
|
||||
(link (concat "notmuch:" id))
|
||||
(description (format "Mail: %s" (notmuch-show-get-subject))))
|
||||
(org-store-link-props
|
||||
:type "notmuch"
|
||||
:link link
|
||||
:description description)))
|
||||
('notmuch-search-mode
|
||||
;; Store link to the thread on the current line
|
||||
(let* ((id (notmuch-search-find-thread-id))
|
||||
(link (concat "notmuch:" id))
|
||||
(description (format "Mail: %s" (notmuch-search-find-subject))))
|
||||
(org-store-link-props
|
||||
:type "notmuch"
|
||||
:link link
|
||||
:description description)))))
|
||||
|
||||
(org-link-set-parameters
|
||||
"notmuch"
|
||||
:follow 'org-notmuch-open
|
||||
:store 'org-notmuch-store-link)
|
||||
|
||||
(defun aa/notmuch-show-view-as-patch ()
|
||||
"View the the current message as a patch.
|
||||
|
||||
See: https://notmuchmail.org/emacstips"
|
||||
(interactive)
|
||||
(let* ((id (notmuch-show-get-message-id))
|
||||
(msg (notmuch-show-get-message-properties))
|
||||
(part (notmuch-show-get-part-properties))
|
||||
(subject (concat "Subject: " (notmuch-show-get-subject) "\n"))
|
||||
(diff-default-read-only t)
|
||||
(buf (get-buffer-create (concat "*notmuch-patch-" id "*")))
|
||||
(map (make-sparse-keymap)))
|
||||
(define-key map "q" 'notmuch-bury-or-kill-this-buffer)
|
||||
(switch-to-buffer buf)
|
||||
(let ((inhibit-read-only t))
|
||||
(erase-buffer)
|
||||
(insert subject)
|
||||
(insert (notmuch-get-bodypart-text msg part nil)))
|
||||
(set-buffer-modified-p nil)
|
||||
(diff-mode)
|
||||
(lexical-let ((new-ro-bind (cons 'buffer-read-only map)))
|
||||
(add-to-list 'minor-mode-overriding-map-alist new-ro-bind))
|
||||
(goto-char (point-min))))
|
||||
|
||||
(use-package mbwatch
|
||||
:load-path "~/.emacs.d/mbwatch"
|
||||
:after notmuch
|
||||
:config
|
||||
(mbwatch-mode 1)
|
||||
(add-hook 'mbwatch-output-hook
|
||||
(lambda (account mailbox)
|
||||
(message "[mbwatch] new messages for account %s in mailbox %s" account mailbox)
|
||||
(notmuch-command-to-string "new"))))
|
||||
|
||||
;;; Sending email
|
||||
(use-package org-mime
|
||||
:straight t)
|
||||
|
||||
;; sendmail-program
|
||||
(setq send-mail-function 'sendmail-send-it
|
||||
sendmail-program "mailsend")
|
||||
|
||||
;;; Keybindings
|
||||
|
||||
(use-package general
|
||||
:straight t
|
||||
:config
|
||||
(general-create-definer efs/leader-keys
|
||||
(general-create-definer aa/leader-keys
|
||||
:keymaps '(normal insert visual emacs)
|
||||
:prefix "SPC"
|
||||
:global-prefix "C-SPC")
|
||||
|
||||
(efs/leader-keys
|
||||
(aa/leader-keys
|
||||
;; Global bindings
|
||||
"/" '(counsel-projectile-ag :which-key "Search Project")
|
||||
"TAB" '(evil-switch-to-windows-last-buffer :which-key "Last Buffer")
|
||||
"SPC" '(counsel-M-x :which-key "M-x")
|
||||
"a" '(projectile-toggle-between-implementation-and-test :which-key "Toggle test and implementation")
|
||||
";" '(evil-commentary-line :which-key "Comment")
|
||||
;; Docker
|
||||
"d" '(:ignore t :which-key "Docker")
|
||||
"dd" 'docker
|
||||
"di" 'docker-images
|
||||
"dc" 'docker-containers
|
||||
"/" '(counsel-projectile-ag :which-key "Search Project")
|
||||
"TAB" '(evil-switch-to-windows-last-buffer :which-key "Last Buffer")
|
||||
"SPC" '(counsel-M-x :which-key "M-x")
|
||||
|
||||
;; Jumping in a buffer
|
||||
"j" '(:ignore t :which-key "Jumps")
|
||||
"jj" 'evil-avy-goto-char-timer
|
||||
"jl" 'evil-avy-goto-line
|
||||
"j" '(:ignore t :which-key "Jumps")
|
||||
"jj" 'evil-avy-goto-char-timer
|
||||
"jl" 'evil-avy-goto-line
|
||||
|
||||
;; Searching
|
||||
"s" '(:ignore t :which-key "Searching")
|
||||
"ss" 'swiper
|
||||
"sS" 'swiper-thing-at-point
|
||||
"sb" 'swiper-all
|
||||
"sB" 'swiper-all-thing-at-point
|
||||
"s" '(:ignore t :which-key "Searching")
|
||||
"ss" 'swiper
|
||||
"sS" 'swiper-thing-at-point
|
||||
"sb" 'swiper-all
|
||||
"sB" 'swiper-all-thing-at-point
|
||||
|
||||
;; Windows. Just rebind all of the evil window bindings to "SPC w"
|
||||
;; so we dont have to keep hitting "CTRL-w"
|
||||
"w" '(evil-window-map :which-key "Windows")
|
||||
"wd" 'evil-window-delete
|
||||
;; Org Mode
|
||||
"o" '(evil-window-map :which-key "Org Mode")
|
||||
"oa" 'org-agenda
|
||||
"oc" 'org-capture
|
||||
;; Git
|
||||
"g" '(:ignore t :which-key "Git")
|
||||
"gs" 'magit-status
|
||||
"gd" 'magit-diff
|
||||
"gl" 'magit-log
|
||||
"gb" 'browse-at-remote
|
||||
;; Email
|
||||
"e" '(:ignore t :which-key "Email")
|
||||
"ei" 'aa/notmuch-search-inbox
|
||||
"eu" 'aa/notmuch-search-inbox-unread
|
||||
"es" 'counsel-notmuch
|
||||
"en" 'notmuch
|
||||
"ej" 'notmuch-jump-search
|
||||
;; Files
|
||||
"f" '(:ignore t :which-key "Files")
|
||||
"fs" 'save-buffer
|
||||
"ff" 'counsel-find-file
|
||||
;; Buffers
|
||||
"b" '(:ignore t :which-key "Buffers")
|
||||
"bd" 'kill-this-buffer
|
||||
"bb" 'counsel-switch-buffer
|
||||
;; LSP actions
|
||||
"l" '(:ignore t :which-key "LSP")
|
||||
"lr" 'lsp-workspace-restart
|
||||
"la" 'lsp-execute-code-action
|
||||
;; Projects
|
||||
"p" '(:ignore t :which-key "Projects")
|
||||
"p SPC" 'counsel-projectile
|
||||
"pb" 'counsel-projectile-switch-to-buffer
|
||||
"pd" 'counsel-projectile-find-dir
|
||||
"pp" 'counsel-projectile-switch-project
|
||||
"pf" 'counsel-projectile-find-file
|
||||
"pt" 'neotree-projectile-action
|
||||
"ps" 'projectile-run-vterm
|
||||
;; Toggles
|
||||
"t" '(:ignore t :which-key "Toggles")
|
||||
"tt" '(counsel-load-theme :which-key "choose theme")))
|
||||
"w" '(evil-window-map :which-key "Windows")
|
||||
"wd" 'evil-window-delete
|
||||
|
||||
(require 'server)
|
||||
(unless (server-running-p)
|
||||
(message "Starting a server...")
|
||||
(server-start))
|
||||
;; Org Mode
|
||||
"o" '(evil-window-map :which-key "Org Mode")
|
||||
"oa" 'org-agenda
|
||||
"oc" 'org-roam-dailies-capture-today
|
||||
"ot" 'org-roam-dailies-goto-today
|
||||
"of" 'org-roam-node-find
|
||||
"or" 'org-refile
|
||||
"ol" 'org-roam-link-replace-all
|
||||
|
||||
;; Files
|
||||
"f" '(:ignore t :which-key "Files")
|
||||
"fs" 'save-buffer
|
||||
"ff" 'counsel-find-file
|
||||
|
||||
;; Buffers
|
||||
"b" '(:ignore t :which-key "Buffers")
|
||||
"bd" 'kill-this-buffer
|
||||
"bb" 'counsel-switch-buffer
|
||||
|
||||
"e" '(:ignore t :which-key "Email")
|
||||
"ee" 'notmuch
|
||||
"ei" 'aa/notmuch-search-inbox
|
||||
"ej" 'notmuch-jump-search
|
||||
"es" 'counsel-notmuch
|
||||
|
||||
;; Toggles
|
||||
"t" '(:ignore t :which-key "Toggles")
|
||||
"tt" '(counsel-load-theme :which-key "choose theme")))
|
||||
|
|
|
|||
61
site-modules/core/files/emacs/mbwatch/mbwatch.el
Normal file
61
site-modules/core/files/emacs/mbwatch/mbwatch.el
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
;; mbwatch-mode.el --- Run mbwatch and handle its output -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar mbwatch-process nil
|
||||
"The process object for the mbwatch command.")
|
||||
|
||||
(defvar mbwatch-output-hook nil
|
||||
"Hook run when new output is received from the mbwatch process. Each function
|
||||
in this hook is called with a single argument, the new output.")
|
||||
|
||||
(defun mbwatch-start ()
|
||||
"Start the mbwatch process."
|
||||
(let ((process-buffer (get-buffer-create "*mbwatch*")))
|
||||
(with-current-buffer process-buffer
|
||||
(read-only-mode -1)
|
||||
(erase-buffer)
|
||||
(read-only-mode 1))
|
||||
|
||||
(setq mbwatch-process
|
||||
(start-process-shell-command
|
||||
"mbwatch" process-buffer "mbwatch"))
|
||||
|
||||
(set-process-filter
|
||||
mbwatch-process
|
||||
'mbwatch-process-filter)
|
||||
(message "mbwatch process started.")))
|
||||
|
||||
(defun mbwatch-stop ()
|
||||
"Stop the mbwatch process."
|
||||
(interactive)
|
||||
(when (and mbwatch-process (process-live-p mbwatch-process))
|
||||
(kill-process mbwatch-process)
|
||||
(setq mbwatch-process nil)))
|
||||
|
||||
|
||||
(defun mbwatch-process-filter (proc output)
|
||||
"Filter function for mbwatch process output.
|
||||
PROC is the process. OUTPUT is the new output."
|
||||
(with-current-buffer (process-buffer proc)
|
||||
(let ((inhibit-read-only t))
|
||||
(goto-char (point-max))
|
||||
(insert output))
|
||||
(mbwatch-handle-output output)))
|
||||
|
||||
(defun mbwatch-handle-output (output)
|
||||
"Handle new OUTPUT from the mbwatch process."
|
||||
(when (string-match "Synced changes for \\(.*?\\) in mailbox \\(.*?\\)$" output)
|
||||
(let ((account (match-string 1 output))
|
||||
(mailbox (match-string 2 output)))
|
||||
(run-hook-with-args 'mbwatch-output-hook account mailbox))))
|
||||
|
||||
(define-minor-mode mbwatch-mode
|
||||
"Minor mode to run mbwatch command and handle its output."
|
||||
:lighter " mbwatch"
|
||||
:global t
|
||||
(if mbwatch-mode
|
||||
(mbwatch-start)
|
||||
(mbwatch-stop)))
|
||||
|
||||
(provide 'mbwatch)
|
||||
|
||||
;;; mbwatch-mode.el ends here
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# Private directory for Yasnippets snippets
|
||||
|
||||
The content of this directory is ignored by Git. This is the default place where
|
||||
to store your private yasnippets.
|
||||
|
||||
This path will be loaded automatically and used whenever Yasnippets loads.
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: #ifndef XXX; #define XXX; #endif
|
||||
# key: once
|
||||
# uuid: once
|
||||
# --
|
||||
#ifndef ${1:`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H}
|
||||
#define $1
|
||||
|
||||
$0
|
||||
|
||||
#endif /* $1 */
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Practically BSD licence
|
||||
# key: pbsd
|
||||
# --
|
||||
// Copyright 2021 Practically.io All rights reserved
|
||||
//
|
||||
// Use of this source is governed by a BSD-style
|
||||
// licence that can be found in the LICENCE file or at
|
||||
// https://www.practically.io/copyright/
|
||||
$0
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: #ifndef XXX; #define XXX; #endif
|
||||
# key: once
|
||||
# uuid: once
|
||||
# --
|
||||
#ifndef ${1:`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H}
|
||||
#define $1
|
||||
|
||||
$0
|
||||
|
||||
#endif /* $1 */
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Practically BSD licence
|
||||
# key: pbsd
|
||||
# --
|
||||
// Copyright 2021 Practically.io All rights reserved
|
||||
//
|
||||
// Use of this source is governed by a BSD-style
|
||||
// licence that can be found in the LICENCE file or at
|
||||
// https://www.practically.io/copyright/
|
||||
$0
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: /// <summary> ... </summary>
|
||||
# key: ///
|
||||
# --
|
||||
/// <summary>
|
||||
/// $0
|
||||
/// </summary>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: /// <inheritdoc ... />
|
||||
# key: ///i
|
||||
# --
|
||||
/// <inheritdoc${1: cref="${2:Class}"} />$0
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Practically BSD licence
|
||||
# key: pbsd
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# uuid: pbsd
|
||||
# --
|
||||
/// <copyright file="`(file-name-nondirectory (buffer-file-name))`" company="Practically.io">
|
||||
/// Copyright `(format-time-string "%Y")` Practically.io All rights reserved
|
||||
///
|
||||
/// Use of this source is governed by a BSD-style
|
||||
/// licence that can be found in the LICENCE file or at
|
||||
/// https://www.practically.io/copyright/
|
||||
/// </copyright>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Class property
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# key: prop
|
||||
# uuid: prop
|
||||
# --
|
||||
public ${1:int} ${2:Name} { get; set; }${3: = ${4:"Default"}}$0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: ES Import
|
||||
# key: import
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
import {${2:Import}} from '$1';
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Table
|
||||
# key: table
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
| One | Two |
|
||||
| --- | --- |
|
||||
| 1 | 2 |
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Org Mode Header
|
||||
# key: org-header
|
||||
# --
|
||||
#+TITLE: ${1:Title}
|
||||
#+AUTHOR: Ade Attwood
|
||||
#+EMAIL: hello@adeattwood.co.uk
|
||||
#+DATE: `(format-time-string "%Y-%m-%d")`
|
||||
#+FILETAGS:
|
||||
#+SETUPFILE: ../common/setup.org
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
;;; .yas-setup.el --- Yasnippet helper functions for PHP snippets
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
(require 'yasnippet)
|
||||
|
||||
(defun yas-php-get-class-name-by-file-name ()
|
||||
"Return name of class-like construct by `file-name'.
|
||||
\"class-like\" contains class, trait and interface."
|
||||
(file-name-nondirectory
|
||||
(file-name-sans-extension (or (buffer-file-name)
|
||||
(buffer-name (current-buffer))))))
|
||||
|
||||
;;; .yas-setup.el ends here
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: PHP Tags
|
||||
# key: php
|
||||
# --
|
||||
<?php $0 ?>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Array item
|
||||
# key: ai
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
'$1' => $0
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Class definition
|
||||
# key: class
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace NameSpace;
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*/
|
||||
class ${1:`(yas-php-get-class-name-by-file-name)`}${2: extends ${3:ExtendsClass}}${4: implements ${5:ImpementsInterface}}
|
||||
{
|
||||
$0
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: const
|
||||
# key: const
|
||||
# --
|
||||
const ${1:NAME$(upcase yas-text)} = '${1:$(string-inflection-underscore-function yas-text)}';
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Declare strict types decoration
|
||||
# key: dst
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
declare(strict_types = 1);
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Practically BSD licence
|
||||
# key: pbsd
|
||||
# --
|
||||
/**
|
||||
* Copyright 2021 Practically.io All rights reserved
|
||||
*
|
||||
* Use of this source is governed by a BSD-style
|
||||
* licence that can be found in the LICENCE file or at
|
||||
* https://www.practically.io/copyright/
|
||||
*/
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: PHP Echo tags
|
||||
# key: phpe
|
||||
# --
|
||||
<?= $0 ?>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: PHP if statment in view
|
||||
# key: phpif
|
||||
# --
|
||||
<?php if ($1) : ?>
|
||||
$0
|
||||
<?php endif; ?>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Public function
|
||||
# key: pub
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return $4
|
||||
*/
|
||||
public function ${1:name}(${2:params})${3::${4:returns}}
|
||||
{
|
||||
$0
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Public static function
|
||||
# key: pubs
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return $4
|
||||
*/
|
||||
public static function ${1:name}(${2:params})${3::${4:returns}}
|
||||
{
|
||||
$0
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: This
|
||||
# key: this
|
||||
# --
|
||||
$this->$0
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Var doc for php view files
|
||||
# key: var-doc
|
||||
# --
|
||||
echo '<pre>';
|
||||
echo '/**'.PHP_EOL;
|
||||
echo ' *'.PHP_EOL;
|
||||
$_type = gettype($this) == 'object' ? get_class($this) : gettype($this);
|
||||
echo " * @var $_type \\$this\n";
|
||||
foreach(get_defined_vars() as $name => $var) {
|
||||
if (substr($name, 0, strlen('_')) !== '_' && $name !== 'this') {
|
||||
if (is_array($var) && isset($var[0]) && gettype($var[0]) == 'object') {
|
||||
$type = get_class($var[0]);
|
||||
echo " * @var {$type}[] \\$$name\n";
|
||||
continue;
|
||||
}
|
||||
$type = gettype($var) == 'object' ? get_class($var) : gettype($var);
|
||||
echo " * @var $type \\$$name\n";
|
||||
}
|
||||
}
|
||||
echo ' */'.PHP_EOL;
|
||||
echo "</pre>";
|
||||
die;
|
||||
|
|
@ -1 +0,0 @@
|
|||
js-mode
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
;; Capitalise the first letter in a string
|
||||
(defun aa/yas/rjsx/capitalize-first-cha (&optional string)
|
||||
"Capitalise only the first character of the input STRING."
|
||||
(when (and string (> (length string) 0))
|
||||
(let ((first-char (substring string nil 1))
|
||||
(rest-str (substring string 1)))
|
||||
(concat (capitalize first-char) rest-str))))
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: React import
|
||||
# key: react
|
||||
# condition: (eq major-mode 'rjsx-mode)
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: React functional component
|
||||
# key: rfc
|
||||
# condition: (eq major-mode 'rjsx-mode)
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
export const ${1:Component} = (${2:props}) => {
|
||||
return (
|
||||
${0:<div>Content</div>}
|
||||
);
|
||||
};
|
||||
|
||||
$1.propTypes = {};
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: React useEffect hook
|
||||
# key: useEffec
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
React.useEffect(() => {
|
||||
`yas-selected-text`$0
|
||||
}, [${1:dependcides}]);
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: React useState
|
||||
# key: useState
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
const [${1:state}, set${1:$(aa/yas/rjsx/capitalize-first-cha yas-text)}] = React.useState(${2:initialState});
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Practically BDS licence
|
||||
# key: pbsd
|
||||
# --
|
||||
# Copyright 2021 Practically.io All rights reserved
|
||||
#
|
||||
# Use of this source is governed by a BSD-style
|
||||
# licence that can be found in the LICENCE file or at
|
||||
# https://www.practically.io/copyright/
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: shebang
|
||||
# key: #!
|
||||
# --
|
||||
#!/usr/bin/env bash
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Breaking change block in commit message
|
||||
# key: bc
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
BREAKING CHANGE: ${0:Description}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Chore commit message
|
||||
# key: chore
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
chore(${1:scope}): ${2:title}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Continuous intergration commit message
|
||||
# key: ci
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
ci(${1:scope}): ${2:title}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Documentation commit message
|
||||
# key: docs
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
docs(${1:scope}): ${2:title}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Feature commit message
|
||||
# key: feat
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
feat(${1:scope}): ${2:title}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Bug fix commit message
|
||||
# key: fix
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
fix(${1:scope}): ${2:title}
|
||||
|
||||
${3:discription}
|
||||
|
||||
fixes issue ${3:issue number}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Performance commit message
|
||||
# key: pref
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
pref(${1:scope}): ${2:title}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Refactor commit message
|
||||
# key: refactor
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
refactor(${1:scope}): ${2:title}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Security footer in a commit message
|
||||
# key: sec
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
SECURITY: ${0:Description}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Code styling commit message
|
||||
# key: style
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
style(${1:scope}): ${2:title}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Test commit message
|
||||
# key: test
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
test(${1:scope}): ${2:title}
|
||||
|
|
@ -1 +0,0 @@
|
|||
js-mode
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: It testing helper function
|
||||
# key: it
|
||||
# --
|
||||
it('${1: description}', async () => {
|
||||
$0
|
||||
});
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: LitElement
|
||||
# key: lit-element
|
||||
# --
|
||||
import { LitElement, html, css } from 'lit-element';
|
||||
import { customElement, property } from 'lit-element/decorators.js';
|
||||
|
||||
@customElement('${1:x-component}')
|
||||
export class Component extends LitElement {
|
||||
static get styles() {
|
||||
return css\`:host {}\`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html\`<div>Content</div>\`;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
rjsx-mode
|
||||
typescript-mode
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: React class component
|
||||
# key: rc
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
export interface $1State {};
|
||||
export interface $1Props {};
|
||||
|
||||
export class ${1:Name} extends React.Component<$1Props, $1State> {
|
||||
public state: $1State = {}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
${0:<div>Component</div>}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: React import
|
||||
# key: react
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
import React from 'react';
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: React functional component
|
||||
# key: rfc
|
||||
# contributor: Ade Attwood <code@adeattwood.co.uk>
|
||||
# --
|
||||
export interface $1Props {};
|
||||
|
||||
export const ${1:Name}:React.FC<$1Props> = (${2:props}) => {
|
||||
return (
|
||||
${0:<div>Component</div>}
|
||||
);
|
||||
};
|
||||
|
|
@ -1,601 +0,0 @@
|
|||
;; -*- 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 '(
|
||||
;; Custom Layers
|
||||
private
|
||||
|
||||
;; Base Layers
|
||||
git puppet version-control helm markdown docker spell-checking notmuch
|
||||
(treemacs :variables treemacs-use-all-the-icons-theme t)
|
||||
(lsp :variables lsp-enable-file-watchers nil lsp-headerline-breadcrumb-enable nil)
|
||||
(org :variables org-enable-reveal-js-support t)
|
||||
(shell :variables
|
||||
terminal-here-terminal-command (list "alacritty")
|
||||
shell-default-height 40
|
||||
shell-default-position 'bottom)
|
||||
(unicode-fonts :variables
|
||||
unicode-fonts-enable-ligatures t
|
||||
unicode-fonts-ligature-modes '(prog-mode))
|
||||
(auto-completion :variables
|
||||
auto-completion-enable-snippets-in-popup t
|
||||
auto-completion-minimum-prefix-length 1
|
||||
auto-completion-enable-help-tooltip t
|
||||
auto-completion-use-company-box t
|
||||
auto-completion-enable-sort-by-usage t)
|
||||
|
||||
;; Work Layers
|
||||
react prettier yaml
|
||||
(typescript :variables typescript-backend 'lsp typescript-fmt-tool 'prettier typescript-linter 'eslint)
|
||||
(javascript :variables javascript-backend 'lsp javascript-fmt-tool 'prettier)
|
||||
(html :variables css-enable-lsp t html-enable-lsp t)
|
||||
(php :variables php-backend 'lsp)
|
||||
(csharp :variables csharp-backend 'lsp)
|
||||
|
||||
;; Play Layers
|
||||
emacs-lisp chrome
|
||||
(go :variables go-backend 'lsp go-tab-width 4 go-format-before-save t)
|
||||
;;(dart :variables dart-backend 'lsp lsp-dart-sdk-dir "~/snap/flutter/common/flutter/bin/cache/dart-sdk/")
|
||||
(elfeed :variables
|
||||
elfeed-feeds '(("https://www.php.net/feed.atom" dev php)
|
||||
("https://feeds.feedburner.com/d0od" blog dev)
|
||||
("https://protesilaos.com/news.xml" blog updates)
|
||||
("https://protesilaos.com/codelog.xml" blog dev emacs)
|
||||
("https://linuxscoop.com/feed" blog linux)
|
||||
("https://cestlaz.github.io/rss.xml" blog dev emacs)
|
||||
("https://changelog.com/feed" blog dev)
|
||||
("https://fedoramagazine.org/feed/" blog dev))))
|
||||
|
||||
;; List of additional packages that will be installed without being
|
||||
;; wrapped in a layer. 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 '(base16-theme doom-themes)
|
||||
|
||||
;; A list of packages that cannot be updated.
|
||||
dotspacemacs-frozen-packages '()
|
||||
|
||||
;; A list of packages that will not be installed and loaded.
|
||||
dotspacemacs-excluded-packages '()
|
||||
|
||||
;; 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,
|
||||
before layer configuration.
|
||||
It should only modify the values of Spacemacs settings."
|
||||
;; This setq-default sexp is an exhaustive list of all the supported
|
||||
;; spacemacs settings.
|
||||
(setq-default
|
||||
;; If non-nil then enable support for the portable dumper. You'll need
|
||||
;; to compile Emacs 27 from source following the instructions in file
|
||||
;; EXPERIMENTAL.org at to root of the git repository.
|
||||
;; (default nil)
|
||||
dotspacemacs-enable-emacs-pdumper nil
|
||||
|
||||
;; Name of executable file pointing to emacs 27+. This executable must be
|
||||
;; in your PATH.
|
||||
;; (default "emacs")
|
||||
dotspacemacs-emacs-pdumper-executable-file "emacs"
|
||||
|
||||
;; Name of the Spacemacs dump file. This is the file will be created by the
|
||||
;; portable dumper in the cache directory under dumps sub-directory.
|
||||
;; To load it when starting Emacs add the parameter `--dump-file'
|
||||
;; when invoking Emacs 27.1 executable on the command line, for instance:
|
||||
;; ./emacs --dump-file=$HOME/.emacs.d/.cache/dumps/spacemacs-27.1.pdmp
|
||||
;; (default spacemacs-27.1.pdmp)
|
||||
dotspacemacs-emacs-dumper-dump-file (format "spacemacs-%s.pdmp" emacs-version)
|
||||
|
||||
;; If non-nil ELPA repositories are contacted via HTTPS whenever it's
|
||||
;; possible. Set it to nil if you have no way to use HTTPS in your
|
||||
;; environment, otherwise it is strongly recommended to let it set to t.
|
||||
;; This variable has no effect if Emacs is launched with the parameter
|
||||
;; `--insecure' which forces the value of this variable to nil.
|
||||
;; (default t)
|
||||
dotspacemacs-elpa-https t
|
||||
|
||||
;; Maximum allowed time in seconds to contact an ELPA repository.
|
||||
;; (default 5)
|
||||
dotspacemacs-elpa-timeout 5
|
||||
|
||||
;; Set `gc-cons-threshold' and `gc-cons-percentage' when startup finishes.
|
||||
;; This is an advanced option and should not be changed unless you suspect
|
||||
;; performance issues due to garbage collection operations.
|
||||
;; (default '(100000000 0.1))
|
||||
dotspacemacs-gc-cons '(100000000 0.1)
|
||||
|
||||
;; Set `read-process-output-max' when startup finishes.
|
||||
;; This defines how much data is read from a foreign process.
|
||||
;; Setting this >= 1 MB should increase performance for lsp servers
|
||||
;; in emacs 27.
|
||||
;; (default (* 1024 1024))
|
||||
dotspacemacs-read-process-output-max (* 1024 1024)
|
||||
|
||||
;; If non-nil then Spacelpa repository is the primary source to install
|
||||
;; a locked version of packages. If nil then Spacemacs will install the
|
||||
;; latest version of packages from MELPA. (default nil)
|
||||
dotspacemacs-use-spacelpa nil
|
||||
|
||||
;; If non-nil then verify the signature for downloaded Spacelpa archives.
|
||||
;; (default t)
|
||||
dotspacemacs-verify-spacelpa-archives t
|
||||
|
||||
;; If non-nil then spacemacs will check for updates at startup
|
||||
;; when the current branch is not `develop'. Note that checking for
|
||||
;; new versions works via git commands, thus it calls GitHub services
|
||||
;; whenever you start Emacs. (default nil)
|
||||
dotspacemacs-check-for-update nil
|
||||
|
||||
;; If non-nil, a form that evaluates to a package directory. For example, to
|
||||
;; use different package directories for different Emacs versions, set this
|
||||
;; to `emacs-version'. (default 'emacs-version)
|
||||
dotspacemacs-elpa-subdirectory 'emacs-version
|
||||
|
||||
;; One of `vim', `emacs' or `hybrid'.
|
||||
;; `hybrid' is like `vim' except that `insert state' is replaced by the
|
||||
;; `hybrid state' with `emacs' key bindings. The value can also be a list
|
||||
;; with `:variables' keyword (similar to layers). Check the editing styles
|
||||
;; section of the documentation for details on available variables.
|
||||
;; (default 'vim)
|
||||
dotspacemacs-editing-style 'vim
|
||||
|
||||
;; If non-nil show the version string in the Spacemacs buffer. It will
|
||||
;; appear as (spacemacs version)@(emacs version)
|
||||
;; (default t)
|
||||
dotspacemacs-startup-buffer-show-version t
|
||||
|
||||
;; Specify the startup banner. Default value is `official', it displays
|
||||
;; the official spacemacs logo. An integer value is the index of text
|
||||
;; banner, `random' chooses a random text banner in `core/banners'
|
||||
;; directory. A string value must be a path to an image format supported
|
||||
;; by your Emacs build.
|
||||
;; If the value is nil then no banner is displayed. (default 'official)
|
||||
dotspacemacs-startup-banner 'official
|
||||
|
||||
;; List of items to show in startup buffer or an association list of
|
||||
;; the form `(list-type . list-size)`. If nil then it is disabled.
|
||||
;; Possible values for list-type are:
|
||||
;; `recents' `bookmarks' `projects' `agenda' `todos'.
|
||||
;; List sizes may be nil, in which case
|
||||
;; `spacemacs-buffer-startup-lists-length' takes effect.
|
||||
dotspacemacs-startup-lists '((recents . 5)
|
||||
(projects . 7))
|
||||
|
||||
;; True if the home buffer should respond to resize events. (default t)
|
||||
dotspacemacs-startup-buffer-responsive t
|
||||
|
||||
;; Default major mode for a new empty buffer. Possible values are mode
|
||||
;; names such as `text-mode'; and `nil' to use Fundamental mode.
|
||||
;; (default `text-mode')
|
||||
dotspacemacs-new-empty-buffer-major-mode 'text-mode
|
||||
|
||||
;; Default major mode of the scratch buffer (default `text-mode')
|
||||
dotspacemacs-scratch-mode 'text-mode
|
||||
|
||||
;; Initial message in the scratch buffer, such as "Welcome to Spacemacs!"
|
||||
;; (default nil)
|
||||
dotspacemacs-initial-scratch-message nil
|
||||
|
||||
;; List of themes, the first of the list is loaded when spacemacs starts.
|
||||
;; Press `SPC T n' to cycle to the next theme in the list (works great
|
||||
;; with 2 themes variants, one dark and one light)
|
||||
dotspacemacs-themes '(base16-ocean
|
||||
base16-tomorrow-night
|
||||
spacemacs-dark)
|
||||
|
||||
;; Set the theme for the Spaceline. Supported themes are `spacemacs',
|
||||
;; `all-the-icons', `custom', `doom', `vim-powerline' and `vanilla'. The
|
||||
;; first three are spaceline themes. `doom' is the doom-emacs mode-line.
|
||||
;; `vanilla' is default Emacs mode-line. `custom' is a user defined themes,
|
||||
;; refer to the DOCUMENTATION.org for more info on how to create your own
|
||||
;; spaceline theme. Value can be a symbol or list with additional properties.
|
||||
;; (default '(spacemacs :separator wave :separator-scale 1.5))
|
||||
dotspacemacs-mode-line-theme '(doom :separator nil :separator-scale 1.5)
|
||||
|
||||
;; If non-nil the cursor color matches the state color in GUI Emacs.
|
||||
;; (default t)
|
||||
dotspacemacs-colorize-cursor-according-to-state t
|
||||
|
||||
;; Default font or prioritized list of fonts.
|
||||
;;dotspacemacs-default-font '("Fira Code" :size 10.0)
|
||||
;; dotspacemacs-default-font '("LigaFreeMono" :size 12.0)
|
||||
dotspacemacs-default-font '("Hasklig" :size 12.0)
|
||||
|
||||
;; The leader key (default "SPC")
|
||||
dotspacemacs-leader-key "SPC"
|
||||
|
||||
;; The key used for Emacs commands `M-x' (after pressing on the leader key).
|
||||
;; (default "SPC")
|
||||
dotspacemacs-emacs-command-key "SPC"
|
||||
|
||||
;; The key used for Vim Ex commands (default ":")
|
||||
dotspacemacs-ex-command-key ":"
|
||||
|
||||
;; The leader key accessible in `emacs state' and `insert state'
|
||||
;; (default "M-m")
|
||||
dotspacemacs-emacs-leader-key "M-m"
|
||||
|
||||
;; Major mode leader key is a shortcut key which is the equivalent of
|
||||
;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
|
||||
dotspacemacs-major-mode-leader-key ","
|
||||
|
||||
;; Major mode leader key accessible in `emacs state' and `insert state'.
|
||||
;; (default "C-M-m" for terminal mode, "<M-return>" for GUI mode).
|
||||
;; Thus M-RET should work as leader key in both GUI and terminal modes.
|
||||
;; C-M-m also should work in terminal mode, but not in GUI mode.
|
||||
dotspacemacs-major-mode-emacs-leader-key (if window-system "<M-return>" "C-M-m")
|
||||
|
||||
;; These variables control whether separate commands are bound in the GUI to
|
||||
;; the key pairs `C-i', `TAB' and `C-m', `RET'.
|
||||
;; Setting it to a non-nil value, allows for separate commands under `C-i'
|
||||
;; and TAB or `C-m' and `RET'.
|
||||
;; In the terminal, these pairs are generally indistinguishable, so this only
|
||||
;; works in the GUI. (default nil)
|
||||
dotspacemacs-distinguish-gui-tab nil
|
||||
|
||||
;; Name of the default layout (default "Default")
|
||||
dotspacemacs-default-layout-name "Default"
|
||||
|
||||
;; If non-nil the default layout name is displayed in the mode-line.
|
||||
;; (default nil)
|
||||
dotspacemacs-display-default-layout nil
|
||||
|
||||
;; If non-nil then the last auto saved layouts are resumed automatically upon
|
||||
;; start. (default nil)
|
||||
dotspacemacs-auto-resume-layouts nil
|
||||
|
||||
;; If non-nil, auto-generate layout name when creating new layouts. Only has
|
||||
;; effect when using the "jump to layout by number" commands. (default nil)
|
||||
dotspacemacs-auto-generate-layout-names nil
|
||||
|
||||
;; Size (in MB) above which spacemacs will prompt to open the large file
|
||||
;; literally to avoid performance issues. Opening a file literally means that
|
||||
;; no major mode or minor modes are active. (default is 1)
|
||||
dotspacemacs-large-file-size 1
|
||||
|
||||
;; Location where to auto-save files. Possible values are `original' to
|
||||
;; auto-save the file in-place, `cache' to auto-save the file to another
|
||||
;; file stored in the cache directory and `nil' to disable auto-saving.
|
||||
;; (default 'cache)
|
||||
dotspacemacs-auto-save-file-location nil
|
||||
|
||||
;; Maximum number of rollback slots to keep in the cache. (default 5)
|
||||
dotspacemacs-max-rollback-slots 0
|
||||
|
||||
;; If non-nil, the paste transient-state is enabled. While enabled, after you
|
||||
;; paste something, pressing `C-j' and `C-k' several times cycles through the
|
||||
;; elements in the `kill-ring'. (default nil)
|
||||
dotspacemacs-enable-paste-transient-state nil
|
||||
|
||||
;; Which-key delay in seconds. The which-key buffer is the popup listing
|
||||
;; the commands bound to the current keystroke sequence. (default 0.4)
|
||||
dotspacemacs-which-key-delay 0.4
|
||||
|
||||
;; Which-key frame position. Possible values are `right', `bottom' and
|
||||
;; `right-then-bottom'. right-then-bottom tries to display the frame to the
|
||||
;; right; if there is insufficient space it displays it at the bottom.
|
||||
;; (default 'bottom)
|
||||
dotspacemacs-which-key-position 'bottom
|
||||
|
||||
;; Control where `switch-to-buffer' displays the buffer. If nil,
|
||||
;; `switch-to-buffer' displays the buffer in the current window even if
|
||||
;; another same-purpose window is available. If non-nil, `switch-to-buffer'
|
||||
;; displays the buffer in a same-purpose window even if the buffer can be
|
||||
;; displayed in the current window. (default nil)
|
||||
dotspacemacs-switch-to-buffer-prefers-purpose nil
|
||||
|
||||
;; If non-nil a progress bar is displayed when spacemacs is loading. This
|
||||
;; may increase the boot time on some systems and emacs builds, set it to
|
||||
;; nil to boost the loading time. (default t)
|
||||
dotspacemacs-loading-progress-bar t
|
||||
|
||||
;; If non-nil the frame is fullscreen when Emacs starts up. (default nil)
|
||||
;; (Emacs 24.4+ only)
|
||||
dotspacemacs-fullscreen-at-startup nil
|
||||
|
||||
;; If non-nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
|
||||
;; Use to disable fullscreen animations in OSX. (default nil)
|
||||
dotspacemacs-fullscreen-use-non-native nil
|
||||
|
||||
;; If non-nil the frame is maximized when Emacs starts up.
|
||||
;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
|
||||
;; (default nil) (Emacs 24.4+ only)
|
||||
dotspacemacs-maximized-at-startup nil
|
||||
|
||||
;; If non-nil the frame is undecorated when Emacs starts up. Combine this
|
||||
;; variable with `dotspacemacs-maximized-at-startup' in OSX to obtain
|
||||
;; borderless fullscreen. (default nil)
|
||||
dotspacemacs-undecorated-at-startup nil
|
||||
|
||||
;; A value from the range (0..100), in increasing opacity, which describes
|
||||
;; the transparency level of a frame when it's active or selected.
|
||||
;; Transparency can be toggled through `toggle-transparency'. (default 90)
|
||||
dotspacemacs-active-transparency 90
|
||||
|
||||
;; A value from the range (0..100), in increasing opacity, which describes
|
||||
;; the transparency level of a frame when it's inactive or deselected.
|
||||
;; Transparency can be toggled through `toggle-transparency'. (default 90)
|
||||
dotspacemacs-inactive-transparency 90
|
||||
|
||||
;; If non-nil show the titles of transient states. (default t)
|
||||
dotspacemacs-show-transient-state-title t
|
||||
|
||||
;; If non-nil show the color guide hint for transient state keys. (default t)
|
||||
dotspacemacs-show-transient-state-color-guide t
|
||||
|
||||
;; If non-nil unicode symbols are displayed in the mode line.
|
||||
;; If you use Emacs as a daemon and wants unicode characters only in GUI set
|
||||
;; the value to quoted `display-graphic-p'. (default t)
|
||||
dotspacemacs-mode-line-unicode-symbols t
|
||||
|
||||
;; If non-nil smooth scrolling (native-scrolling) is enabled. Smooth
|
||||
;; scrolling overrides the default behavior of Emacs which recenters point
|
||||
;; when it reaches the top or bottom of the screen. (default t)
|
||||
dotspacemacs-smooth-scrolling t
|
||||
|
||||
;; Control line numbers activation.
|
||||
;; If set to `t', `relative' or `visual' then line numbers are enabled in all
|
||||
;; `prog-mode' and `text-mode' derivatives. If set to `relative', line
|
||||
;; numbers are relative. If set to `visual', line numbers are also relative,
|
||||
;; but lines are only visual lines are counted. For example, folded lines
|
||||
;; will not be counted and wrapped lines are counted as multiple lines.
|
||||
;; This variable can also be set to a property list for finer control:
|
||||
;; '(:relative nil
|
||||
;; :visual nil
|
||||
;; :disabled-for-modes dired-mode
|
||||
;; doc-view-mode
|
||||
;; markdown-mode
|
||||
;; org-mode
|
||||
;; pdf-view-mode
|
||||
;; text-mode
|
||||
;; :size-limit-kb 1000)
|
||||
;; When used in a plist, `visual' takes precedence over `relative'.
|
||||
;; (default nil)
|
||||
dotspacemacs-line-numbers nil
|
||||
|
||||
;; Code folding method. Possible values are `evil' and `origami'.
|
||||
;; (default 'evil)
|
||||
dotspacemacs-folding-method 'evil
|
||||
|
||||
;; If non-nil `smartparens-strict-mode' will be enabled in programming modes.
|
||||
;; (default nil)
|
||||
dotspacemacs-smartparens-strict-mode nil
|
||||
|
||||
;; If non-nil pressing the closing parenthesis `)' key in insert mode passes
|
||||
;; over any automatically added closing parenthesis, bracket, quote, etc...
|
||||
;; This can be temporary disabled by pressing `C-q' before `)'. (default nil)
|
||||
dotspacemacs-smart-closing-parenthesis nil
|
||||
|
||||
;; Select a scope to highlight delimiters. Possible values are `any',
|
||||
;; `current', `all' or `nil'. Default is `all' (highlight any scope and
|
||||
;; emphasis the current one). (default 'all)
|
||||
dotspacemacs-highlight-delimiters 'all
|
||||
|
||||
;; If non-nil, start an Emacs server if one is not already running.
|
||||
;; (default nil)
|
||||
dotspacemacs-enable-server t
|
||||
|
||||
;; Set the emacs server socket location.
|
||||
;; If nil, uses whatever the Emacs default is, otherwise a directory path
|
||||
;; like \"~/.emacs.d/server\". It has no effect if
|
||||
;; `dotspacemacs-enable-server' is nil.
|
||||
;; (default nil)
|
||||
dotspacemacs-server-socket-dir nil
|
||||
|
||||
;; If non-nil, advise quit functions to keep server open when quitting.
|
||||
;; (default nil)
|
||||
dotspacemacs-persistent-server nil
|
||||
|
||||
;; List of search tool executable names. Spacemacs uses the first installed
|
||||
;; tool of the list. Supported tools are `rg', `ag', `pt', `ack' and `grep'.
|
||||
;; (default '("rg" "ag" "pt" "ack" "grep"))
|
||||
dotspacemacs-search-tools '("ag" "rg" "pt" "ack" "grep")
|
||||
|
||||
;; Format specification for setting the frame title.
|
||||
;; %a - the `abbreviated-file-name', or `buffer-name'
|
||||
;; %t - `projectile-project-name'
|
||||
;; %I - `invocation-name'
|
||||
;; %S - `system-name'
|
||||
;; %U - contents of $USER
|
||||
;; %b - buffer name
|
||||
;; %f - visited file name
|
||||
;; %F - frame name
|
||||
;; %s - process status
|
||||
;; %p - percent of buffer above top of window, or Top, Bot or All
|
||||
;; %P - percent of buffer above bottom of window, perhaps plus Top, or Bot or All
|
||||
;; %m - mode name
|
||||
;; %n - Narrow if appropriate
|
||||
;; %z - mnemonics of buffer, terminal, and keyboard coding systems
|
||||
;; %Z - like %z, but including the end-of-line format
|
||||
;; (default "%I@%S")
|
||||
dotspacemacs-frame-title-format '"%I@%S"
|
||||
|
||||
;; Format specification for setting the icon title format
|
||||
;; (default nil - same as frame-title-format)
|
||||
dotspacemacs-icon-title-format nil
|
||||
|
||||
;; Delete whitespace while saving buffer. Possible values are `all'
|
||||
;; to aggressively delete empty line and long sequences of whitespace,
|
||||
;; `trailing' to delete only the whitespace at end of lines, `changed' to
|
||||
;; delete only whitespace for changed lines or `nil' to disable cleanup.
|
||||
;; (default nil)
|
||||
dotspacemacs-whitespace-cleanup t
|
||||
|
||||
;; If non nil activate `clean-aindent-mode' which tries to correct
|
||||
;; virtual indentation of simple modes. This can interfer with mode specific
|
||||
;; indent handling like has been reported for `go-mode'.
|
||||
;; If it does deactivate it here.
|
||||
;; (default t)
|
||||
dotspacemacs-use-clean-aindent-mode t
|
||||
|
||||
;; Either nil or a number of seconds. If non-nil zone out after the specified
|
||||
;; number of seconds. (default nil)
|
||||
dotspacemacs-zone-out-when-idle nil
|
||||
|
||||
;; Run `spacemacs/prettify-org-buffer' when
|
||||
;; visiting README.org files of Spacemacs.
|
||||
;; (default nil)
|
||||
dotspacemacs-pretty-docs nil))
|
||||
|
||||
;; (with-eval-after-load 'org
|
||||
;; (setq org-directory "~/Nextcloud/org"))
|
||||
|
||||
(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."
|
||||
|
||||
;; Fix terminal color theme for base16
|
||||
;; See: https://github.com/belak/base16-emacs#terminal-colors
|
||||
;; See: https://github.com/belak/base16-emacs/issues/73#issuecomment-721942335
|
||||
(setq base16-theme-256-color-source 'base16-shell)
|
||||
(setq base16-distinct-fringe-background nil)
|
||||
|
||||
;; doom modeline config
|
||||
(setq doom-modeline-icon t)
|
||||
|
||||
;; Force magit status to go full screen
|
||||
(setq-default git-magit-status-fullscreen t))
|
||||
|
||||
(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."
|
||||
|
||||
;; Enable company auto completion globally
|
||||
(global-company-mode)
|
||||
|
||||
;; Disable lock files to it dose not create .#file.txt when editing a file.
|
||||
;; This causes webpack and react dev server to crash
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
;; Set scroll offset to emulate vims `scrolloff`
|
||||
(setq scroll-margin 30)
|
||||
|
||||
;; Disable line wraping
|
||||
(add-hook 'hack-local-variables-hook (lambda () (setq truncate-lines t)))
|
||||
|
||||
;; Set window movement to CTRL hjkl to emulate tmux vim interaction
|
||||
(global-set-key (kbd "C-h") 'evil-window-left)
|
||||
(global-set-key (kbd "C-j") 'evil-window-down)
|
||||
(global-set-key (kbd "C-l") 'evil-window-right)
|
||||
(global-set-key (kbd "C-k") 'evil-window-up)
|
||||
|
||||
;; Allow CTRL-r to search back in the terminal
|
||||
(defun aa/setup-term-mode ()
|
||||
(evil-local-set-key 'insert (kbd "C-r") 'aa/send-C-r))
|
||||
|
||||
(defun aa/send-C-r ()
|
||||
(interactive)
|
||||
(term-send-raw-string "\C-r"))
|
||||
|
||||
(add-hook 'vterm-mode-hook 'aa/setup-term-mode)
|
||||
(add-hook 'term-mode-hook 'aa/setup-term-mode)
|
||||
|
||||
;; Sort out line numbers
|
||||
;; https://stackoverflow.com/a/23857738
|
||||
(defadvice server-visit-files (before parse-numbers-in-lines (files proc &optional nowait) activate)
|
||||
"looks for filenames like file:line or file:line:position and reparses name in such manner that position in file"
|
||||
(ad-set-arg 0
|
||||
(mapcar (lambda (fn)
|
||||
(let ((name (car fn)))
|
||||
(if (string-match "^\\(.*?\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?$" name)
|
||||
(cons
|
||||
(match-string 1 name)
|
||||
(cons (string-to-number (match-string 2 name))
|
||||
(string-to-number (or (match-string 3 name) "")))
|
||||
)
|
||||
fn))) files))
|
||||
)
|
||||
;; Define a kanban style set of stages for todo tasks
|
||||
(with-eval-after-load 'org
|
||||
(setq org-todo-keywords
|
||||
'((sequence "TODO" "WAITING" "REVIEW" "|" "DONE" "ARCHIVED"))))
|
||||
|
||||
;; Set indent guide to be set recursive when enabled. It is not on by default
|
||||
;; you must call `spacemacs/toggle-indent-guide-globally-on` to enable the
|
||||
;; indent guides
|
||||
(setq indent-guide-recursive t))
|
||||
|
||||
;; 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.
|
||||
'(evil-want-Y-yank-to-eol nil)
|
||||
'(package-selected-packages
|
||||
'(flycheck-psalm ox-json nginx-mode lsp-dart dap-mode posframe bui flutter dart-server dart-mode helm-gtags ggtags counsel-gtags counsel swiper ivy company-lua lua-mode yasnippet-snippets yaml-mode xterm-color ws-butler writeroom-mode winum which-key web-mode web-beautify vterm volatile-highlights vi-tilde-fringe uuidgen use-package treemacs-projectile treemacs-persp treemacs-magit treemacs-icons-dired treemacs-evil toc-org tide terminal-here tagedit symon symbol-overlay string-inflection spaceline-all-the-icons smeargle slim-mode shell-pop scss-mode sass-mode rjsx-mode restart-emacs rainbow-delimiters pug-mode prettier-js popwin phpunit phpcbf php-extras php-auto-yasnippets pcre2el password-generator paradox overseer orgit org-superstar org-projectile org-present org-pomodoro org-mime org-download org-cliplink org-brain open-junk-file nodejs-repl nameless multi-term move-text mmm-mode markdown-toc magit-svn magit-section magit-gitflow macrostep lsp-ui lsp-treemacs lorem-ipsum livid-mode link-hint json-navigator js2-refactor js-doc indent-guide impatient-mode hybrid-mode hungry-delete hl-todo highlight-parentheses highlight-numbers highlight-indentation helm-xref helm-themes helm-swoop helm-purpose helm-projectile helm-org-rifle helm-org helm-notmuch helm-mode-manager helm-make helm-lsp helm-ls-git helm-gitignore helm-git-grep helm-flx helm-descbinds helm-css-scss helm-company helm-c-yasnippet helm-ag google-translate golden-ratio gnuplot gmail-message-mode gitignore-templates gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link git-gutter-fringe+ gh-md fuzzy font-lock+ flyspell-correct-helm flymd flycheck-pos-tip flycheck-package flycheck-elsa flx-ido fill-column-indicator fancy-battery eyebrowse expand-region evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-textobj-line evil-surround evil-org evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-magit evil-lisp-state evil-lion evil-indent-plus evil-iedit-state evil-goggles evil-exchange evil-escape evil-ediff evil-cleverparens evil-args evil-anzu eval-sexp-fu eshell-z eshell-prompt-extras esh-help emr emmet-mode elisp-slime-nav editorconfig edit-server dumb-jump drupal-mode dotenv-mode dockerfile-mode docker diminish devdocs define-word company-web company-statistics company-quickhelp column-enforce-mode clean-aindent-mode centered-cursor-mode browse-at-remote base16-theme auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile aggressive-indent ace-link ace-jump-helm-line ac-ispell)))
|
||||
(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.
|
||||
)
|
||||
)
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
;;; development.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
;;
|
||||
;; The main development configuration common development packages
|
||||
;; like lsp and flycheck
|
||||
|
||||
(use-package lsp-mode
|
||||
:commands (lsp lsp-deferred)
|
||||
:config
|
||||
(setq-default
|
||||
lsp-intelephense-completion-trigger-parameter-hints nil
|
||||
lsp-clients-clangd-args '("--clang-tidy" "--header-insertion-decorators=0")
|
||||
lsp-auto-guess-root t
|
||||
lsp-headerline-breadcrumb-enable nil
|
||||
lsp-enable-file-watchers nil
|
||||
lsp-keep-workspace-alive nil
|
||||
lsp-modeline-diagnostics-scope :project))
|
||||
|
||||
(advice-add 'lsp :before (lambda (&rest _args) (eval '(setf (lsp-session-server-id->folders (lsp-session)) (ht)))))
|
||||
|
||||
(use-package lsp-ui
|
||||
:hook (lsp-mode . lsp-ui-mode))
|
||||
|
||||
(use-package lsp-ivy)
|
||||
|
||||
(defun do-yas-expand ()
|
||||
(let ((yas/fallback-behavior 'return-nil))
|
||||
(yas/expand)))
|
||||
|
||||
(defun aa/expand ()
|
||||
(interactive)
|
||||
(if (or (not yas/minor-mode)
|
||||
(null (do-yas-expand)))
|
||||
(if (string-empty-p (thing-at-point 'word 'no-properties))
|
||||
(indent-for-tab-command)
|
||||
(if (fboundp 'emmet-expand-yas)
|
||||
(emmet-expand-yas)))))
|
||||
|
||||
(define-key evil-insert-state-map (kbd "C-e") 'aa/expand)
|
||||
|
||||
(use-package company
|
||||
:after lsp-mode
|
||||
:bind
|
||||
(:map company-active-map
|
||||
("RET" . company-complete)
|
||||
("C-l" . yas-next-field-or-maybe-expand)
|
||||
("<tab>" . aa/expand)
|
||||
("TAB" . aa/expand))
|
||||
:config
|
||||
(setq company-idle-delay 0)
|
||||
(setq company-echo-delay 0)
|
||||
(setq company-minimum-prefix-length 1)
|
||||
(setq company-tooltip-limit 15)
|
||||
;; (setq company-dabbrev-downcase nil)
|
||||
;; (setq-default company-backends
|
||||
;; '((company-capf
|
||||
;; :with
|
||||
;; company-yasnippet
|
||||
;; company-files)))
|
||||
(global-company-mode)
|
||||
:hook (lsp-mode . company-mode))
|
||||
|
||||
(use-package company-box
|
||||
:hook (company-mode . company-box-mode)
|
||||
:config
|
||||
(setq
|
||||
company-box-backends-colors nil
|
||||
company-box-icons-alist 'company-box-icons-all-the-icons))
|
||||
|
||||
(use-package flycheck
|
||||
:init (global-flycheck-mode)
|
||||
:config
|
||||
(setq flycheck-check-syntax-automatically '(mode-enabled save))
|
||||
(setq flycheck-phpcs-standard "PSR2")
|
||||
(setq flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
|
||||
|
||||
;; Define local checkers so we can add next checkers per mode. LSP mode takes
|
||||
;; priority and we can define the next checker in the mode hooks. Each language
|
||||
;; will define there checkers if needed.
|
||||
;;
|
||||
;; Example usage for adding the php checker for php-mode
|
||||
;; (setq flycheck-local-checkers '((lsp . ((next-checkers . (php))))))
|
||||
(defvar-local flycheck-local-checkers nil)
|
||||
(defun +flycheck-checker-get(fn checker property)
|
||||
(or (alist-get property (alist-get checker flycheck-local-checkers))
|
||||
(funcall fn checker property)))
|
||||
(advice-add 'flycheck-checker-get :around '+flycheck-checker-get)
|
||||
|
||||
;; Set the default column width to 80. The default in emacs is 70 that is too small for me
|
||||
(setq-default fill-column 80)
|
||||
(setq-default display-fill-column-indicator-column 80)
|
||||
|
||||
(setq compilation-scroll-output 'first-error)
|
||||
|
||||
;; Set the default line number style to relative so when they are turned on I
|
||||
;; dont need to worry about that
|
||||
(setq display-line-numbers-type 'relative)
|
||||
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
|
||||
|
||||
(use-package tree-sitter)
|
||||
(use-package tree-sitter-langs)
|
||||
|
||||
(use-package magit
|
||||
:init
|
||||
;; Force magit status to go full screen
|
||||
(setq magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1))
|
||||
|
||||
(use-package magit-todos
|
||||
:init
|
||||
(magit-todos-mode 1)
|
||||
(global-hl-todo-mode))
|
||||
|
||||
(use-package smartparens
|
||||
:config
|
||||
(require 'smartparens-config)
|
||||
:init
|
||||
(smartparens-global-mode))
|
||||
|
||||
;; To set different remote tyeps see https://github.com/rmuslimov/browse-at-remote#remote-types
|
||||
(use-package browse-at-remote :defer t)
|
||||
|
||||
(use-package string-inflection :defer t)
|
||||
|
||||
(define-minor-mode aa-tab-mode
|
||||
"Tab mode by me"
|
||||
:lighter " aa-tab"
|
||||
:global nil
|
||||
(define-key prog-mode-map (kbd "<tab>") 'aa/expand)
|
||||
(define-key prog-mode-map (kbd "TAB") 'aa/expand))
|
||||
|
||||
(define-globalized-minor-mode global-aa-tab-mode aa-tab-mode
|
||||
(lambda () (aa-tab-mode 1)))
|
||||
|
||||
(global-aa-tab-mode)
|
||||
|
||||
;; https://people.gnome.org/~federico/blog/compilation-notifications-in-emacs.html
|
||||
;; (setq compilation-finish-functions
|
||||
;; (append compilation-finish-functions
|
||||
;; '(fmq-compilation-finish)))
|
||||
|
||||
(setq compilation-finish-functions
|
||||
'(fmq-compilation-finish))
|
||||
|
||||
(defun fmq-compilation-finish (buffer status)
|
||||
(print status)
|
||||
(call-process "notify-send" nil nil nil
|
||||
"-t" "30000" ;; Display notification for 30 seconds
|
||||
"-i" (if (string-match "^finished" status) "dialog-ok" "dialog-no")
|
||||
"Compilation finished in Emacs"
|
||||
status))
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
;;; evil.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(defun aa/semicolon-at-end-of-line ()
|
||||
(interactive)
|
||||
(end-of-line)
|
||||
(insert ";"))
|
||||
|
||||
(use-package evil
|
||||
:init
|
||||
(setq evil-want-integration t)
|
||||
(setq evil-want-keybinding nil)
|
||||
(setq evil-want-C-u-scroll t)
|
||||
(setq evil-want-C-i-jump nil)
|
||||
:config
|
||||
(evil-mode 1)
|
||||
;; Set window movement to CTRL hjkl to emulate tmux vim interaction
|
||||
(global-set-key (kbd "C-h") 'evil-window-left)
|
||||
(global-set-key (kbd "C-j") 'evil-window-down)
|
||||
(global-set-key (kbd "C-l") 'evil-window-right)
|
||||
(global-set-key (kbd "C-k") 'evil-window-up)
|
||||
|
||||
(evil-set-initial-state 'messages-buffer-mode 'normal)
|
||||
(evil-set-initial-state 'dashboard-mode 'normal)
|
||||
|
||||
(define-key evil-insert-state-map (kbd "C-;") 'aa/semicolon-at-end-of-line))
|
||||
|
||||
(use-package evil-collection
|
||||
:after evil
|
||||
:config
|
||||
(evil-collection-init))
|
||||
|
||||
(use-package evil-commentary
|
||||
:init
|
||||
(evil-commentary-mode))
|
||||
|
||||
(use-package evil-surround
|
||||
:after evil
|
||||
:init
|
||||
;; `s' for surround instead of `substitute'
|
||||
;; see motivation here:
|
||||
;; https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org#the-vim-surround-case
|
||||
(evil-define-key 'visual evil-surround-mode-map "s" 'evil-surround-region)
|
||||
(evil-define-key 'visual evil-surround-mode-map "S" 'evil-substitute)
|
||||
:config
|
||||
(global-evil-surround-mode 1))
|
||||
|
||||
(use-package evil-multiedit
|
||||
:after evil-collection
|
||||
:config
|
||||
(evil-multiedit-default-keybinds))
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
;;; file-operations.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(defun rename-current-file (new-name)
|
||||
"Renames both current buffer and file it's visiting to NEW-NAME."
|
||||
(interactive "FNew name: ")
|
||||
(let ((name (buffer-name))
|
||||
(filename (buffer-file-name)))
|
||||
(if (not filename)
|
||||
(message "Buffer '%s' is not visiting a file!" name)
|
||||
(if (get-buffer new-name)
|
||||
(message "A buffer named '%s' already exists!" new-name)
|
||||
(progn
|
||||
(make-directory (file-name-directory new-name) t)
|
||||
(rename-file filename new-name 1)
|
||||
(rename-buffer new-name)
|
||||
(set-visited-file-name new-name)
|
||||
(set-buffer-modified-p nil))))))
|
||||
|
||||
(defun copy-current-file (new-name)
|
||||
"Copies both current buffer and file it's visiting to NEW-NAME."
|
||||
(interactive "FNew name: ")
|
||||
(let ((name (buffer-name))
|
||||
(filename (buffer-file-name)))
|
||||
(if (not filename)
|
||||
(message "Buffer '%s' is not visiting a file!" name)
|
||||
(if (get-buffer new-name)
|
||||
(message "A buffer named '%s' already exists!" new-name)
|
||||
(progn
|
||||
(make-directory (file-name-directory new-name) t)
|
||||
(copy-file filename new-name 1)
|
||||
(find-file new-name)
|
||||
(set-visited-file-name new-name)
|
||||
(set-buffer-modified-p nil))))))
|
||||
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
;;; format.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; Ensure the reformatter package is installed
|
||||
(quelpa '(reformatter :fetcher git :url "https://github.com/purcell/emacs-reformatter"))
|
||||
(require 'reformatter)
|
||||
(require 'projectile)
|
||||
|
||||
(defun fmt--find-prettier ()
|
||||
"Find the 'prittier' executable.
|
||||
This will be found from the project node_modules with a fall back to the
|
||||
globally installed package"
|
||||
(let ((project-prittier (concat (projectile-project-root) "node_modules/.bin/prettier")))
|
||||
(message project-prittier)
|
||||
(if (file-exists-p project-prittier)
|
||||
project-prittier
|
||||
"prettier")))
|
||||
|
||||
(defun fmt--find-phpcbf ()
|
||||
"Find the phpcbf executable.
|
||||
It will look first in the locally installed version in your vendor folder, if
|
||||
that cant be fond then it will try and use the globally installed executable"
|
||||
(let ((project-prittier (concat (projectile-project-root) "vendor/bin/phpcbf")))
|
||||
(message project-prittier)
|
||||
(if (file-exists-p project-prittier)
|
||||
project-prittier
|
||||
"phpcbf")))
|
||||
|
||||
(defun fmt--find-php-ruleset ()
|
||||
"Find the phpcs ruleset for the current project.
|
||||
If there is a 'ruleset.xml' file in your project root that will be used, if not
|
||||
then the 'psr2' ruleset will be used"
|
||||
(let ((project-prittier (concat (projectile-project-root) "ruleset.xml")))
|
||||
(message project-prittier)
|
||||
(if (file-exists-p project-prittier)
|
||||
project-prittier
|
||||
"psr2")))
|
||||
|
||||
(reformatter-define prettier-fmt
|
||||
:program (fmt--find-prettier)
|
||||
:args (list "--stdin-filepath" (buffer-file-name))
|
||||
:group 'fmt
|
||||
:lighter " PrettierFMT")
|
||||
|
||||
(reformatter-define phpcbf-fmt
|
||||
:program (fmt--find-phpcbf)
|
||||
:args (list (format "--standard=%s" (fmt--find-php-ruleset)) "-")
|
||||
:group 'fmt
|
||||
:exit-code-success-p (lambda (number) (= 1 number))
|
||||
:lighter " PhpCbfFMT")
|
||||
|
||||
(reformatter-define clang-fmt
|
||||
:program "clang-format"
|
||||
:args (list "--assume-filename" (buffer-file-name))
|
||||
:group 'fmt
|
||||
:lighter " ClangFMT")
|
||||
|
||||
;; Define our own jsonnet formatter. This is way faster then the
|
||||
;; 'jsonnet-reformat-buffer command that comes with jsonnet-mode
|
||||
(reformatter-define jsonnet-fmt
|
||||
:program "jsonnetfmt"
|
||||
:args (list "-")
|
||||
:group 'fmt
|
||||
:lighter " JsonnetFMT")
|
||||
|
||||
;; Set the gofmt command to be goimports we can use the built in functions in
|
||||
;; go-mode they work just fine
|
||||
(setq gofmt-command "goimports")
|
||||
|
||||
(defun fmt-buffer ()
|
||||
"Format the current buffer."
|
||||
(interactive)
|
||||
(cond
|
||||
((eq major-mode 'c++-mode) (clang-fmt))
|
||||
((eq major-mode 'css-mode) (prettier-fmt))
|
||||
((eq major-mode 'go-mode) (gofmt))
|
||||
((eq major-mode 'js2-mode) (prettier-fmt))
|
||||
((eq major-mode 'jsonnet-mode) (jsonnet-fmt))
|
||||
((eq major-mode 'markdown-mode) (prettier-fmt))
|
||||
((eq major-mode 'php-mode) (phpcbf-fmt))
|
||||
((eq major-mode 'scss-mode) (prettier-fmt))
|
||||
((eq major-mode 'typescript-mode) (prettier-fmt))
|
||||
((eq major-mode 'typescript-tsx-mode) (prettier-fmt))
|
||||
((eq major-mode 'web-mode) (prettier-fmt))
|
||||
((eq major-mode 'yaml-mode) (prettier-fmt))
|
||||
((eq 1 1) (message "No formatter found"))))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode fmt-mode
|
||||
"Run fmt on file save when this mode is turned on."
|
||||
:lighter " fmt"
|
||||
:global nil
|
||||
(if fmt-mode
|
||||
(add-hook 'before-save-hook 'fmt-buffer nil 'local)
|
||||
(remove-hook 'before-save-hook 'fmt-buffer 'local)))
|
||||
|
||||
(define-globalized-minor-mode global-fmt-mode fmt-mode
|
||||
(lambda () (fmt-mode 1)))
|
||||
|
||||
(provide 'format)
|
||||
;;; format.el ends here
|
||||
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
;;; general.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
;; no-littering doesn't set this by default so we must place
|
||||
;; auto save files in the same path as it uses for sessions
|
||||
(use-package no-littering)
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
|
||||
|
||||
;; Disable .# lock files. Then sends all directory watch tasks crazy. It also
|
||||
;; make compiling applications fail when you have unsaved files
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
;; Don't wrap lines
|
||||
(set-default 'truncate-lines t)
|
||||
|
||||
;; Set the default tab width to 4 from the default 8. This is only
|
||||
;; really used in go and makefiles and 8 if just silly
|
||||
(set-default 'tab-width 4)
|
||||
|
||||
;; Make ESC quit prompts
|
||||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
||||
|
||||
(use-package which-key
|
||||
:init (which-key-mode)
|
||||
:diminish which-key-mode
|
||||
:config
|
||||
(setq which-key-idle-delay 1))
|
||||
|
||||
(use-package flyspell-correct-ivy
|
||||
:bind ("C-M-;" . flyspell-correct-next)
|
||||
:init
|
||||
(add-hook 'text-mode-hook 'flyspell-mode)
|
||||
(add-hook 'org-mode-hook 'flyspell-mode)
|
||||
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
|
||||
(setq flyspell-correct-interface #'flyspell-correct-ivy)
|
||||
(setq ispell-dictionary "british"))
|
||||
|
||||
(use-package yasnippet
|
||||
:config
|
||||
(yas-global-mode)
|
||||
:init
|
||||
(setq yas-snippet-dirs '("~/.emacs.d/snippets")))
|
||||
|
||||
;; Sort out line numbers
|
||||
;; https://stackoverflow.com/a/23857738
|
||||
(defadvice server-visit-files (before parse-numbers-in-lines (files proc &optional nowait) activate)
|
||||
"looks for filenames like file:line or file:line:position and reparses name in such manner that position in file"
|
||||
(ad-set-arg 0
|
||||
(mapcar (lambda (fn)
|
||||
(let ((name (car fn)))
|
||||
(if (string-match "^\\(.*?\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?$" name)
|
||||
(cons
|
||||
(match-string 1 name)
|
||||
(cons (string-to-number (match-string 2 name))
|
||||
(string-to-number (or (match-string 3 name) "")))
|
||||
)
|
||||
fn))) files)))
|
||||
|
||||
;; Move the custom variables that are auto generated by emacs into
|
||||
;; there own file. This will then prevent them from cluttering the
|
||||
;; init.el and messing put git
|
||||
(setq custom-file (concat user-emacs-directory "custom.el"))
|
||||
(load custom-file 'noerror)
|
||||
|
||||
(use-package edit-server
|
||||
:commands edit-server-start
|
||||
:init (if after-init-time
|
||||
(edit-server-start)
|
||||
(add-hook 'after-init-hook
|
||||
#'(lambda() (edit-server-start)))))
|
||||
|
||||
(add-hook 'edit-server-start-hook 'markdown-mode)
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
;;; ivy.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package ivy
|
||||
:diminish
|
||||
:bind (:map ivy-minibuffer-map
|
||||
("TAB" . ivy-alt-done)
|
||||
("C-l" . ivy-alt-done)
|
||||
("C-j" . ivy-next-line)
|
||||
("C-k" . ivy-previous-line)
|
||||
:map ivy-switch-buffer-map
|
||||
("C-k" . ivy-previous-line)
|
||||
("C-l" . ivy-done)
|
||||
("C-d" . ivy-switch-buffer-kill)
|
||||
:map ivy-reverse-i-search-map
|
||||
("C-k" . ivy-previous-line)
|
||||
("C-d" . ivy-reverse-i-search-kill))
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
|
||||
(use-package counsel
|
||||
:bind (:map minibuffer-local-map
|
||||
("C-r" . 'counsel-minibuffer-history))
|
||||
:custom
|
||||
(counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
|
||||
:config
|
||||
(counsel-mode 1))
|
||||
|
||||
(use-package ivy-prescient
|
||||
:after counsel
|
||||
:custom
|
||||
(ivy-prescient-enable-filtering nil)
|
||||
:config
|
||||
(prescient-persist-mode 1)
|
||||
(ivy-prescient-mode 1))
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
;;; c-sharp.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package csharp-mode
|
||||
:hook (csharp-mode . lsp-deferred))
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
;;; c.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(add-hook 'c-mode-hook 'lsp)
|
||||
(add-hook 'c++-mode-hook 'lsp)
|
||||
(use-package cmake-mode)
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
;;; docker.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package docker
|
||||
:bind ("C-c d" . docker))
|
||||
|
||||
(use-package dockerfile-mode
|
||||
:hook (dockerfile-mode . lsp-deferred)
|
||||
:mode "\\Dockerfile\\'")
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
;;; go.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(setenv "PATH" (concat (getenv "PATH") ":" (getenv "HOME") "/.local/share/go/bin"))
|
||||
(use-package go-mode
|
||||
:hook (go-mode . lsp-deferred)
|
||||
:mode "\\.go\\'")
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
;;; ts-js.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package js2-mode
|
||||
:mode "\\.m?js\\'"
|
||||
:interpreter "node"
|
||||
:hook ((js2-mode . tree-sitter-hl-mode)
|
||||
(js2-mode . lsp-deferred))
|
||||
:commands js2-line-break
|
||||
:config
|
||||
(setq js-chain-indent t
|
||||
;; Don't mishighlight shebang lines
|
||||
js2-skip-preprocessor-directives t
|
||||
;; let flycheck handle this
|
||||
js2-mode-show-parse-errors nil
|
||||
js2-mode-show-strict-warnings nil
|
||||
;; Flycheck provides these features, so disable them: conflicting with
|
||||
;; the eslint settings.
|
||||
js2-strict-trailing-comma-warning nil
|
||||
js2-strict-missing-semi-warning nil
|
||||
;; maximum fontification
|
||||
js2-highlight-level 3
|
||||
js2-highlight-external-variables t
|
||||
js2-idle-timer-delay 0.1))
|
||||
|
||||
(use-package rjsx-mode
|
||||
:mode
|
||||
(("components/.+\\.js$" . rjsx-mode))
|
||||
:hook ((rjsx-mode . tree-sitter-hl-mode)
|
||||
(rjsx-mode . lsp-deferred))
|
||||
:init
|
||||
(defun +javascript-jsx-file-p ()
|
||||
"Detect React or preact imports early in the file."
|
||||
(and buffer-file-name
|
||||
(string= (file-name-extension buffer-file-name) "js")
|
||||
(re-search-forward "\\(^\\s-*import +React\\|\\( from \\|require(\\)[\"']p?react\\)"
|
||||
magic-mode-regexp-match-limit t)
|
||||
(progn (goto-char (match-beginning 1))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
|
||||
(add-to-list 'magic-mode-alist '(+javascript-jsx-file-p . rjsx-mode))
|
||||
(setq-local emmet-expand-jsx-className? t))
|
||||
|
||||
(use-package typescript-mode
|
||||
:hook (typescript-mode . lsp-deferred)
|
||||
:mode (("\\.ts\\'" . typescript-mode)))
|
||||
|
||||
(progn
|
||||
(define-derived-mode typescript-tsx-mode web-mode "TypeScript-tsx")
|
||||
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode))
|
||||
(add-hook 'typescript-tsx-mode-hook 'tree-sitter-hl-mode)
|
||||
(add-hook 'typescript-tsx-mode-hook 'lsp-deferred))
|
||||
|
||||
(use-package vue-mode)
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
;;; json.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package json-mode
|
||||
:hook (json-mode . lsp-deferred)
|
||||
:mode "\\.json\\'")
|
||||
|
||||
(use-package jsonnet-mode)
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
;;; php.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
|
||||
(use-package php-mode
|
||||
:hook ((php-mode . (lambda() (setq flycheck-local-checkers '((lsp . ((next-checkers . (php))))))))
|
||||
(php-mode . lsp-deferred)
|
||||
(php-mode . tree-sitter-hl-mode))
|
||||
:mode
|
||||
(("\\.php\\'" . php-mode)
|
||||
("\\.phpstub\\'" . php-mode)))
|
||||
|
||||
(use-package flycheck-psalm)
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
;;; shell.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
;; sh-mode is already installed just need to enable lsp in that mode
|
||||
(add-hook 'sh-mode-hook 'lsp)
|
||||
|
||||
;; Add .env file to be highlighted with the sh-mode syntax
|
||||
(add-to-list 'auto-mode-alist '("\\.env\\'" . sh-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.env\\.example\\'" . sh-mode))
|
||||
|
||||
(use-package flymake-shellcheck
|
||||
:commands flymake-shellcheck-load
|
||||
:init
|
||||
(add-hook 'sh-mode-hook 'flymake-shellcheck-load))
|
||||
|
||||
(use-package bats-mode);
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
;;; web.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package web-mode
|
||||
:defer t
|
||||
:hook (web-mode . lsp-deferred)
|
||||
:config
|
||||
(setq web-mode-enable-auto-quoting nil)
|
||||
:mode
|
||||
(("\\.phtml\\'" . web-mode)
|
||||
("\\.tpl\\.php\\'" . web-mode)
|
||||
("\\.twig\\'" . web-mode)
|
||||
("\\.xml\\'" . web-mode)
|
||||
("\\.html\\'" . web-mode)
|
||||
("\\.htm\\'" . web-mode)
|
||||
("\\.[gj]sp\\'" . web-mode)
|
||||
("\\.as[cp]x?\\'" . web-mode)
|
||||
("\\.eex\\'" . web-mode)
|
||||
("\\.erb\\'" . web-mode)
|
||||
("\\.mustache\\'" . web-mode)
|
||||
("\\.handlebars\\'" . web-mode)
|
||||
("\\.hbs\\'" . web-mode)
|
||||
("\\.eco\\'" . web-mode)
|
||||
("\\.ejs\\'" . web-mode)
|
||||
("\\.svelte\\'" . web-mode)
|
||||
("\\.ctp\\'" . web-mode)
|
||||
("\\.djhtml\\'" . web-mode)))
|
||||
|
||||
(use-package sass-mode
|
||||
:defer t
|
||||
:hook (sass-mode . lsp-deferred)
|
||||
:mode ("\\.sass\\'" . sass-mode))
|
||||
|
||||
(use-package scss-mode
|
||||
:defer t
|
||||
:hook (scss-mode . lsp-deferred)
|
||||
:mode ("\\.scss\\'" . scss-mode))
|
||||
|
||||
(use-package css-mode
|
||||
:defer t
|
||||
:hook (css-mode . lsp-deferred)
|
||||
:mode ("\\.css\\'" . css-mode))
|
||||
|
||||
(use-package less-css-mode
|
||||
:defer t
|
||||
:hook (less-css-mode . lsp-deferred)
|
||||
:mode ("\\.less\\'" . less-css-mode))
|
||||
|
||||
(use-package emmet-mode
|
||||
:defer t
|
||||
:hook ((web-mode . emmet-mode)
|
||||
(css-mode . emmet-mode)
|
||||
(sass-mode . emmet-mode)
|
||||
(js2-mode . emmet-mode)
|
||||
(rjsx-mode . (lambda ()
|
||||
(emmet-mode)
|
||||
(setq-local emmet-expand-jsx-className? t)))
|
||||
(typescript-tsx-mode . (lambda ()
|
||||
(emmet-mode)
|
||||
(setq-local emmet-expand-jsx-className? t)))))
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
;;; yaml.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package yaml-mode
|
||||
:hook (yaml-mode . lsp-deferred)
|
||||
:mode "\\.\\(yml\\|yaml\\)\\'")
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
;;; language-tool.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package languagetool
|
||||
:commands (languagetool-check languagetool-server-start)
|
||||
:init
|
||||
(setq languagetool-correction-language "en-GB")
|
||||
:config
|
||||
(setq languagetool-server-command "~/.local/share/LanguageTool/LanguageTool-5.6/languagetool-server.jar")
|
||||
(setq languagetool-console-command "~/.local/share/LanguageTool/LanguageTool-5.6/languagetool-commandline.jar"))
|
||||
|
|
@ -1,146 +0,0 @@
|
|||
;;; notmuch.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(require 'cl)
|
||||
|
||||
(defvar notmuch-message-deleted-tags '("+deleted" "-inbox" "-unread"))
|
||||
|
||||
(defun spacemacs/notmuch-search-archive-thread-down ()
|
||||
"Search thread up."
|
||||
(interactive)
|
||||
(notmuch-search-archive-thread))
|
||||
|
||||
(defun spacemacs/notmuch-search-archive-thread-up ()
|
||||
"Search thread down."
|
||||
(interactive)
|
||||
(notmuch-search-archive-thread)
|
||||
(notmuch-search-previous-thread)
|
||||
(notmuch-search-previous-thread))
|
||||
|
||||
(defun spacemacs//notmuch-message-delete (go-next)
|
||||
"Delete message and select GO-NEXT message."
|
||||
(notmuch-search-tag notmuch-message-deleted-tags)
|
||||
(if (eq 'up go-next)
|
||||
(notmuch-search-previous-thread)
|
||||
(notmuch-search-next-thread)))
|
||||
|
||||
(defun spacemacs/notmuch-message-delete-down ()
|
||||
"Delete a message and select the next message."
|
||||
(interactive)
|
||||
(spacemacs//notmuch-message-delete 'down))
|
||||
|
||||
(defun spacemacs/notmuch-message-delete-up ()
|
||||
"Delete a message and select the previous message."
|
||||
(interactive)
|
||||
(spacemacs//notmuch-message-delete 'up))
|
||||
|
||||
(defun aa/notmuch-search-inbox ()
|
||||
"Search the notmuch inbox."
|
||||
(interactive)
|
||||
(notmuch-search "tag:inbox"))
|
||||
|
||||
(defun aa/notmuch-search-inbox-unread ()
|
||||
"Search the notmuch unread messages in the inbox."
|
||||
(interactive)
|
||||
(notmuch-search "tag:inbox and tag:unread"))
|
||||
|
||||
|
||||
(quelpa
|
||||
'(notmuch :fetcher git
|
||||
:url "https://git.notmuchmail.org/git/notmuch"
|
||||
:commit "a59ef7d02cb229c2ec3569024918024003568aea"
|
||||
:files ("emacs/*.el" "emacs/*.png"))
|
||||
|
||||
(setq notmuch-saved-searches '((:name "inbox"
|
||||
:key "i"
|
||||
:query "tag:inbox"
|
||||
:sort-order newest-first)
|
||||
(:name "inbox-unread"
|
||||
:key "iu"
|
||||
:query "tag:inbox and tag:unread"
|
||||
:sort-order newest-first)
|
||||
(:name "unread"
|
||||
:key "u"
|
||||
:query "tag:unread"
|
||||
:sort-order newest-first)
|
||||
(:name "all"
|
||||
:key "a"
|
||||
:query "*"
|
||||
:sort-order newest-first)))
|
||||
;; key bindings
|
||||
(evil-define-key 'normal notmuch-search-mode-map
|
||||
"=" 'notmuch-refresh-this-buffer
|
||||
"?" 'notmuch-help
|
||||
"*" 'notmuch-search-tag-all
|
||||
"-" 'notmuch-search-remove-tag
|
||||
"+" 'notmuch-search-add-tag
|
||||
"J" 'notmuch-jump-search
|
||||
"m" 'notmuch-mua-new-mail
|
||||
"s" 'notmuch-search
|
||||
"a" 'spacemacs/notmuch-search-archive-thread-down
|
||||
"A" 'spacemacs/notmuch-search-archive-thread-up
|
||||
"d" 'spacemacs/notmuch-message-delete-down
|
||||
"D" 'spacemacs/notmuch-message-delete-up)
|
||||
(evil-define-key 'normal notmuch-show-mode-map
|
||||
"B" 'notmuch-show-browse-urls)
|
||||
(evil-define-key 'visual notmuch-search-mode-map
|
||||
"-" 'notmuch-search-remove-tag
|
||||
"+" 'notmuch-search-add-tag
|
||||
"d" 'spacemacs/notmuch-message-delete-down))
|
||||
|
||||
(use-package counsel-notmuch :defer t)
|
||||
|
||||
(defun org-notmuch-open (id)
|
||||
"Visit the notmuch message or thread with id ID."
|
||||
(notmuch-show id))
|
||||
|
||||
(defun org-notmuch-store-link ()
|
||||
"Store a link to a notmuch mail message."
|
||||
(cl-case major-mode
|
||||
('notmuch-show-mode
|
||||
;; Store link to the current message
|
||||
(let* ((id (notmuch-show-get-message-id))
|
||||
(link (concat "notmuch:" id))
|
||||
(description (format "Mail: %s" (notmuch-show-get-subject))))
|
||||
(org-store-link-props
|
||||
:type "notmuch"
|
||||
:link link
|
||||
:description description)))
|
||||
('notmuch-search-mode
|
||||
;; Store link to the thread on the current line
|
||||
(let* ((id (notmuch-search-find-thread-id))
|
||||
(link (concat "notmuch:" id))
|
||||
(description (format "Mail: %s" (notmuch-search-find-subject))))
|
||||
(org-store-link-props
|
||||
:type "notmuch"
|
||||
:link link
|
||||
:description description)))))
|
||||
|
||||
;; https://notmuchmail.org/emacstips
|
||||
;; Viewing diffs in notmuch
|
||||
(defun aa/notmuch-show-view-as-patch ()
|
||||
"View the the current message as a patch."
|
||||
(interactive)
|
||||
(let* ((id (notmuch-show-get-message-id))
|
||||
(msg (notmuch-show-get-message-properties))
|
||||
(part (notmuch-show-get-part-properties))
|
||||
(subject (concat "Subject: " (notmuch-show-get-subject) "\n"))
|
||||
(diff-default-read-only t)
|
||||
(buf (get-buffer-create (concat "*notmuch-patch-" id "*")))
|
||||
(map (make-sparse-keymap)))
|
||||
(define-key map "q" 'notmuch-bury-or-kill-this-buffer)
|
||||
(switch-to-buffer buf)
|
||||
(let ((inhibit-read-only t))
|
||||
(erase-buffer)
|
||||
(insert subject)
|
||||
(insert (notmuch-get-bodypart-text msg part nil)))
|
||||
(set-buffer-modified-p nil)
|
||||
(diff-mode)
|
||||
(lexical-let ((new-ro-bind (cons 'buffer-read-only map)))
|
||||
(add-to-list 'minor-mode-overriding-map-alist new-ro-bind))
|
||||
(goto-char (point-min))))
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
;;; org.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(defun efs/org-mode-setup ()
|
||||
(org-indent-mode)
|
||||
(visual-line-mode 1))
|
||||
|
||||
(use-package org
|
||||
:pin org
|
||||
:hook (org-mode . efs/org-mode-setup)
|
||||
:config
|
||||
(setq org-ellipsis " ▾")
|
||||
|
||||
;; Don't fold headers when opening files I find it better to see all of the
|
||||
;; files and navigate between the headers
|
||||
(setq org-startup-folded nil)
|
||||
|
||||
;;(setq org-agenda-start-with-log-mode t)
|
||||
;;(setq org-log-done 'time)
|
||||
(setq org-agenda-window-setup 'current-window)
|
||||
|
||||
;; Open file links in current window, rather than new ones
|
||||
;; https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L632
|
||||
(setf (alist-get 'file org-link-frame-setup) #'find-file)
|
||||
|
||||
(setq org-refile-targets '(("Archive.org" :maxlevel . 1)))
|
||||
(setq org-agenda-files '("~/Nextcloud/org/workbook"
|
||||
"~/Nextcloud/org/notes"
|
||||
"~/Nextcloud/org/wiki"))
|
||||
(setq org-directory "~/Nextcloud/org")
|
||||
|
||||
;; Add notmuch link capture mainly for org-capture
|
||||
(org-link-set-parameters "notmuch"
|
||||
:follow 'org-notmuch-open
|
||||
:store 'org-notmuch-store-link)
|
||||
|
||||
;; Define a kanban style set of stages for todo tasks
|
||||
(setq org-todo-keywords
|
||||
'((sequence "TODO" "WAITING" "REVIEW" "|" "DONE" "ARCHIVED")))
|
||||
|
||||
(require 'org-protocol)
|
||||
(require 'org-id)
|
||||
(require 'org-habit)
|
||||
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((emacs-lisp . t)
|
||||
(shell . t)))
|
||||
|
||||
;; Configure custom agenda views
|
||||
(setq org-agenda-custom-commands
|
||||
'(("d" "Dashboard"
|
||||
((agenda "" ((org-deadline-warning-days 7)))
|
||||
(todo "WAITING"
|
||||
((org-agenda-overriding-header "Waiting on External")))
|
||||
(todo "TODO"
|
||||
((org-agenda-overriding-header "Scheduled")
|
||||
(org-agenda-skip-function '(org-agenda-skip-entry-if 'nottimestamp))))
|
||||
(todo "TODO"
|
||||
((org-agenda-overriding-header "Backlog")
|
||||
(org-agenda-todo-list-sublevels nil)
|
||||
(org-agenda-skip-function '(org-agenda-skip-entry-if 'timestamp))))))
|
||||
|
||||
("w" "Workflow Status"
|
||||
((todo "WAITING"
|
||||
((org-agenda-overriding-header "Waiting on External")
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "TODO"
|
||||
((org-agenda-overriding-header "Todo")
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "REVIEW"
|
||||
((org-agenda-overriding-header "In Review")
|
||||
(org-agenda-files org-agenda-files)))))))
|
||||
|
||||
(setq org-capture-templates
|
||||
`(("t" "Task" entry (file aa/create-workbook-file) "\n\n* TODO %?\n %U\n %a\n %i\n\n")
|
||||
("c" "Task Clock In" entry (file aa/create-workbook-file) "\n\n* TODO %?\n:LOGBOOK:\nCLOCK: %U\n:END:\n %U\n %a\n %i\n\n")
|
||||
("n" "New Note" entry (file aa/create-notes-file) "* Content")
|
||||
|
||||
|
||||
("p" "Protocol" entry (file aa/create-workbook-file) "* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
|
||||
("L" "Protocol Link" entry (file aa/create-workbook-file) "* TODO %? [[%:link][%:description]] \nCaptured On: %U"))))
|
||||
|
||||
(defun org-wiki-search ()
|
||||
"Search the whole wiki for a pattern"
|
||||
(interactive)
|
||||
(let ((default-directory "~/Nextcloud/org"))
|
||||
(counsel-ag)))
|
||||
|
||||
(defun org-wiki-search-title ()
|
||||
"Search the though all of the wiki titles for a pattern"
|
||||
(interactive)
|
||||
(let ((default-directory "~/Nextcloud/org"))
|
||||
(counsel-ag "title: ")))
|
||||
|
||||
(defun org-wiki-search-heading ()
|
||||
"Search the though all of the wiki headings for a pattern"
|
||||
(interactive)
|
||||
(let ((default-directory "~/Nextcloud/org"))
|
||||
(counsel-ag "^\\* ")))
|
||||
|
||||
(defun aa/create-notes-file ()
|
||||
"Create an org file in ~/notes/."
|
||||
(expand-file-name (format "%s-%s.org"
|
||||
(format-time-string "%Y-%m-%d")
|
||||
(string-trim (shell-command-to-string "uuidgen")))
|
||||
"~/Nextcloud/org/notes/"))
|
||||
|
||||
(defun aa/create-workbook-file ()
|
||||
"Create an org file in ~/workbook/."
|
||||
(expand-file-name (format "%s.org"
|
||||
(format-time-string "%Y-%m"))
|
||||
"~/Nextcloud/org/workbook/"))
|
||||
|
||||
(defun workbook-current ()
|
||||
"Create an org file in ~/notes/."
|
||||
(interactive)
|
||||
(find-file
|
||||
(expand-file-name (format "%s.org"
|
||||
(format-time-string "%Y-%m"))
|
||||
"~/Nextcloud/org/workbook/")))
|
||||
|
||||
(use-package org-bullets
|
||||
:after org
|
||||
:hook (org-mode . org-bullets-mode)
|
||||
:custom
|
||||
(org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))
|
||||
|
||||
(use-package org-re-reveal
|
||||
:after org)
|
||||
|
||||
(use-package evil-org
|
||||
:after org
|
||||
:hook (org-mode . (lambda () evil-org-mode))
|
||||
:config
|
||||
(require 'evil-org-agenda)
|
||||
(evil-org-agenda-set-keys))
|
||||
|
||||
;; This is needed as of Org 9.2
|
||||
(require 'org-tempo)
|
||||
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
|
||||
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
|
||||
(add-to-list 'org-structure-template-alist '("php" . "src php"))
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
;;; packages.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(require 'package)
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("org" . "https://orgmode.org/elpa/")
|
||||
("elpa" . "https://elpa.gnu.org/packages/")))
|
||||
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
|
||||
;; Initialize use-package on non-Linux platforms
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-install 'use-package))
|
||||
|
||||
(require 'use-package)
|
||||
(setq use-package-always-ensure t)
|
||||
|
||||
(use-package quelpa)
|
||||
(setq use-package-ensure-function 'quelpa)
|
||||
|
||||
(quelpa
|
||||
'(quelpa-use-package
|
||||
:fetcher git
|
||||
:url "https://github.com/quelpa/quelpa-use-package.git"))
|
||||
(require 'quelpa-use-package)
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
;;; projectile.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package projectile
|
||||
:diminish projectile-mode
|
||||
:config (projectile-mode)
|
||||
:custom ((projectile-completion-system 'ivy))
|
||||
:bind-keymap
|
||||
("C-c p" . projectile-command-map)
|
||||
:init
|
||||
;; NOTE: Set this to the folder where you keep your Git repos!
|
||||
(when (file-directory-p "~/Code/src")
|
||||
(setq projectile-project-search-path '("~/Code/src")))
|
||||
(setq projectile-switch-project-action #'projectile-dired))
|
||||
|
||||
(use-package counsel-projectile
|
||||
:config (counsel-projectile-mode))
|
||||
|
||||
(defun projectile--get-php-test-command ()
|
||||
"Get the correct test command for the PHP project.
|
||||
This will find the test configuration file and work out the correct command to
|
||||
run from the configuration file"
|
||||
(cond
|
||||
((file-exists-p (concat (projectile-project-root) "vendor/bin/codecept")) "vendor/bin/codecept run --no-ansi")
|
||||
((file-exists-p (concat (projectile-project-root) "vendor/bin/simple-phpunit")) "vendor/bin/simple-phpunit --colors=never")
|
||||
((file-exists-p (concat (projectile-project-root) "vendor/bin/phpunit")) "vendor/bin/phpunit")))
|
||||
|
||||
(defun projectile--get-php-test-file-command (file)
|
||||
"Get the correct command for testing a PHP FILE.
|
||||
For more details on getting the test command see
|
||||
`projectile--get-php-test-command`"
|
||||
(cond
|
||||
((file-exists-p (concat (projectile-project-root) "vendor/bin/codecept")) (format "vendor/bin/codecept run --no-ansi %s" file))
|
||||
((file-exists-p (concat (projectile-project-root) "vendor/bin/simple-phpunit")) (format "vendor/bin/simple-phpunit --colors=never %s" file))
|
||||
((file-exists-p (concat (projectile-project-root) "vendor/bin/phpunit")) (format "vendor/bin/phpunit %s" file))))
|
||||
|
||||
(defun projectile-test-php ()
|
||||
"Test the PHP project."
|
||||
(interactive)
|
||||
(let ((default-directory (projectile-project-root)))
|
||||
(compile (projectile--get-php-test-command))))
|
||||
|
||||
(defun projectile-test-php-file ()
|
||||
"Test the current file with the PHP command.
|
||||
If you are in a test file then the 'alternate' file will be run with the test
|
||||
function for your project"
|
||||
(interactive)
|
||||
(let ((default-directory (projectile-project-root)))
|
||||
(compile (projectile--get-php-test-file-command (projectile-find-matching-test (buffer-file-name))))))
|
||||
|
||||
(defun projectile--get-js-test-command ()
|
||||
"Test the project with JS command.
|
||||
The correct test command will be found baised on what configuration you have in
|
||||
your project"
|
||||
(cond
|
||||
((file-exists-p (concat (projectile-project-root) "jest.config.js")) "jest --no-colors")))
|
||||
|
||||
(defun projectile--get-js-test-file-command (file)
|
||||
"Test a FILE with the JS command."
|
||||
(cond
|
||||
((file-exists-p (concat (projectile-project-root) "jest.config.js")) (format "jest --no-colors %s" file))))
|
||||
|
||||
(defun projectile-test-js ()
|
||||
"Test the current project with JS."
|
||||
(interactive)
|
||||
(let ((default-directory (projectile-project-root)))
|
||||
(compile (projectile--get-js-test-command))))
|
||||
|
||||
(defun projectile-test-js-file ()
|
||||
"Test the current file with the JS command.
|
||||
If you are not on a test file then the 'alternate' file will be tested"
|
||||
(interactive)
|
||||
(let ((default-directory (projectile-project-root)))
|
||||
(compile (projectile--get-js-test-file-command (projectile-find-matching-test (buffer-file-name))))))
|
||||
|
||||
(defun projectile-test-file ()
|
||||
"Test the current file with the project test command.
|
||||
The command will be found based on the current file extension and the
|
||||
configuration in the project"
|
||||
(interactive)
|
||||
(let ((file-extention (file-name-extension (buffer-file-name))))
|
||||
(cond ((string= file-extention "js") (projectile-test-js-file))
|
||||
((string= file-extention "jsx") (projectile-test-js-file))
|
||||
((string= file-extention "tsx") (projectile-test-js-file))
|
||||
((string= file-extention "ts") (projectile-test-js-file))
|
||||
((string= file-extention "php") (projectile-test-php-file)))))
|
||||
|
||||
(setq practically-make/related-files
|
||||
(list
|
||||
(projectile-related-files-fn-test-with-suffix "js" ".test")
|
||||
(projectile-related-files-fn-test-with-suffix "jsx" ".test")
|
||||
(projectile-related-files-fn-test-with-suffix "ts" ".test")
|
||||
(projectile-related-files-fn-test-with-suffix "tsx" ".test")
|
||||
(projectile-related-files-fn-test-with-prefix "php" "Test")
|
||||
(projectile-related-files-fn-test-with-suffix "php" "Test")
|
||||
(projectile-related-files-fn-test-with-suffix "php" "Cest")))
|
||||
|
||||
(projectile-register-project-type 'practically-make '("Makefile" ".ctrc.yml")
|
||||
:project-file "Makefile"
|
||||
:configure "make init"
|
||||
:install "make install"
|
||||
:test "make test"
|
||||
:related-files-fn practically-make/related-files)
|
||||
|
||||
;; Add jest errors to the
|
||||
(add-to-list 'compilation-error-regexp-alist 'jest-erorrs)
|
||||
(add-to-list 'compilation-error-regexp-alist-alist
|
||||
'(jest-erorrs "^[ ]*at .* (\\([^:]+\\):\\([0-9]+\\):\\([0-9]+\\))" 1 2))
|
||||
|
||||
;; Add psalm errors so the compilation can pick them up
|
||||
(add-to-list 'compilation-error-regexp-alist 'psalm-erorrs)
|
||||
(add-to-list 'compilation-error-regexp-alist-alist
|
||||
'(psalm-erorrs "^ERROR: .* - \\([^:]+\\):\\([0-9]+\\):\\([0-9]+\\)" 1 2))
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
;;; puppet.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package puppet-mode
|
||||
:defer
|
||||
:mode "\\.pp\\'")
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
;;; term.el --- AMACS -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(defun aa/term-init ()
|
||||
;; Hide the mode line in the terminal
|
||||
(hide-mode-line-mode)
|
||||
(evil-emacs-state)
|
||||
(goto-address-mode)
|
||||
(setq cursor-type 'bar))
|
||||
|
||||
(use-package vterm
|
||||
:quelpa (vterm :fetcher github :repo "akermu/emacs-libvterm")
|
||||
:commands (vterm)
|
||||
:bind (:map vterm-mode-map
|
||||
("C-o" . previous-buffer))
|
||||
:hook (vterm-mode . aa/term-init)
|
||||
:init
|
||||
(defvar vterm-install t)
|
||||
:config
|
||||
;; Set the custom term prompt the oh-my-zsh "pygmalion" theme
|
||||
(setq term-prompt-regexp "⇒ ")
|
||||
;; Once vterm is dead, the vterm buffer is useless. Why keep it around? We can
|
||||
;; spawn another if want one.
|
||||
(setq vterm-kill-buffer-on-exit t))
|
||||
|
||||
;; TODO(ade): Add the face into the base16 theme fork
|
||||
(use-package auto-dim-other-buffers
|
||||
:config (auto-dim-other-buffers-mode)
|
||||
:custom-face
|
||||
;;(auto-dim-other-buffers-face ((t (:background "#e0e0e0"))))) ;; For light theme
|
||||
(auto-dim-other-buffers-face ((t (:background "#282828"))))) ;; For dark theme
|
||||
|
||||
(unless (display-graphic-p)
|
||||
(use-package tmux-pane
|
||||
:config (tmux-pane-mode))
|
||||
(use-package evil-terminal-cursor-changer
|
||||
:config (evil-terminal-cursor-changer-activate))
|
||||
|
||||
(use-package xclip
|
||||
:config (xclip-mode))
|
||||
|
||||
(xterm-mouse-mode))
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
;;; treemacs.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(use-package neotree
|
||||
:config
|
||||
(setq neo-theme 'icons)
|
||||
(setq neo-show-hidden-files t))
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
;;; ui.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
|
||||
(tooltip-mode -1) ; Disable tooltips
|
||||
(menu-bar-mode -1) ; Disable the menu bar
|
||||
(scroll-bar-mode -1) ; Disable visible scrollbar
|
||||
(tool-bar-mode -1) ; Disable the toolbar
|
||||
|
||||
;; Display the line column in the modeline not just the line number
|
||||
(column-number-mode)
|
||||
|
||||
;; Set up the visible bell
|
||||
(setq visible-bell t)
|
||||
|
||||
(defun aa/set-font (a-font-size)
|
||||
"Sets the font size for the whole of emacs setting the font faces
|
||||
|
||||
This is better than the `C-x +` and C-x - because this is global to emacs not
|
||||
just in in the current buffer."
|
||||
(interactive "nFont Size: ")
|
||||
(setq a-font "Rec Mono Casual")
|
||||
;; (setq a-font "LigaFreeMono")
|
||||
|
||||
(set-face-attribute 'default nil :font a-font :height a-font-size)
|
||||
(set-face-attribute 'fixed-pitch nil :font a-font :height a-font-size)
|
||||
(set-face-attribute 'variable-pitch nil :font a-font :height a-font-size :weight 'regular))
|
||||
|
||||
;; Set the default font size when emacs starts
|
||||
(aa/set-font 120)
|
||||
|
||||
(use-package base16-theme
|
||||
:quelpa (aa-base16-theme :fetcher github :repo "AdeAttwood/base16-emacs")
|
||||
:init
|
||||
;; Fix terminal color theme for base16
|
||||
;; See: https://github.com/belak/base16-emacs#terminal-colors
|
||||
;; See: https://github.com/belak/base16-emacs/issues/73#issuecomment-721942335
|
||||
(setq base16-theme-256-color-source 'base16-shell)
|
||||
(setq base16-distinct-fringe-background nil)
|
||||
(load-theme 'base16-tomorrow-night t t)
|
||||
(enable-theme 'base16-tomorrow-night))
|
||||
|
||||
(use-package all-the-icons)
|
||||
|
||||
(use-package doom-modeline
|
||||
:init (doom-modeline-mode 1)
|
||||
:custom ((doom-modeline-height 15)))
|
||||
|
||||
(use-package hide-mode-line)
|
||||
|
||||
(use-package ligature
|
||||
:quelpa (ligature :fetcher github :repo "mickeynp/ligature.el")
|
||||
:config
|
||||
(ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
|
||||
":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
|
||||
"!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
|
||||
"<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
|
||||
"<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
|
||||
"..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
|
||||
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
|
||||
"[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
|
||||
">=" ">>" ">-" "-~" "-|" "->" "-<" "<~" "<*" "<|" "<:" "<$"
|
||||
"<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!" "##"
|
||||
"#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:" "?="
|
||||
"?." "??" ";;" "/*" "/**" "/=" "/>" "__" "~~" "(*" "*)"
|
||||
"://" "true" "false"))
|
||||
;; Enables ligature checks globally in all buffers. You can also do it
|
||||
;; per mode with `ligature-mode'.
|
||||
(global-ligature-mode t))
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
;;; zoekt.el --- AMACS -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Copyright 2021 Practically.io All rights reserved
|
||||
;;
|
||||
;; Use of this source is governed by a BSD-style
|
||||
;; licence that can be found in the LICENCE file or at
|
||||
;; https://www.practically.io/copyright/
|
||||
;;
|
||||
;; Zoekt code search integration. Allows you to search the zoekt index with a
|
||||
;; search term and display the results in ivy. This will work the same as
|
||||
;; `counsel-ag` but over the
|
||||
;;
|
||||
;; See: https://github.com/google/zoekt
|
||||
|
||||
(defun zoekt--function (query)
|
||||
"The internal search function that will be run by `ivy-read`"
|
||||
(or
|
||||
(let ((ivy-text query))
|
||||
(ivy-more-chars))
|
||||
(progn
|
||||
(counsel--async-command
|
||||
(concat "zoekt -r " (shell-quote-argument query) " 2> /dev/null"))
|
||||
'("" "Searching..."))))
|
||||
|
||||
(defun zoekt (&optional initial-input)
|
||||
"Zoekt code search integration. Allows you to search the zoekt index with a
|
||||
search term and display the results in ivy. This will work the same as
|
||||
`counsel-ag` but over the zoeket index"
|
||||
(interactive)
|
||||
(let ((default-directory "~/Code/src"))
|
||||
(ivy-read "zoekt: " #'zoekt--function
|
||||
:initial-input initial-input
|
||||
:dynamic-collection t
|
||||
:keymap counsel-ag-map
|
||||
:action #'counsel-git-grep-action
|
||||
:caller 'zoekt
|
||||
:require-match t)))
|
||||
36
site-modules/core/files/emacs/straight/versions/default.el
Normal file
36
site-modules/core/files/emacs/straight/versions/default.el
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
(("annalist.el" . "e1ef5dad75fa502d761f70d9ddf1aeb1c423f41d")
|
||||
("company-box" . "c4f2e243fba03c11e46b1600b124e036f2be7691")
|
||||
("company-mode" . "8d2ca28a161f8b912889684412bb1d7fb07d035c")
|
||||
("compat" . "cf8e98d80e867a53753815f7cdc88cb8378f089e")
|
||||
("dash.el" . "1de9dcb83eacfb162b6d9a118a4770b1281bcd84")
|
||||
("doom-modeline" . "1505c13564b83e44d3187611e326a48b742cad3a")
|
||||
("el-get" . "c0713e8d8e8ad987fe1283d76b9c637a10f048ef")
|
||||
("emacs-web-server" . "3982c55e9061475038a3ccd61aecb2de3d407cec")
|
||||
("emacs-websocket" . "40c208eaab99999d7c1e4bea883648da24c03be3")
|
||||
("emacs-which-key" . "38d4308d1143b61e4004b6e7a940686784e51500")
|
||||
("emacsmirror-mirror" . "53908dfcbacb10b386955227c0d962333ca336fd")
|
||||
("emacsql" . "efddd69c5e69214dbbe921fbf90f938501414894")
|
||||
("evil" . "1a5ddab958982b6bf5e21bc7cb0f77a64415479d")
|
||||
("evil-collection" . "acb056b1d0d3aad2f32b1ca9c019a9a2e976f03e")
|
||||
("evil-org-mode" . "b1f309726b1326e1a103742524ec331789f2bf94")
|
||||
("f.el" . "1e7020dc0d4c52d3da9bd610d431cab13aa02d8c")
|
||||
("frame-local" . "7ee1106c3bcd4022f48421f8cb1ef4f995da816e")
|
||||
("general.el" . "826bf2b97a0fb4a34c5eb96ec2b172d682fd548f")
|
||||
("gnu-elpa-mirror" . "6d810b719138701a90072fae326562c8c35f8fe9")
|
||||
("goto-chg" . "72f556524b88e9d30dc7fc5b0dc32078c166fda7")
|
||||
("magit" . "9d1f8db507e080e032943a3ed1445bd8d9aaa9fc")
|
||||
("melpa" . "b32886c36b1953c1448cee2d0c9536b2ebfdacaa")
|
||||
("nerd-icons.el" . "4322290303f2e12efd5685a0d22d76ed76ec7349")
|
||||
("nongnu-elpa" . "28fde34f7d8c24a0ac07876e53e7f0c4b1d5e32d")
|
||||
("org" . "50e34dde10ba6d88615b2892e2b33ac7a02e1366")
|
||||
("org-bullets" . "767f55feb58b840a5a04eabfc3fbbf0d257c4792")
|
||||
("org-roam" . "8e6938a39d33bdb204b731be7b89aac1226af75f")
|
||||
("org-roam-ui" . "5ac74960231db0bf7783c2ba7a19a60f582e91ab")
|
||||
("s.el" . "dda84d38fffdaf0c9b12837b504b402af910d01d")
|
||||
("seq" . "99cdd0515670372bc039e22862e2ba4c195d9d15")
|
||||
("shrink-path.el" . "c14882c8599aec79a6e8ef2d06454254bb3e1e41")
|
||||
("straight.el" . "b3760f5829dba37e855add7323304561eb57a3d4")
|
||||
("swiper" . "2a25a6fb5b081cb141c5eccac8ee58ab1feeb747")
|
||||
("themes" . "188ab05eefe2bdc46b4464aadb4a52ff9cb42f7f")
|
||||
("use-package" . "a6e856418d2ebd053b34e0ab2fda328abeba731c"))
|
||||
:gamma
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
# export EMCAS_BINARY="/usr/bin/emacs"
|
||||
# export EMACS_CLIENT="/usr/bin/emacsclient"
|
||||
export EMACS_BINARY="$HOME/Code/src/github.com/emacs-mirror/emacs/src/emacs"
|
||||
export EMACS_CLIENT="$HOME/Code/src/github.com/emacs-mirror/emacs/lib-src/emacsclient"
|
||||
export EMCAS_BINARY="/usr/bin/emacs"
|
||||
export EMACS_CLIENT="/usr/bin/emacsclient"
|
||||
|
||||
export EMACS_PLUGIN_LAUNCHER="$EMACS_CLIENT --alternate-editor '$EMACS_BINARY --daemon && $EMACS_CLIENT'"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,18 @@
|
|||
" Functions to toggle format on save with Neoformat. This is off by default so
|
||||
" I don't accidentally start formatting when rebasing (bad memories).
|
||||
|
||||
function s:format_on_save()
|
||||
if &filetype == 'fsharp'
|
||||
return execute('lua vim.lsp.buf.format()')
|
||||
endif
|
||||
|
||||
undojoin | Neoformat
|
||||
endfunction
|
||||
|
||||
function s:fmt_on_save_enable()
|
||||
augroup aa_fmt
|
||||
autocmd!
|
||||
autocmd BufWritePre * undojoin | Neoformat
|
||||
autocmd BufWritePre * call s:format_on_save()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
local config = require "ivy.config"
|
||||
|
||||
-- Set up ivy.nvim
|
||||
-- See: https://github.com/AdeAttwood/ivy.nvim
|
||||
require('ivy').setup {
|
||||
require("ivy").setup {
|
||||
backends = {
|
||||
"ivy.backends.buffers",
|
||||
"ivy.backends.files",
|
||||
|
|
@ -8,4 +10,8 @@ require('ivy').setup {
|
|||
"ivy.backends.lsp-workspace-symbols",
|
||||
"ivy.backends.rg",
|
||||
},
|
||||
mappings = vim.tbl_extend("force", config:get { "mappings" }, {
|
||||
["<C-M-n>"] = "next_checkpoint",
|
||||
["<C-M-p>"] = "previous_checkpoint",
|
||||
}),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,16 @@ local lspconfig = require "lspconfig"
|
|||
local workspace_library = vim.api.nvim_get_runtime_file("lua", true)
|
||||
table.insert(workspace_library, os.getenv "HOME" .. "/Code/src/github.com/AdeAttwood/Configz/definitions/configz.lua")
|
||||
|
||||
local function has_file(file)
|
||||
return vim.fn.filereadable(vim.fn.getcwd() .. "/" .. file) == 1
|
||||
end
|
||||
|
||||
local servers = {
|
||||
-- Language servers for the day to day web development, could probably think
|
||||
-- about loosing the html and css one and living with typescript, rescript
|
||||
-- and emmet
|
||||
tsserver = {},
|
||||
ts_ls = { enabled = has_file "tsconfig.json" },
|
||||
denols = { enabled = has_file "deno.json" or has_file "deno.jsonc" },
|
||||
html = {},
|
||||
cssls = {},
|
||||
marksman = {},
|
||||
|
|
@ -105,15 +110,15 @@ for lsp, config in pairs(servers) do
|
|||
lspconfig[lsp].setup(config)
|
||||
end
|
||||
|
||||
require("ionide").setup({ on_attach = on_attach, capabilities = capabilities })
|
||||
require("ionide").setup { on_attach = on_attach, capabilities = capabilities }
|
||||
|
||||
-- Change the diagnostic signs
|
||||
vim.fn.sign_define("DiagnosticSignHint", { text = "➤", texthl = "DiagnosticSignHint", numhl = "DiagnosticSignHint" })
|
||||
vim.fn.sign_define("DiagnosticSignInfo", { text = "ℹ", texthl = "DiagnosticSignInfo", numhl = "DiagnosticSignInfo" })
|
||||
vim.fn.sign_define("DiagnosticSignWarn", { text = "⚠", texthl = "DiagnosticSignWarn", numhl = "DiagnosticSignWarn" })
|
||||
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint", numhl = "DiagnosticSignHint" })
|
||||
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo", numhl = "DiagnosticSignInfo" })
|
||||
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn", numhl = "DiagnosticSignWarn" })
|
||||
vim.fn.sign_define(
|
||||
"DiagnosticSignError",
|
||||
{ text = "✖", texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" }
|
||||
{ text = "", texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" }
|
||||
)
|
||||
|
||||
local border = "rounded"
|
||||
|
|
@ -127,6 +132,9 @@ vim.diagnostic.config {
|
|||
focusable = false,
|
||||
border = border,
|
||||
},
|
||||
virtual_text = {
|
||||
prefix = " ",
|
||||
},
|
||||
}
|
||||
|
||||
vim.cmd [[set updatetime=1000]]
|
||||
|
|
|
|||
|
|
@ -128,5 +128,11 @@ return {
|
|||
{ key = "7", mods = "LEADER", action = wezterm.action { ActivateTab = 6 } },
|
||||
{ key = "8", mods = "LEADER", action = wezterm.action { ActivateTab = 7 } },
|
||||
{ key = "9", mods = "LEADER", action = wezterm.action { ActivateTab = 8 } },
|
||||
|
||||
{
|
||||
key = "b",
|
||||
mods = "LEADER|CTRL",
|
||||
action = wezterm.action.ActivateLastTab,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,3 +32,8 @@ pager = delta
|
|||
nvim_diff.executable = nvim
|
||||
nvim_diff.args = -d $base $local $other
|
||||
nvim_diff.priority = 1
|
||||
|
||||
[revsetalias]
|
||||
# Diff between two revs. This is the same as `<rev>...<rev>`, unlike `a::b`
|
||||
# this is equivalent to `a..b` in git.
|
||||
ddd(a, b) = ancestor(a, b)::b
|
||||
|
|
|
|||
Loading…
Reference in a new issue