Skip to content

Instantly share code, notes, and snippets.

@beandipper
Last active November 21, 2020 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beandipper/bb51ac36b73fcb7437b962c986e7800e to your computer and use it in GitHub Desktop.
Save beandipper/bb51ac36b73fcb7437b962c986e7800e to your computer and use it in GitHub Desktop.
.config/nixpkgs/programs/emacs
{ config, lib, pkgs, ... }:
{
nixpkgs.overlays = [
(import (builtins.fetchTarball {
url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
}))
];
home.packages = [
(pkgs.emacsWithPackagesFromUsePackage {
config = ~/.config/nixpkgs/programs/emacs/emacs.el;
alwaysEnsure = true;
})
];
}
> cd ~/.config/nixpkgs/programs/emacs
> tree
.
├── default.nix
├── default.nix~
└── emacs.el
(setq inhibit-startup-message t)
(scroll-bar-mode -1) ; Disable visible scrollbar
(tool-bar-mode -1) ; Disable the toolbar
(tooltip-mode -1) ; Disable tooltips
(menu-bar-mode -1) ; Disable the menu bar
(setq visible-bell t)
(set-face-attribute 'default nil :font "Monoid-14")
;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(defalias 'yes-or-no-p 'y-or-n-p) ;allows y and n for yes and no
(column-number-mode)
(global-display-line-numbers-mode t)
(setq tab-width 2)
(setq indent-tabs-mode nil)
(setq show-trailing-whitespace t)
(require 'use-package-ensure)
(setq use-package-always-ensure t)
(setq use-package-always-ensure t)
;; Disable line numbers for some modes
(dolist (mode '(org-mode-hook
term-mode-hook
neuron-mode-hook
shell-mode-hook
eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
(use-package base16-theme
:config
(load-theme 'base16-one-light t))
(use-package evil
:defer .1
: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)
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)
;; Use visual line motions even outside of visual-line-mode buffers
(evil-global-set-key 'motion "j" 'evil-next-visual-line)
(evil-global-set-key 'motion "k" 'evil-previous-visual-line)
(evil-set-initial-state 'messages-buffer-mode 'normal)
(evil-set-initial-state 'dashboard-mode 'normal))
(use-package evil-collection
:after evil
:config
(evil-collection-init))
;; TODO bind counsel-switch-buffer to space f b
;; TODO bind to space f h
(use-package general
:config
(general-evil-setup t)
(general-create-definer albert/leader-key-def
:keymaps '(normal insert visual emacs)
:global-prefix "C-SPC"
:prefix "SPC")
(albert/leader-key-def
"f" '(:ignore t :which-key "files")
"ff" '(counsel-find-file :which-key "find file")
"fb" '(counsel-switch-buffer :which-key "find buffer file")
"fh" '(counsel-recentf :which-key "find recent file from history")
"fg" '(counsel-git :which-key "find git file")
"f/" '(counsel-rg :which-key "find file with content")
"z" '(:ignore t :which-key "zettelkasten")
"zn" '(neuron-new-zettel "create new zettel")
"zr" '(neuron-refresh "refresh zettelkasten")
"zz" '(neuron-edit-zettel :which-key "open zettel by title")
"zl" '(neuron-insert-zettel-link "link to a zettel")
"zi" '(neuron-create-and-insert-zettel-link "create a new zettel and link to it")
"ztt" '(neuron-toggle-connection-type :which-key "toggle link type")
"ztv" '(neuron-toggle-id-visibility :which-key "toggles link id visibility")
))
(use-package ivy
:diminish
:bind (("C-s" . swiper)
: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))
;; Need to run all-the-icons-install fonts on first run after install
(use-package all-the-icons)
(use-package doom-modeline
:init (doom-modeline-mode 1)
:custom ((doom-modeline-height 15)))
(use-package which-key
:init (which-key-mode)
:diminish which-key-mode
:config
(setq which-key-idle-delay 1))
(use-package ivy-rich
:init
(ivy-rich-mode 1))
(use-package counsel
:bind (("M-x" . counsel-M-x)
("C-x b" . counsel-ibuffer)
("C-x C-f" . counsel-find-file)
:map minibuffer-local-map
("C-r" . 'counsel-minibuffer-history))
:config
(setq counsel-fzf-cmd "fd --type f | fzf -f \"%s\""))
(use-package helpful
:custom
(counsel-describe-function-function #'helpful-callable)
(counsel-describe-variable-function #'helpful-variable)
:bind
([remap describe-function] . counsel-describe-function)
([remap describe-command] . helpful-command)
([remap describe-variable] . counsel-describe-variable)
([remap describe-key] . helpful-key))
(use-package nix-mode
:mode "\\.nix\\'")
(use-package neuron-mode
:config
(setq neuron-daily-note-title-format "%Y-%m-%d"))
(defun neuron--make-command (cmd &rest args)
"Construct a neuron command CMD with argument ARGS."
(concat
neuron-executable
" "
(mapconcat
#'shell-quote-argument
(append (list "-d" neuron--current-zettelkasten cmd) args) " ")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment