Config files for emacs, neovim, bash and more, organized in a single Org mode file. Inspired by larstvei/dot-emacs.
To get started, first download the file
wget https://raw.githubusercontent.com/xywei/conforg/master/conf.org
Make your backups.
The idea is that all the config files are generated by tangling this file. To be able to do that, you need Emacs and Org-mode, of course. For example, the following command tangles this file:
emacs -Q --batch --eval '(require (quote org))' \
--eval '(org-babel-tangle-file "conf.org")'
The process generates and installs the dot files for the included programs. Note that it will overwrite all the concerned files, so make sure to backup your own stuff first.
To finish the setup for an individual program, see the corresponding section for more information. (Tip: search for MANUALLY in all caps to find those places).
For the best experience, having a comprehensive set of fonts installed is recommended. The following packages are helpful to simplify the process:
aur/all-repository-fonts
aur/nerd-fonts-complete
NOTE: the recommended way of setting up is to use the provided
script `install.sh`. Before running the install script, make sure that the
repository is cloned at the path set in the meta-configuration section
($HOME/.conforg
by default) and all submodules are downloaded
git submodule update --init --recursive
See the output of install.sh --help
for detailed usage information.
First of all, set some global options to help setting things up. The meta-configurations are set via noweb references.
- Set the clone directory of
conforg
, which is used to find certain scripts.
- Set the root directory of Anaconda/Miniconda installation
- Set the directory of my synced scripts
- Set the directory of machine-specific scripts (not synced)
I use solarized
light/dark color schemes system-wide. Setting color values
in one place ensures consistency.
Read more at https://ethanschoonover.com/solarized/.
NOTE: by change those base colors, any color scheme can be implemented easily while preserving a consistent universal look.
Content/background monotones:
Accent colors:
Used for remote control of kitty
windows.
Ignore settings in Xresources
for now.
;; DO NOT EDIT
;; This file is generated by conf.org from xywei/conforg,
;; all changes will be overwritten.
(setq inhibit-x-resources t)
(package-initialize)
A helper function for tracing obsolete functions
;; (defun debug-on-load-obsolete (filename)
;; (when (equal (car (last (split-string filename "[/\\]") 2))
;; "obsolete")
;; (debug)))
;; (add-to-list 'after-load-functions #'debug-on-load-obsolete)
Configs in here should overrides all the others if there are conflicts, which is done using after-init-hook
Build a list of recently opened files and access by C-x C-r
(add-hook 'after-init-hook '(lambda ()
(progn
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(run-at-time nil (* 5 60) 'recentf-save-list)
(global-set-key "\C-x\ \C-r" 'recentf-open-files))))
Improve performance when ediing large files with large fonts. sabof/org-bullets#11
(setq inhibit-compacting-font-caches t)
Auto reload files that are changed on disk (for example, by nextcloud
syncs, or switching git
branches).
(add-hook 'after-init-hook '(lambda ()
(global-auto-revert-mode t)))
Set the browser for opening URLs.
TIP: use qutebrowser
instead of chromium
, since the vimium
plugin
does not work when viewing local pages.
UPDATE: qutebrowser
is slow to start. Reverse back to chromium
for now.
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "chromium"
browse-url-generic-args '("--new-window"))
Emacs creates `file~` auto-backup files and `#file#` auto-save files. Such behavior confuses programs like `git` and `isync`. Instead of turning this feature off, it is more prudent to simply get them out of sight by storing them in the OS’s tmp directory instead.
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
Also, periodically save files to the disk.
Remove scroll bars, menu bars, and toolbars to make more space
(add-hook 'after-init-hook '(lambda ()
(progn
;; (when (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
)
))
Wind-move (vim-like)
(add-hook 'after-init-hook '(lambda ()
(progn
(global-set-key (kbd "C-c h") 'windmove-left)
(global-set-key (kbd "C-c j") 'windmove-down)
(global-set-key (kbd "C-c k") 'windmove-up)
(global-set-key (kbd "C-c l") 'windmove-right)
)
))
Make frame to be able to resize to full height
(add-hook 'after-init-hook '(lambda ()
(progn
(setq frame-resize-pixelwise t)
)
))
Disable automatic horizontal scrolling, which causes abrupt jumps. Use C-x < and C-x > to do it manually.
(add-hook 'after-init-hook '(lambda ()
(progn
(setq auto-hscroll-mode nil)
)
))
Vertical split by default
(add-hook 'after-init-hook '(lambda ()
(progn
(setq split-height-threshold nil)
(setq split-width-threshold 80)
)
))
Interactively do things.
(add-hook 'after-init-hook '(lambda ()
(progn
;; make buffer switch command do suggestions, also for find-file command
(require 'ido)
(ido-mode 1)
;; show choices vertically
(if (version< emacs-version "25")
(progn
(make-local-variable 'ido-separator)
(setq ido-separator "\n"))
(progn
(make-local-variable 'ido-decorations)
(setf (nth 2 ido-decorations) "\n")))
;; show any name that has the chars you typed
(setq ido-enable-flex-matching t)
;; use current pane for newly opened file
(setq ido-default-file-method 'selected-window)
;; use current pane for newly switched buffer
(setq ido-default-buffer-method 'selected-window)
;; stop ido from suggesting when naming new file
(define-key (cdr ido-minor-mode-map-entry) [remap write-file] nil)
;; big minibuffer height, for ido to show choices vertically
(setq max-mini-window-height 0.5)
;; stop ido suggestion when doing a save-as
(define-key (cdr ido-minor-mode-map-entry) [remap write-file] nil)
)))
Spell check needs aspell and its dictionaries to be installed
(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
Melpa and Marmalade.
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
Org ELPA
(add-to-list 'package-archives
'("org" . "https://orgmode.org/elpa/") t)
Scripts for package management.
NOTE IF EMACS IS UPGRADED: The packages need to be re-compiled, because Emacs Lisp byte code is generally not compatible across major versions.
To re-compile all packages, run (by pressing M-:
)
(byte-recompile-directory package-user-dir nil 'force)
After restarting Emacs, packages should work fine.
Define a list of required packages. For ease of use, keep the list in alphabetical order.
TODO: transition to manage packages with use-package
.
(defvar required-packages
'(
evil
evil-collection
evil-goggles
evil-org
evil-surround
fill-column-indicator
lv
magit
nlinum
nlinum-relative
org-bullets
org-caldav
org-plus-contrib
org-pomodoro
org-ref
org2blog
powerline
solarized-theme
use-package
visual-fill-column
yasnippet
) "a list of packages to ensure are installed at launch.")
Then install the packaged listed in the required-packages variable
To reduce overhead, we use a method to check if all packages are installed
(require 'cl)
(defun packages-installed-p ()
(loop for p in required-packages
when (not (package-installed-p p)) do (return nil)
finally (return t)))
If not all packages are installed, check one by one and install the missing ones. This way Emacs does not refresh its package database everytime it starts.
(unless (packages-installed-p)
; check for new packages (package versions)
(message "%s" "Emacs is now refreshing its package database...")
(package-refresh-contents)
(message "%s" " done.")
; install the missing packages
(dolist (p required-packages)
(when (not (package-installed-p p))
(package-install p))))
TODO: manage system packages using system-packages
.
(use-package system-packages
:ensure t)
Load org2blog configs.
(load-file "~/.emacs.d/org2blogrc.el")
Ensure that Emacs uses the same environment setup as user shell.
(when (memq window-system '(mac ns x))
(use-package exec-path-from-shell
:ensure t)
(exec-path-from-shell-initialize))
Set package manager to homebrew
.
(when (memq window-system '(mac ns))
(setq system-packages-use-sudo nil)
(setq system-packages-package-manager 'brew))
Replace selection, use Ctrl+u to scroll (more natural to vim users)
(setq evil-want-C-u-scroll t)
(delete-selection-mode t)
Enable global evil-mode. (As a general guideline, don’t bind anything to : nor <escape>).
(use-package evil
:ensure t
:init
(setq evil-want-integration t) ;; This is optional since it's already set to t by default.
(setq evil-want-keybinding nil)
:config
(evil-mode 1))
Enable evil-collection for keybindings in more modes.
(use-package evil-collection
:after evil
:ensure t
:config
(evil-collection-init))
Enable evil-surround for keybindings like =ds”=.
(use-package evil-surround
:ensure t
:config
(global-evil-surround-mode 1))
Visual hints to help keeping up with what’s happening.
(use-package evil-goggles
:ensure t
:config
(evil-goggles-mode)
(evil-goggles-use-diff-faces))
Adding new word to dictionary
(define-key evil-normal-state-map "zg" 'flyspell-correct-word-before-point)
Evil-org
(use-package evil-org
:ensure t
:after org
:config
(add-hook 'org-mode-hook 'evil-org-mode)
(add-hook 'evil-org-mode-hook
(lambda ()
(evil-org-set-key-theme)))
(require 'evil-org-agenda)
(evil-org-agenda-set-keys))
Org2blog
(use-package org2blog
:ensure t
:after org
:config
(add-hook 'org-mode-hook #'org2blog/wp-org-mode-hook-fn))
Indicate column 80 for programming and text editing
(add-hook 'prog-mode-hook 'turn-on-fci-mode)
(add-hook 'text-mode-hook 'turn-on-fci-mode)
Set the styles
(setq-default fill-column 80)
(setq fci-rule-width 1)
(setq fci-rule-color "dark orange")
(require 'fill-column-indicator)
This mode recreates a handy feature from Vim by displaying relative line numbers.
Currently the emacs version in Arch repo is 25. When it is updated to 26, use `display-line-number-mode` as linum-mode’s backend for smooth performance.
;; (setq linum-relative-backend 'display-line-numbers-mode)
Show the real line number of the current line instead of “0”
;; (setq linum-relative-current-symbol "")
This mode is so nice that I want it to be always on
;; (require 'linum-relative)
;; (add-hook 'prog-mode-hook 'linum-relative-mode)
;; (add-hook 'text-mode-hook 'linum-relative-mode)
One caveat: it does not play well with folding. Read more about this issue
Now I have switched to nlinum
for better performance
(use-package nlinum-relative
:config
;; something else you want
(nlinum-relative-setup-evil)
(add-hook 'prog-mode-hook 'nlinum-relative-mode)
(add-hook 'text-mode-hook 'nlinum-relative-mode))
(No need for patched fonts)
(require 'powerline)
(powerline-center-evil-theme)
Fontify code in code blocks. (This does can cause lagging for complex files like this one. A local variable list is usually helpful for such use cases. See the end of this file for example.)
(with-eval-after-load 'org
(setq org-src-fontify-natively t))
Make latex fragments larger, default is roughly 100 font size
(with-eval-after-load 'org
(plist-put org-format-latex-options :scale 1.6))
Org-bullets that display nice bullet symbols.
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
To do similar stuff with TODO items (courtesy of https://www.draketo.de/english/emacs/todo-letters):
- ❢ To do
- ☯ In progress
- ⚙ A program is running (optional detail)
- ✍ I’m writing (optional detail)
- ⧖ Waiting
- ☺ To report
- ✔ Done
- ⌚ Maybe do this at some later time
- ✘ Won’t do / Canceled
Here I only use the symbols to make the interface less cluttered. Note: Anything before the | in the SEQ_TODO is shown in red (not yet done), anything after the | is show in green (done). Things which get triggered when something is done (like storing the time of a scheduled entry) happen when the state crosses the |.
(with-eval-after-load 'org
(setq org-todo-keywords '(
(sequence "❢" "☯" "⚙" "✍" "⧖" "|" "☺" "✔" "⌚" "✘"))))
Use mouse to toggle tree visibility.
(require 'org-mouse)
Auto new-line
(add-hook 'org-mode-hook 'turn-on-auto-fill)
Toggle latex preview with fewer key strokes
(add-hook 'org-mode-hook
(lambda () (local-set-key (kbd "C-c p") 'org-toggle-latex-fragment)))
Enable previewing tikz
images, which requires imagemagick
.
(add-to-list 'org-latex-packages-alist '("" "tikz" t))
(eval-after-load "preview"
'(add-to-list 'preview-default-preamble
"\\PreviewEnvironment{tikzpicture}" t))
(setq org-latex-create-formula-image-program 'imagemagick)
Save link with C-c l
, (insert link with C-c C-l
, follow link with C-c C-o
)
(add-hook 'org-mode-hook
(lambda () (local-set-key (kbd "C-c l") 'org-store-link)))
Agenda view (global) C-c a
, capture (global) C-c c
.
(setq org-agenda-files (directory-files-recursively "~/Agenda/" "\.org$"))
(setq org-agenda-sorting-strategy
'((agenda todo-state-up time-up)
(todo priority-down category-keep)
(tags priority-down category-keep)
(search category-keep)))
(add-hook 'after-init-hook
'(lambda ()
(progn
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
)
))
Show only TODO
, NEXT
, and WAITING
types of entries.
(require 'org-habit)
(defun my-org-agenda-skip-habits ()
"Skip habits"
(save-restriction
(widen)
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
(if (org-is-habit-p)
next-headline
nil))))
(setq org-agenda-skip-function 'my-org-agenda-skip-habits)
Load org-caldav
configs.
(load-file "~/.emacs.d/org-caldav-config.el")
For org-ref. Load the module and set keybindings or inserting citations and
cross-references.
Disable show-broken-links
for better performance.
(with-eval-after-load 'org
(require 'org-ref))
(add-hook 'org-mode-hook
(lambda ()
(setq org-latex-prefer-user-labels t)
(setq org-ref-show-broken-links nil)
(local-set-key (kbd "C-c t") 'org-ref-helm-insert-cite-link)
(local-set-key (kbd "C-c r") 'org-ref-helm-insert-ref-link)
))
A layout for writing long articles (inspired by Scrivener).
First define a function that helps with the layout. It enlarges current window to twice the size of the other (assuming there are only two of them).
(with-eval-after-load 'org
(defun halve-other-window-width ()
"Expand current window to use half of the other window's width."
(interactive)
(enlarge-window-horizontally (/ (window-width (next-window)) 2))))
This function opens content under the current header and moves over the cursor.
(with-eval-after-load 'org
(defun org-tree-open-in-new-window ()
(interactive)
(delete-other-windows)
(org-tree-to-indirect-buffer)
(other-window 1)
(halve-other-window-width)
(rename-buffer (org-get-heading) t)))
Bind this to Shift+Enter
(with-eval-after-load 'org
(define-key org-mode-map
[S-return] 'org-tree-open-in-new-window))
This function opens content under the current header but does not move the cursor.
(with-eval-after-load 'org
(defun org-tree-open-in-new-window-cursor-stays ()
(interactive)
(delete-other-windows)
(org-tree-to-indirect-buffer)
(other-window 1)
(halve-other-window-width)
(rename-buffer (org-get-heading) t)
(other-window 1)))
Not bound.
;; (with-eval-after-load 'org
;; (define-key org-mode-map
;; [S-return] 'org-tree-open-in-new-window-cursor-stays))
Allow ignoring heading while export the content of subtrees
(with-eval-after-load 'org
(require 'ox-extra)
(ox-extras-activate '(ignore-headlines)))
Open agenda in current window
(setq org-agenda-window-setup (quote current-window))
Warn me of any deadlines in next 7 days
(setq org-deadline-warning-days 7)
Show me tasks scheduled or due in next fortnight
(setq org-agenda-span (quote fortnight))
Sort tasks in order of when they are due and then by priority
(setq org-agenda-sorting-strategy
(quote
((agenda time-up deadline-up priority-down)
(todo priority-down category-keep)
(tags priority-down category-keep)
(search category-keep))))
Default to capturing a task dated today and optionally link to the current file (e.g. email)
(setq org-capture-templates
'(("m" "todo (email)" entry (file+headline "~/Agenda/mylife.org" "Inbox")
"* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")
("t" "todo" entry (file+headline "~/Agenda/mylife.org" "Inbox")
"* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n")
))
(To have sound notifications, install alsa-utiles
to get aplay
.)
Usage:
- Move point to a task as you would do with org-clock-in. Call
org-pomodoro
the task will be clocked-in. - When there’s time for break, the task will be
org-clock-out
‘ed - If you call
org-pomodoro
during a pomodoro, you’ll be asked to reset a pomodoro. - If you call
org-pomodoro
outside org-mode, you’ll be presented with list of recent tasks, as C-u org-clock-in would.
Emacs’s built-in appointment management module.
(require 'appt)
(appt-activate t)
(setq appt-message-warning-time 5) ; Show notification 5 minutes before event
(setq appt-display-interval appt-message-warning-time) ; Disable multiple reminders
(setq appt-display-mode-line nil)
Use appointment data from org-mode
.
(defun my-org-agenda-to-appt ()
(interactive)
(setq appt-time-msg-list nil)
(org-agenda-to-appt))
Update alarms when starting Emacs
.
(my-org-agenda-to-appt)
Update alarms everyday at 12:05am.
(run-at-time "12:05am" (* 24 3600) 'my-org-agenda-to-appt)
Update alarms when mylife.org
is saved.
(add-hook 'after-save-hook
'(lambda ()
(if (string= (buffer-file-name) (concat (getenv "HOME") "/Agenda/mylife.org"))
(my-org-agenda-to-appt))))
Update alarms each time agenda opened.
(add-hook 'org-finalize-agenda-hook 'my-org-agenda-to-appt)
Display appointments as a window manager notification.
(setq appt-disp-window-function 'my-appt-display)
(setq appt-delete-window-function (lambda () t))
(setq my-appt-notification-app (concat (getenv "HOME") "/cli-utils/appt-notification"))
(defun my-appt-display (min-to-app new-time msg)
(if (atom min-to-app)
(start-process "my-appt-notification-app" nil my-appt-notification-app min-to-app msg)
(dolist (i (number-sequence 0 (1- (length min-to-app))))
(start-process "my-appt-notification-app" nil my-appt-notification-app (nth i min-to-app) (nth i msg)))))
When starting for the first time Emacs will ask if you want to trust this theme. Answer yes to have it auto-loaded on future startups. (Warning: this will load the theme without prompting for safety concerns)
(setq x-underline-at-descent-line t)
(add-hook 'after-init-hook (lambda () (load-theme 'solarized-light t)))
Enable global yas-global-mode
(require 'yasnippet)
(yas-global-mode 1)
Let the snippets be saved in my own place
(yas-load-directory "~/.emacs.d/snippets")
Don’t expand snippets in terminal mode
(add-hook 'term-mode-hook (lambda()
(setq yas-dont-activate t)))
Here are some snippets that I would like to have on all my machines
The install script handles configuring `isync`. (It dumps encrypted config files using pass).
One can use mutt/neomutt to read mails. Here is a one liner that uses Lynx to open mails in mutt.
auto_view text/html
text/html; lynx -dump %s; nametemplate=%s.html; copiousoutput;
Mu4e is the email client of choice due to its great integration with org-mode.
Note: Since mu4e is not just elisp, much of it is in C, it cannot be installed from MELPA. This setup assume that it is installed from Arch’s repository (Community/mu), and we load it into Emacs
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
(require 'mu4e)
Load the configuration file for mu4e. (Requires use-package).
(load-file "~/.emacs.d/mu4e-config.el")
The evil-collection adds evil keybindings for mu4e.
General commands:
Commmand | evil-mu4e | Alternative |
---|---|---|
Jump to maildir | J | |
Update | u | |
Compose message | cc | C |
Kill update mail process | x |
Commands for header-mode and view-mode:
Command | evil-mu4e | Alternative |
---|---|---|
Next message | C-j | |
Previous message | C-k | |
Mark the current thread as read | T | |
Compose message | cc | C |
Compose edit** | ce | E |
Compose forward** | cf | F |
Compose reply | cr | R |
Change sorting*** | o | O |
Rerun search | gr | |
Toggle include related | zr | |
Toggle threading | zt | |
Toggle hide cited | za | |
Skip duplicates | zd | |
Show log | gl | |
Select other view | gv | |
Save attachement(s) | p | P |
Save url | yu | |
Go to url | gx | |
Fetch url | gX |
- * denotes only in header-mode
- ** denotes Alternative only in header-mode
- *** denotes Alternative only in view-mode
The following guide is excerpted from https://www.djcbsoftware.nl/code/mu/mu4e/Queries.html.
mu4e queries are the same as the ones that mu find understands30. Let’s look at some examples here; you can consult the mu-query man page for the details.
- Get all messages regarding bananas:
bananas
- Get all messages regarding bananas from John with an attachment:
from:john and flag:attach and bananas
- Get all messages with subject wombat in June 2017
subject:wombat and date:20170601..20170630
- Get all messages with PDF attachments in the /projects folder
maildir:/projects and mime:application/pdf
- Get all messages about Rupert in the /Sent Items folder. Note that maildirs with spaces must be quoted.
"maildir:/Sent Items" and rupert
- Get all important messages which are signed:
flag:signed and prio:high
- Get all messages from Jim without an attachment:
from:jim and not flag:attach
- Get all messages with Alice in one of the contacts-fields (to, from, cc, bcc):
contact:alice
- Get all unread messages where the subject mentions Ångström: (search is case-insensitive and accent-insensitive, so this matches Ångström, angstrom, aNGstrøM, …)
subject:Ångström and flag:unread
- Get all unread messages between Mar-2012 and Aug-2013 about some bird:
date:20120301..20130831 and nightingale and flag:unread
- Get today’s messages:
date:today..now
- Get all messages we got in the last two weeks regarding emacs:
date:2w.. and emacs
- Get messages from the Mu mailing list:
list:mu-discuss.googlegroups.com
Note — in the Headers view you may see the ‘friendly name’ for a list; however, when searching you need the real name. You can see the real name for a mailing list from the friendly name’s tool-tip.
- Get messages with a subject soccer, Socrates, society, …; note that the ‘*’-wildcard can only appear as a term’s rightmost character:
subject:soc*
- Get all messages not sent to a mailing-list:
NOT flag:list
- Get all mails with attachments with filenames starting with pic; note that the ‘*’ wildcard can only appear as the term’s rightmost character:
file:pic*
- Get all messages with PDF-attachments:
mime:application/pdf
- Get all messages with image attachments, and note that the ‘*’ wildcard can only appear as the term’s rightmost character:
mime:image/*
The following guide is excerpted from https://www.djcbsoftware.nl/code/mu/mu4e/What-to-mark-for.html.
What to mark for – mu4e supports a number of marks:
mark for/as | keybinding | description |
---|---|---|
‘something’ | *, <insert> | mark now, decide later |
delete | D, <delete> | delete |
flag | + | mark as ‘flagged’ (‘starred’) |
move | m | move to some maildir |
read | ! | mark as read |
refile | r | mark for refiling |
trash | d | move to the trash folder |
untrash | = | remove ‘trash’ flag |
unflag | - | remove ‘flagged’ mark |
unmark | u | remove mark at point |
unmark all | U | remove all marks |
unread | ? | marks as unread |
action | a | apply some action |
After marking a message, the left-most columns in the headers view indicate the kind of mark. This is informative, but if you mark many (say, thousands) messages, this slows things down significantly32. For this reason, you can disable this by setting mu4e-headers-show-target to nil.
“something” is a special kind of mark; you can use it to mark messages for ‘something’, and then decide later what the ‘something’ should be33 Later, you can set the actual mark using M-x mu4e-mark-resolve-deferred-marks (#). Alternatively, mu4e will ask you when you try to execute the marks (x).
Fonts for Linux, for details, see https://www.freedesktop.org/software/fontconfig/fontconfig-user.html.
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<!--
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
-->
Basic fonts that I use.
<fontconfig>
<alias>
<family>serif</family>
<prefer><family>Linux Libertine</family></prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer><family>Linux Libertine</family></prefer>
</alias>
<alias>
<family>sans</family>
<prefer><family>Source Sans Pro</family></prefer>
</alias>
<alias>
<family>monospace</family>
<prefer><family>Hack Nerd Font Mono</family></prefer>
</alias>
</fontconfig>
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
[user]
email = wxy0516@gmail.com
name = xywei
signingkey = F038F98DF34297D9
[push]
default = simple
[alias]
mylog = log --pretty=format:'%h %s [%an]' --graph
lol = log --graph --decorate --pretty=oneline --abbrev-commit --all
br = branch
ds = diff --staged
wd = diff --word-diff --ignore-all-space
wds = diff --staged --word-diff --ignore-all-space
difftex = difftool -y -t latex
lg = log --oneline --reverse
dls = diff-tree --no-commit-id --name-status -r
st = status
co = checkout
br = branch
ci = commit
getroot = !pwd
beholdmyamazingcode = commit
[credential]
helper = cache --timeout=3600
[difftool.latex]
cmd = latexdiff "$LOCAL" "$REMOTE"
[core]
excludesfile = ~/.gitignore_global
editor = $(which nvim)
filemode = false
[gpg]
program = gpg2
[commit]
gpgsign = true
[color]
ui = auto
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
To un-ignore some of these files, or ignore more files on a project basis, edit `.gitignore` in the project folder.
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
The `.gitignore_global` contents are generated by `install.sh` after tangling.
NOTE: i3
related configurations are highly machine-specific
(depends on the keyboard layout, screen size etc.); therefore,
those are tracked under contrib
until I come up with a better
way.
Checklist:
- Note that
i3-renameworkspaces
needs some perl modulesAnyEvent::I3
available asany/perl-anyevent-i3
Linux::Itodify2
available from AUR asaur/perl-linux-inotify2
- Install programs that have keybindings / autostart defined
rofi
j4-dmenu-desktop
passmenu
chromium
kitty
emacs
vim
dunst
nextcloud-client
blueman-applet
feh
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
set $mod Mod4
focus_follows_mouse no
If using i3-gaps
fork,
for_window [class="^.*"] border pixel 3
gaps inner 1
gaps outer 1
Font for window titles.
font pango:Hack 11
Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
Dynamic workspace naming
exec_always --no-startup-id <<conforg-dir>>/contrib/i3-renameworkspaces/i3-renameworkspaces.pl
Dynamic wallpaper
exec_always --no-startup-id <<conforg-dir>>/contrib/i3-wpd/i3wpd.py "--bg-fill --bg black" <<conforg-dir>>/contrib/i3-wpd/solar .jpg
Syncthing
exec_always --no-startup-id "XDG_CURRENT_DESKTOP=GNOME syncthing-gtk -m"
Turn off X screen saver. Power saver (Energy Star): turn off screen after 20min idle
exec_always --no-startup-id xset s off
exec_always --no-startup-id xset dpms 0 0 1200
Mark a window as the “master” window that can be easily swapped around (even across workspace).
# Mod1 is usually Alt, and button2 is the middle button.
bindsym --whole-window $mod+Mod1+button2 mark --add quickswap; exec "notify-send 'QuickSwap' 'Window marked.'"
bindsym --whole-window $mod+button2 swap container with mark quickswap; [con_mark="quickswap"] focus
bindsym $mod+Mod1+x mark --add quickswap; exec "notify-send 'QuickSwap' 'Window marked.'"
bindsym $mod+x swap container with mark quickswap; [con_mark="quickswap"] focus
“Dropdown” terminal for i3
.
# "dropdown" terminal
exec_always --no-startup-id ~/cli-utils/ddstart &
bindsym $mod+grave exec --no-startup-id ~/cli-utils/ddshow
for_window [instance="dropdown"] floating enable, resize set 60 ppt 60 ppt, \
move scratchpad
Conky
exec_always --no-startup-id conky
Float some windows for better compatibility
for_window [class="Xfce4-notifyd"] floating enable
for_window [class="Lazarus"] floating enable
Start Bluetooth manager if installed
exec_always --no-startup-id "blueman-applet"
Set colors in .Xresources
, and read them here
set_from_resource $darkblack i3wm.color0 #000000
set_from_resource $black i3wm.color8 #000000
set_from_resource $darkred i3wm.color1 #000000
set_from_resource $red i3wm.color9 #000000
set_from_resource $darkgreen i3wm.color2 #000000
set_from_resource $green i3wm.color10 #000000
set_from_resource $darkyellow i3wm.color3 #000000
set_from_resource $yellow i3wm.color11 #000000
set_from_resource $darkblue i3wm.color4 #000000
set_from_resource $blue i3wm.color12 #000000
set_from_resource $darkmagenta i3wm.color5 #000000
set_from_resource $magenta i3wm.color13 #000000
set_from_resource $darkcyan i3wm.color6 #000000
set_from_resource $cyan i3wm.color14 #000000
set_from_resource $darkwhite i3wm.color7 #000000
set_from_resource $white i3wm.color15 #000000
set $transparent #00000000
Colors
# BORDER BACKGROUND TEXT INDICATOR CHILD_BORDER
client.focused $red $red $magenta $darkmagenta $darkblue
client.unfocused $transparent $blue $white $darkblue $darkblack
client.focused_inactive $transparent $blue $white $darkblue $darkblack
client.urgent $darkred $darkred $black $darkred $darkred
client.background $black
I use compton
as the compositor for i3
.
exec --no-startup-id compton -b
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
# inactive-dim = 0.05;
# inactive-opacity = 0.95;
# must have this if using flashfocus
detect-client-opacity = true;
# must have this if using i3+flashfocus
opacity-rule = [
"0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
];
# use the old X Render backend
# (the OpenGL backend has been buggy)
# and the performance hit can be minimized by not using blur
backend = "xrender"
dockd
detects docking station and changes the screen layout.
If using conforg
on a non-thinkpad, simply do not install dockd
and this
section will not be tangled.
exec_always --no-startup-id dockd --daemon
Dunst is the notification back-end when not using a DE.
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
exec --no-startup-id dunst
Global (default) configurations.
- For Icons, install
adwaita-icon-theme
[global]
monitor = 0
follow = keyboard
geometry = "1000x0-0+0"
indicate_hidden = yes
shrink = no
transparency = 0
notification_height = 0
separator_height = 3
padding = 12
horizontal_padding = 12
frame_width = 3
frame_color = "#268bd2"
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = frame
# Sort messages by urgency.
sort = yes
idle_threshold = 120
# The font that comes latter takes precedence
font = EmojiOne 11, Monospace 11
line_height = 0
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "<b>%a</b>%p: %s\n%b"
alignment = left
show_age_threshold = 30
word_wrap = yes
ellipsize = middle
ignore_newline = no
stack_duplicates = true
hide_duplicate_count = false
show_indicators = yes
icon_position = left
max_icon_size = 80
icon_path = /usr/share/icons/gnome/16x16/devices/:/usr/share/icons/Adwaita/256x256/status/
sticky_history = yes
history_length = 200
dmenu = /usr/bin/dmenu -p dunst:
browser = /usr/bin/firefox -new-tab
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
title = Dunst
class = Dunst
startup_notification = false
force_xinerama = false
[experimental]
per_monitor_dpi = false
[shortcuts]
close = ctrl+space
close_all = ctrl+shift+space
history = ctrl+grave
context = ctrl+shift+period
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#282828"
foreground = "#928374"
timeout = 5
# Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon
[urgency_normal]
background = "#4f5b66"
foreground = "#f2f2f2"
timeout = 5
[urgency_critical]
background = "#cc2421"
foreground = "#ebdbb2"
frame_color = "#fabd2f"
timeout = 0
Start Emacs daemon, setting LC_CTYPE
for compatibility with fcitx
.
exec --no-startup-id LC_CTYPE=zh_CN.UTF-8 emacs --daemon
flashfocus
adds focus animations.
It can be installed from aur/flashfocus-git
.
exec_always --no-startup-id flashfocus
bindsym $mod+n exec --no-startup-id flash_window
find-cursor
uses animations to help finding your mouse cursor.
NOTE: it only works with xorg
.
bindsym $mod+c exec --no-startup-id "~/cli-utils/find-cursor"
fcitx
, short for Flexible Context-aware Input Tool with eXtension, is
used for Chinese input.
exec_always --no-startup-id fcitx
Caveats:
kitty
does not support it yet.emacs
supports it only when settingLC_CTYPE
tozh_CN.UTF-8
.
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
This sections sets up kdeconnect
for i3
.
exec_always --no-startup-id kdeconnect-indicator
Use keycode to bind numpad keys (so that it works with numlock on/off)
set $KP_1 87
set $KP_2 88
set $KP_3 89
set $KP_4 83
set $KP_5 84
set $KP_6 85
set $KP_7 79
set $KP_8 80
set $KP_9 81
set $KP_0 90
set $KP_Return 104
Start a terminal
bindsym $mod+Return exec --no-startup-id kitty -1 --listen-on <<conforg-kittysocket>>
bindcode $mod+$KP_Return exec --no-startup-id kitty -1 --listen-on <<conforg-kittysocket>>
Start vim-anywhere
bindsym $mod+Shift+Return exec --no-startup-id /home/xywei/.conforg/contrib/vim-anywhere/vim-anywhere nvim kitty
bindcode $mod+Shift+$KP_Return exec --no-startup-id /home/xywei/.conforg/contrib/vim-anywhere/vim-anywhere nvim kitty
Check email
bindsym $mod+m exec --no-startup-id "emacsclient -n -c --eval '(mu4e)'"
Check agenda/todo list
bindsym $mod+t exec --no-startup-id "emacsclient -n -c --eval '(org-agenda-list)'"
bindsym $mod+a exec --no-startup-id emacsclient -n -c --eval '(find-file "~/Agenda/mylife.org")'
Start emacsclient/capture tasks
bindsym $mod+Escape exec --no-startup-id emacsclient -c -n
bindsym $mod+Shift+Escape exec --no-startup-id emacsclient -n -c --eval '(progn (org-capture nil "t") (delete-other-windows))'
Start browsers. TIP: install background process
plugin
(https://chrome.google.com/webstore/detail/background-process/)
so that chromium process is kept alive after closing the last tab.
bindsym $mod+BackSpace exec firefox
bindsym $mod+Shift+BackSpace exec chromium
bindsym $mod+Delete exec firefox
bindsym $mod+Shift+Delete exec chromium
Kill focused window
bindsym $mod+Shift+q kill
Start dmenu-type menus
bindsym $mod+d exec --no-startup-id j4-dmenu-desktop
bindsym $mod+p exec --no-startup-id passmenu
bindsym $mod+i exec --no-startup-id rofi -combi-modi window#drun#run -show combi -font "hack 18" -theme solarized
Change focus with vim keys; alternatively, you can use the cursor keys.
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
Move focused window with vim keys; alternatively, you can use the cursor keys as well.
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
Move workspace across monitors; alternatively, you can use the cursor keys.
bindsym $mod+Control+Shift+h move workspace to output left
bindsym $mod+Control+Shift+j move workspace to output down
bindsym $mod+Control+Shift+k move workspace to output up
bindsym $mod+Control+Shift+l move workspace to output right
bindsym $mod+Control+Shift+Left move workspace to output left
bindsym $mod+Control+Shift+Down move workspace to output down
bindsym $mod+Control+Shift+Up move workspace to output up
bindsym $mod+Control+Shift+Right move workspace to output right
Split in horizontal orientation (daws a bar in between windows)
bindsym $mod+bar split h
Split in vertical orientation (daws a horizontal line in between windows)
bindsym $mod+minus split v
Enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
Change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
Toggle tiling / floating
bindsym $mod+Shift+space floating toggle
Change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
Previous workspace (switches back and forth)
bindsym $mod+Tab workspace back_and_forth
Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
bindcode $mod+$KP_1 workspace number 1
bindcode $mod+$KP_2 workspace number 2
bindcode $mod+$KP_3 workspace number 3
bindcode $mod+$KP_4 workspace number 4
bindcode $mod+$KP_5 workspace number 5
bindcode $mod+$KP_6 workspace number 6
bindcode $mod+$KP_7 workspace number 7
bindcode $mod+$KP_8 workspace number 8
bindcode $mod+$KP_9 workspace number 9
bindcode $mod+$KP_0 workspace number 10
Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
bindcode $mod+Shift+$KP_1 move container to workspace number 1
bindcode $mod+Shift+$KP_2 move container to workspace number 2
bindcode $mod+Shift+$KP_3 move container to workspace number 3
bindcode $mod+Shift+$KP_4 move container to workspace number 4
bindcode $mod+Shift+$KP_5 move container to workspace number 5
bindcode $mod+Shift+$KP_6 move container to workspace number 6
bindcode $mod+Shift+$KP_7 move container to workspace number 7
bindcode $mod+Shift+$KP_8 move container to workspace number 8
bindcode $mod+Shift+$KP_9 move container to workspace number 9
bindcode $mod+Shift+$KP_0 move container to workspace number 10
Reload conforg
bindsym $mod+Shift+c exec --no-startup-id <<conforg-dir>>/refresh.sh
Restart i3 inplace (preserves your layout/session, can be used to upgrade
i3). Caveat: nextcloud-client
tray icon will be lost.
bindsym $mod+Shift+r exec --no-startup-id <<conforg-dir>>/restart.sh
Exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
Switch user (using lightDM
)
bindsym $mod+Shift+f exec "i3-nagbar -t warning -m 'You pressed the switch user shortcut. Do you really want to switch user? This will throw you back to the greeter.' -B 'Yes, switch user' 'i3-msg exec dm-tool switch-to-greeter'"
Lock screen (starts i3lock and turns off screen)
bindsym $mod+Shift+d exec notify-send "Lock Screen" "You pressed the lock shortcut. Do you really want to lock i3? This will turn off your screen." && echo -e "lock\ncancel" | dmenu | xargs ~/cli-utils/lock
Volume control with media keys
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -SIGRTMIN+10 i3blocks #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -SIGRTMIN+10 i3blocks #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -SIGRTMIN+10 i3blocks # mute sound
Mic mute (supported by current kernel in Arch, no extra kernel module needed) Note: The command must be quoted since it has a comma.
bindsym XF86AudioMicMute exec --no-startup-id "amixer sset 'Capture',0 toggle"
Brightness control via xbacklight
. Also set the brightness level on startup.
NOTE: brightness control is now handled by acpid
on a system-specific basis,
since modesetting driver does not work with xbacklight
.
# bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 5
# bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 5
# exec --no-startup-id xbacklight -set 50
Note: XF86WLAN
, XF86Bluetooth
work without extra setting
Set displays via dmenu.
bindsym XF86Display exec --no-startup-id ~/cli-utils/dispman
A rescue measure when accidentally lose all displays :P, which calls
autorandr
to detect and set displays.
bindsym $mod+XF86Display exec --no-startup-id autorandr --change && notify-send "Display Restored 😎: mind your own step :P"
Search for emoji with rofi
interface.
bindsym XF86Tools exec --no-startup-id ~/cli-utils/emojisel
bindsym $mod+q exec --no-startup-id ~/cli-utils/emojisel
TODO:
Cannot see a log in xev
when pressing fn+f12 and fn+f11
Need to bind them at system level (acpi)?
Start the protonmail-bridge
at login. NOTE: It uses pass
to store login
session information; as a result, 2FA becomes useless if your password store
(not just the password itself) is compromised.
(Protonmail Desktop Bridge can be installed from AUR
.)
exec_always --no-startup-id "pgrep protonmail || PASSWORD_STORE_DIR=$HOME/.config/protonmail-pass protonmail-bridge --no-window"
Use a different password store to remedy 2FA issue & keep main password store tidy.
alias protonmail-bridge='PASSWORD_STORE_DIR=$HOME/.config/protonmail-pass protonmail-bridge'
A mode used to resize windows (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
bindcode $KP_Return mode "default"
}
bindsym $mod+r mode "resize"
Adjust gaps interactively.
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer"
bindsym i mode "$mode_gaps_inner"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_inner" {
bindsym plus gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym 0 gaps inner current set 0
bindsym Shift+plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym Shift+0 gaps inner all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
bindsym plus gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym 0 gaps outer current set 0
bindsym Shift+plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym Shift+0 gaps outer all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
Use i3blocks
to display a status bar on top of the screen.
bar {
font pango:Hack 11
colors {
background $darkblack
statusline $darkwhite
separator $cyan
focused_workspace $blue $darkblue $darkblack
active_workspace $blue $blue $darkwhite
inactive_workspace $darkblack $darkblack $white
urgent_workspace $darkblack $darkblack $white
}
status_command i3blocks
position top
mode hide
modifier $mod
}
An alternative bar setup that is better for smaller screens
bar {
font pango:Hack 11
colors {
background $darkblack
statusline $darkwhite
separator $cyan
focused_workspace $blue $darkblue $darkblack
active_workspace $blue $blue $darkwhite
inactive_workspace $darkblack $darkblack $white
urgent_workspace $darkblack $darkblack $white
}
workspace_buttons no
status_command i3blocks
position bottom
mode hide
modifier $mod
}
bar {
font pango:Hack 11
colors {
background $darkblack
statusline $darkwhite
separator $cyan
focused_workspace $blue $darkblue $darkblack
active_workspace $blue $blue $darkwhite
inactive_workspace $darkblack $darkblack $white
urgent_workspace $darkblack $darkblack $white
}
tray_output none
position top
mode hide
modifier $mod
}
autorandr
is used to handle different setups.
On startup, detect and set the output profile.
exec_always --no-startup-id autorandr --change
Nextcloud client. Note: do not use --no-startup-id
option so that the tray
icon works normally.
exec --no-startup-id "nextcloud"
unclutter
hides the mouse cursor when inactive
exec_always --no-startup-id unclutter --exclude-root --timeout 5 -b
Wallpapers set from archlinux-wallpaper
.
# exec_always --no-startup-id feh --randomize --bg-scale /usr/share/backgrounds/*
bindsym $mod+Shift+w exec --no-startup-id ~/cli-utils/refresh_wallpaper
i3blocks
is scripted with block-wise callback controls.
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
command=<<conforg-dir>>/contrib/i3blocks-commands/$BLOCK_NAME
separator_block_width=15
markup=pango
Disabled blocks:
[memory]
interval=10
label=🧠
[disk]
label=💾
command=<<conforg-dir>>/contrib/i3blocks-commands/disk /
interval=60
[cpu]
interval=5
label=💻
Enabled blocks:
[eject]
label=⏏️
interval=10
signal=22
[mailbox]
label=📬
interval=300
signal=11
[battery]
command=<<conforg-dir>>/contrib/i3blocks-commands/battery BAT0
label=BAT0
interval=30
[battery]
command=<<conforg-dir>>/contrib/i3blocks-commands/battery BAT1
label=BAT1
interval=30
[weather]
interval=7200
[pomodoro]
interval=1
[clock]
label=📅
interval=30
[record]
command=cat /tmp/recordingicon
interval=once
signal=9
[volume]
interval=30
signal=10
[music]
interval=30
[internet]
interval=10
Alternatively, blocks without emoji.
[eject]
label=Eject
interval=10
signal=22
[mailbox-nounicode]
label=Inbox
interval=300
signal=11
[battery]
command=<<conforg-dir>>/contrib/i3blocks-commands/battery BAT0
label=BAT0
interval=30
[battery]
command=<<conforg-dir>>/contrib/i3blocks-commands/battery BAT1
label=BAT1
interval=30
[weather]
interval=7200
[pomodoro]
interval=1
[clock]
interval=30
[record]
command=cat /tmp/recordingicon
interval=once
signal=9
[volume-nounicode]
interval=30
signal=10
[music-nounicode]
interval=30
[internet-nounicode]
interval=10
Front matter.
--[[
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
]]
conky
configurations. Compatible with i3
.
conky.config = {
alignment = 'top_right',
background = true,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'white',
default_outline_color = 'white',
default_shade_color = 'white',
double_buffer = true,
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
extra_newline = false,
font = 'DejaVu Sans Mono:size=12',
gap_x = 60,
gap_y = 60,
minimum_height = 5,
minimum_width = 5,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_ncurses = false,
out_to_stderr = false,
out_to_x = true,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'override',
show_graph_range = false,
show_graph_scale = false,
stippled_borders = 0,
update_interval = 1.0,
uppercase = false,
use_spacer = 'none',
use_xft = true,
}
conky
contents.
conky.text = [[
${color grey}Info:$color $sysname $nodename $kernel $machine
$hr
${color grey}Uptime:$color $uptime
${color grey}Frequency (in MHz):$color $freq
${color grey}Frequency (in GHz):$color $freq_g
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes
$hr
${color grey}File systems:
/ $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color grey}Networking:
Up:$color ${upspeed} ${color grey} - Down:$color ${downspeed}
$hr
${color grey}Name PID CPU% MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
$hr
${exec task}
]]
Kitty
is a GPU accelerated terminal emulator, by the author of Calibre
.
# Current color scheme: default
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
kitty
has very powerful font management. You can configure
individual font faces and even specify special fonts for particular
characters.
font_family Hack Nerd Font Mono
bold_font auto
italic_font auto
bold_italic_font auto
#: Font size (in pts)
font_size 11
# To fix underscore rendering issues
adjust_line_height 110%
Block shaped cursor that does not blink.
cursor_shape block
cursor_blink_interval 0
Allow remote control.
allow_remote_control yes
To reverse scroll direction, set a negative multiplier.
scrollback_lines 20000
scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER
wheel_scroll_multiplier 5.0
Show scrollback buffer in the current window: ctrl+shift+h
.
Open the scrollback buffer in a new window.
map f1 pipe @ansi window less +G -R
To reverse scroll direction, set a negative multiplier.
url_color #0087BD
url_style curly
#: The modifier keys to press when clicking with the mouse on URLs to
#: open the URL
open_url_modifiers kitty_mod
open_url_with default
copy_on_select no
rectangle_select_modifiers ctrl+alt
# double click to select a word
select_by_word_characters :@-./_~?&=%+#
click_interval 0.5
# auto hide mouse cursor
mouse_hide_wait 3.0
# ~100 FPS, while sync screen updates to the refresh rate of the monitor
repaint_delay 10
sync_to_monitor yes
# input delay, increase this if screen flickers
input_delay 3
enable_audio_bell yes
bell_on_tab yes
# disable visual bell (screen flash)
visual_bell_duration 0.0
# Request window attention on bell. Makes the dock icon bounce on
# macOS or the taskbar flash on linux.
window_alert_on_bell yes
remember_window_size yes
initial_window_width 640
initial_window_height 400
# For layouts, see https://sw.kovidgoyal.net/kitty/index.html#layouts.
enabled_layouts *
window_resize_step_cells 2
window_resize_step_lines 2
window_border_width 1.0
draw_minimal_borders yes
window_margin_width 0.0
window_padding_width 0.0
active_border_color #00ff00
inactive_border_color #cccccc
bell_border_color #ff5a00
inactive_text_alpha 0.85
tab_bar_edge top
tab_bar_margin_width 0.0
tab_bar_style fade
tab_fade 0.25 0.5 0.75 1
active_tab_foreground #000
active_tab_background #eee
active_tab_font_style bold-italic
inactive_tab_foreground #444
inactive_tab_background #999
inactive_tab_font_style normal
About the opacity of the background: A number between 0 and 1, where 1 is opaque and 0 is fully transparent. This will only work if supported by the OS (for instance, when using a compositor under X11). Note that it only sets the default background color’s opacity. This is so that things like the status bar in vim, powerline prompts, etc. still look good. But it means that if you use a color theme with a background color in your editor, it will not be rendered as transparent. Instead you should change the default background color in your kitty config and not use a background color in the editor color scheme. Or use the escape codes to set the terminals default colors in a shell script to launch your editor. Be aware that using a value less than 1.0 is a (possibly significant) performance hit.
If you want to dynamically change transparency of windows set dynamic_background_opacity to yes (this is off by default as it has a performance cost)
<<conforg-kitty-colors-dark>>
<<conforg-kitty-colors-light>>
Write the default colors to kitty.conf
, together some related parameters.
<<conforg-kitty-colors-light>>
background_opacity 1.0
dynamic_background_opacity no
dim_opacity 0.75
hide_window_decorations yes
editor nvim
macos_titlebar_color system
macos_option_as_alt yes
macos_hide_from_tasks no
macos_quit_when_last_window_closed yes
macos_window_resizable yes
macos_thicken_font 0
macos_traditional_fullscreen no
macos_custom_beam_cursor no
For a list of key names, see: GLFW keys http://www.glfw.org/docs/latest/group__keys.html. The name to use is the part after the GLFW_KEY_ prefix. For a list of modifier names, see: GLFW mods http://www.glfw.org/docs/latest/group__mods.html
On Linux you can also use XKB key names to bind keys that are not supported by GLFW. See XKB keys <https://github.com/xkbcommon/libxkbcommon/blob/master/xkbcommon/xkbcommon- keysyms.h> for a list of key names. The name to use is the part after the XKB_KEY_ prefix. Note that you should only use an XKB key name for keys that are not present in the list of GLFW keys.
Finally, you can use raw system key codes to map keys. To see the system key code for a key, start kitty with the kitty –debug- keyboard option. Then kitty will output some debug text for every key event. In that text look for “native_code“ the value of that becomes the key name in the shortcut.
NOTE: The hints kitten has many more modes of operation that I don’t make use of as of right now.
kitty_mod ctrl+shift
# remove default shorcuts
clear_all_shortcuts yes
map kitty_mod+c copy_to_clipboard
map kitty_mod+v paste_from_clipboard
map kitty_mod+s paste_from_selection
map shift+insert paste_from_selection
map kitty_mod+o pass_selection_to_program
map kitty_mod+up scroll_line_up
map kitty_mod+k scroll_line_up
map kitty_mod+down scroll_line_down
map kitty_mod+j scroll_line_down
map kitty_mod+page_up scroll_page_up
map kitty_mod+page_down scroll_page_down
map kitty_mod+home scroll_home
map kitty_mod+end scroll_end
map kitty_mod+h show_scrollback
map kitty_mod+enter new_window
map kitty_mod+n new_os_window
map kitty_mod+q close_window
map kitty_mod+] next_window
map kitty_mod+[ previous_window
map kitty_mod+f move_window_forward
map kitty_mod+b move_window_backward
map kitty_mod+` move_window_to_top
map kitty_mod+r start_resizing_window
map kitty_mod+1 first_window
map kitty_mod+2 second_window
map kitty_mod+3 third_window
map kitty_mod+alt+h neighboring_window left
map kitty_mod+alt+l neighboring_window right
map kitty_mod+alt+j neighboring_window down
map kitty_mod+alt+k neighboring_window up
map kitty_mod+right next_tab
map kitty_mod+left previous_tab
map kitty_mod+t new_tab
map kitty_mod+w close_tab
map kitty_mod+. move_tab_forward
map kitty_mod+, move_tab_backward
map kitty_mod+alt+t set_tab_title
map ctrl+t new_tab !neighbor
map alt+1 goto_tab 1
map alt+2 goto_tab 2
map alt+3 goto_tab 3
map kitty_mod+equal change_font_size all +2.0
map kitty_mod+minus change_font_size all -2.0
map kitty_mod+backspace change_font_size all 0
#: Open a currently visible URL using the keyboard. The program used
#: to open the URL is specified in open_url_with.
map kitty_mod+e kitten hints
map kitty_mod+f11 toggle_fullscreen
map kitty_mod+u kitten unicode_input
map kitty_mod+f2 edit_config_file
map kitty_mod+escape kitty_shell window
" DO NOT EDIT
" This file is generated by conf.org from xywei/conforg,
" all changes will be overwritten.
Reload files changed on disk.
set autoread
au FocusGained * :checktime
Assign the results to `s:uname`.
if has('unix')
let s:uname = system("uname")
" Assume that llvm is installed via homebrew on MacOS
" brew install llvm --with-clang
if s:uname == "Darwin\n"
let g:chromatica#libclang_path='/usr/local/opt/llvm/lib/libclang.dylib'
endif
" Assme that this a an Arch linux, using clang from pacman
if s:uname == "Linux\n"
" libclang in miniconda takes priority
if filereadable("~/miniconda3/lib/libclang.so")
let g:chromatica#libclang_path='~/miniconda3/lib/libclang.so'
elseif filereadable("/usr/lib/libclang.so")
let g:chromatica#libclang_path='/usr/lib/libclang.so'
endif
endif
endif
Install plugins under `.vim/plugged`.
call plug#begin('~/.vim/plugged')
Vim-airline.
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
VOom: an outliner based on folding marks.
Plug 'vim-voom/VOoM'
NeoSolarized: A fixed solarized colorscheme for better truecolor support.
Plug 'icymind/NeoSolarized'
A code minimap that resembles Sublime text.
Plug 'severin-lemaignan/vim-minimap'
Syntax highlighting for prm files.
Plug 'xywei/vim-dealii-prm'
Neomake (note: do not use it with other async frameworks like ale).
Plug 'neomake/neomake'
Neoformat
Plug 'sbdchd/neoformat'
Fugitive, with GitHub/GitLab support of :Gbrowse
.
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'shumphrey/fugitive-gitlab.vim'
Help visually display indent levels
Plug 'nathanaelkane/vim-indent-guides'
Display ansi escape sequences in a readable way
Plug 'IngoHeimbach/vim-plugin-AnsiEsc'
Tag bar.
Plug 'majutsushi/tagbar'
Deoplete. Update remote plugins when load.
function! DoRemote(arg)
UpdateRemotePlugins
endfunction
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
vim-slime
.
Plug 'jpalardy/vim-slime'
UltiSnips.
Plug 'SirVer/ultisnips'
CtrlP is deprecated in favor of FZF.vim.
Plug 'ctrlpvim/ctrlp.vim'
FZF.vim: use a specific version of fzf
.
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
NerdTree with lazy loading.
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Easy align.
Plug 'junegunn/vim-easy-align'
Enable stuff like ds, cs and yss
Plug 'tpope/vim-surround'
Auto comment manipulation.
Plug 'tpope/vim-commentary'
Match pairs of quotes etc.
Plug 'Raimondi/delimitMate'
Enhance undo functionality.
Plug 'mbbill/undotree'
Tmux statusline generator
Plug 'edkolev/tmuxline.vim'
Use tmux nav keys to navigate.
Plug 'christoomey/vim-tmux-navigator'
Always load vim-devicons at last. (vim-plug loads the plugins in the same order as they are registered) The terminal’s font must be set as one of the nerd-fonts
Plug 'ryanoasis/vim-devicons'
let g:tagbar_width = 50
let g:tagbar_type_tex = {
\ 'ctagstype' : 'latex',
\ 'kinds' : [
\ 's:sections',
\ 'g:graphics:1',
\ 'l:labels:1',
\ 'r:refs:1',
\ 'p:pagerefs:1'
\ ],
\ 'sort' : 0
\ }
I am no longer using =CtrlP=. Instead I will bind it to =fzf.vim=. (Install `ag` from `community/the_silver_searcher`.)
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'c'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.gz
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
let g:ctrlp_use_caching = 0
endif
if executable('rg')
set grepprg=rg\ --color=never
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching = 0
endif
A bundled version of fzf
is used for fzf.vim
.
Configure it to be CtrlP
replacement.
let g:fzf_action = {
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\ }
nnoremap <c-p> :FZF<cr>
augroup fzf
autocmd!
autocmd! FileType fzf
autocmd FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
augroup END
Then some additional features (switch buffers, most recently used etc.
nnoremap <silent> <leader>f :Files<CR>
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>w :Windows<CR>
nnoremap <silent> <leader>t :Tags<CR>
nnoremap <silent> <leader>r :History<CR>
nnoremap <silent> <leader>/ :Rg
Use the :Rg
integration
nnoremap <silent> <leader>s :call SearchWordWithRg()<CR>
vnoremap <silent> <leader>s :call SearchVisualSelectionWithRg()<CR>
function! SearchWordWithRg()
execute 'Rg' expand('<cword>')
endfunction
function! SearchVisualSelectionWithRg() range
let old_reg = getreg('"')
let old_regtype = getregtype('"')
let old_clipboard = &clipboard
set clipboard&
normal! ""gvy
let selection = getreg('"')
call setreg('"', old_reg, old_regtype)
let &clipboard = old_clipboard
execute 'Rg' selection
endfunction
Also, enhance built-in c-x c-f
completion in the insert mode.
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-l> <plug>(fzf-complete-line)
let g:fugitive_gitlab_domains = ['https://git.wxyzg.com', 'https://gitlab.tiker.net']
If using other formatting plugin, define noNeoformat for that file type (for example, yapf for Python).
if !exists('b:noNeoformat')
nnoremap <buffer><Leader>= :<C-u>Neoformat<CR>
vnoremap <buffer><Leader>= :Neoformat<CR>
endif
- Enable basic formatting when a filetype is not found. Disabled by default.
- Enable alignment
- Enable tab to spaces conversion
- Enable trimmming of trailing whitespace
let g:neoformat_basic_format_align = 1
let g:neoformat_basic_format_retab = 1
let g:neoformat_basic_format_trim = 1
Set commentstring for files not supported by default
autocmd FileType apache setlocal commentstring=#\ %s
Enable the plugin
let g:webdevicons_enable = 1
set encoding=utf8
Add integration with
- NERDTree
- vim-airline
- CtrlP
let g:webdevicons_enable_nerdtree = 1
let g:webdevicons_conceal_nerdtree_brackets = 1
let g:webdevicons_enable_airline_tabline = 1
let g:webdevicons_enable_airline_statusline = 1
let g:webdevicons_enable_ctrlp = 1
And some tweaks. Including:
- use double-width(1) or single-width(0) glyphs only manipulates padding, has no effect on terminal or set(guifont) font
- the amount of space to use after the glyph character (default ’ ‘)
- force extra padding in NERDTree so that the filetype icons line up vertically
let g:WebDevIconsUnicodeGlyphDoubleWidth = 1
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
Do not automatically close stuff.
let delimitMate_autoclose = 0
Use <tab> to expand snippets.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsListSnippets="<c-u>"
let g:UltiSnipsEditSplit="vertical"
Ways to do auto-completion:
- vim’s defaualt keybindings, among which the
awesome ones are:
- Ctrl+x Ctrl+n Just this file
- Ctrl+x Ctrl+f For filenames (under var path)
- Ctrl+x Ctrl+] For tags
- Ctrl+n Everything specified by the ‘complete’ option
- vim’s omnifunc Ctrl+x Ctrl+o (often too verbose)
set omnifunc=syntaxcomplete#Complete
- Deoplete plugin Ctrl+l (clang/jedi based)
let g:deoplete#enable_at_startup = 1
let g:deoplete#disable_auto_complete = 0
let g:deoplete#omni#input_patterns = {}
inoremap <silent><expr><C-l> deoplete#mappings#manual_complete()
autocmd CompleteDone * pclose
Install `jedi` through `pip` first.
Plug 'zchee/deoplete-jedi'
Options
let g:deoplete#sources#jedi#statement_length = 50
let g:deoplete#sources#jedi#enable_typeinfo = 1
let g:deoplete#sources#jedi#show_docstring = 1
Install the built package (no need for yarn
).
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } }
Options.
let g:mkdp_browser = 'qutebrowser'
nnoremap <Leader>v :VoomToggle<cr>
nnoremap <Leader>o :VoomToggle<cr>
let g:airline_powerline_fonts = 1
let g:airline_theme='sol'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tmuxline#enabled = 1
let g:airline#extensions#tmuxline#snapshot_file = "~/.tmux-statusline-colors.conf"
nmap <Leader>t :TagbarToggle<cr>
nmap tb :TagbarToggle<cr>
let g:ctrlp_map = '<c-p>'
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
xmap <Leader>a <Plug>(EasyAlign)
nmap <Leader>a <Plug>(EasyAlign)
map <C-n> :NERDTreeToggle<CR>
nmap <Leader>f :NERDTreeToggle<cr>
Note that some configurations have to go after this.
call plug#end()
Auto-run when writing or reading a buffer, and on changes in insert and normal mode (after 1s; no delay when writing). Must be used after loading Neomake.
call neomake#configure#automake('nrwi', 500)
Additional makers for a python
project, use :Neomake tag
to make tags
for the project.
let g:neomake_python_tag_maker = {
\ 'exe': 'ctags',
\ 'args': ['-R', '--fields=+l', '--languages=python', '--python-kinds=-iv', '-f', 'tags', '.'],
\ 'errorformat': '%f:%l:%c: %m',
\ }
Lost track of cursor? Press `<Leader> + K`!
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white
hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white
function FindCursor()
if !exists("s:highlightcursor")
let s:highlightcursor=1
set cursorline
set cursorcolumn
else
unlet s:highlightcursor
set nocursorline
set nocursorcolumn
endif
endfunction
nnoremap <Leader>K :call FindCursor()<CR>
nnoremap <Leader>k :call FindCursor()<CR>
Run through `black` and then `docformatter`.
let g:neoformat_enabled_python = ['black', 'docformatter']
let g:neoformat_run_all_formatters = 1
Clang-format is used.
let g:neoformat_enabled_c = ['clangformat']
let g:neoformat_enabled_cpp = ['clangformat']
Defines two commands to work with trailing spaces:
- `ShowSpaces`
- `TrimSpaces`
function ShowSpaces(...)
let @/='\v(\s+$)|( +\ze\t)'
let oldhlsearch=&hlsearch
if !a:0
let &hlsearch=!&hlsearch
else
let &hlsearch=a:1
end
return oldhlsearch
endfunction
function TrimSpaces() range
let oldhlsearch=ShowSpaces(1)
execute a:firstline.",".a:lastline."substitute ///gec"
let &hlsearch=oldhlsearch
endfunction
command -bar -nargs=? ShowSpaces call ShowSpaces(<args>)
command -bar -nargs=0 -range=% TrimSpaces <line1>,<line2>call TrimSpaces()
set relativenumber
set number
Turn off swap files (often troubsome, for example, when in shared folders)
set noswapfile
Auto-reload files changed outside vim
set autoread
A plugin to have Emacs SLIME
in vim.
Note that all the executions go through the paste file. Be cautious if it is
a shared server (in that case maybe use a file that only you can read).
The default setup is to run an ipython
console on the right pane.
let g:slime_target = "tmux"
let g:slime_paste_file = tempname()
let g:slime_default_config = {"socket_name": "default", "target_pane": "{right-of}"}
A command to make tags for the project After generating the tags, use
- Ctrl+] to jump to tag
- g Ctrl+] to list all matches
- Ctrl+t to jump back
command! MakeTags !ctags -R .
Replace the built-in undo.
nnoremap <leader>u :UndotreeToggle<cr>
Enable persistent undo as recommended
if has("persistent_undo")
set undodir=~/.undodir/
set undofile
endif
" For true colors in tmux https://github.com/tmux/tmux/issues/1246
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
set termguicolors
set background=light
" set background=dark
colorscheme NeoSolarized
Enable mouse.
set mouse=a
File type system.
filetype plugin indent on
Use spaces instead of tabs.
set tabstop=2 shiftwidth=2 expandtab
Disable tumx nav mappings. (Configure nav keys on the tmux side.)
let g:tmux_navigator_no_mappings = 1
Use system clipboard (“^=” means prepend).
if (executable('pbcopy') || executable('xclip') || executable('xsel')) && has('clipboard')
set clipboard^=unnamed,unnamedplus
endif
Add snippets from ConfOrg. FIXME: UltiSnipsSnippetDirectories does not work with noweb.
set runtimepath+=<<conforg-dir>>/contrib/nvim-snips
let g:UltiSnipsSnippetDirectories=[$HOME.'/.conforg/contrib/nvim-snips']
Set python interpreter on MacOS (ignore virtualenv and conda)
if s:uname == "Darwin\n"
let g:python_host_prog='/usr/local/bin/python2'
let g:python3_host_prog='/usr/local/bin/python3'
endif
Set python interpreter on Linux (ignore virtualenv and conda)
if s:uname == "Linux\n"
let g:python_host_prog='/usr/bin/python2'
let g:python3_host_prog='/usr/bin/python3'
endif
Display all matchings when we do tab complete
set wildmenu
Use markers to fold also enable space to trigger the fold in normal mode
set foldmethod=marker
nnoremap <space> za
Make highlighted text more readable.
hi Search cterm=None ctermbg=blue ctermfg=white
Smooth scrolling
set scrolloff=4
set nolazyredraw
Change the cursor shape in the terminal
:let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
Turn off blink in normal mode
set gcr=n:blinkon0
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
Use Chromium
instead of default Lynx
.
browser chromium
Notifications setting.
notify-always yes
notify-format "newsboat: %n unread articles within %f unread feeds"
notify-program notify-send
notify-xterm yes
notify-screen yes
Keybindings resembling Vim/Ranger. Remember to unbind keys first to avoid collision.
unbind-key h
unbind-key j
unbind-key k
unbind-key l
unbind-key g
unbind-key G
bind-key h quit
bind-key j down
bind-key k up
bind-key l open
bind-key g home
bind-key G end
articlelist-format "%4i %f %D %?T?|%-17T| ?%t"
highlight feedlist "^ *[0-9]+ *N " default default
highlight articlelist "^ *[0-9]+ *N " default default
highlight article "(^Feed:.*|^Title:.*|^Author:.*)" default default
highlight article "(^Link:.*|^Date:.*)" default default
highlight article "^Podcast Download URL:.*" default default
highlight article "^Links:" default default underline
highlight article "\\[[0-9][0-9]*\\]" default default bold
highlight article "\\[image [0-9][0-9]*\\]" default default bold
highlight article "\\[embedded flash: [0-9][0-9]*\\]" default default bold
highlight article ":.*\\(link\\)$" default default
highlight article ":.*\\(image\\)$" default default
highlight article ":.*\\(embedded flash\\)$" default default
color listnormal default default
color listfocus default blue
color info default default
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
Taskwarrior generates a `.taskrc` if the file does not exist.
#
# Taskwarrior program configuration file.
# For more documentation, see http://taskwarrior.org or try 'man task', 'man task-color',
# 'man task-sync' or 'man taskrc'
#
# By removing this file and running
# $ task
# you can ask for a freshly generated config file.
#
data.location=~/.task
include TASKWARRIOR_COLOR_THEME
For the setup to be complete, `password-store` needs to be setup in advance. Otherwise `task sync` will not be usable.
taskd.certificate=ABSOLUTE_ESCAPED_HOME_DIR\/.task\/xywei.cert.pem
taskd.key=ABSOLUTE_ESCAPED_HOME_DIR\/.task\/xywei.key.pem
taskd.ca=ABSOLUTE_ESCAPED_HOME_DIR\/.task\/ca.cert.pem
taskd.server=TASKD_SERVER_ADDR
taskd.credentials=WXYZG\/Xiaoyu Wei\/TASKD_SERVER_USER_KEY
Note: this config does not unset all default keybindings, for example,
bind-key d detach-client
bind-key 0 select-window -t :0
bind-key 1 select-window -t :1
bind-key 2 select-window -t :2
bind-key 3 select-window -t :3
bind-key 4 select-window -t :4
bind-key 5 select-window -t :5
bind-key 6 select-window -t :6
bind-key 7 select-window -t :7
bind-key 8 select-window -t :8
bind-key 9 select-window -t :9
bind-key : command-prompt
bind-key ? list-keys
bind-key i display-message
bind-key { swap-pane -U
bind-key } swap-pane -D
bind-key v copy-mode
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
Better colors
# https://github.com/tmux/tmux/issues/1246
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",*256col*:Tc"
Increase scroll-back history.
set -g history-limit 100000
Use vim key bindings.
setw -g mode-keys vi
Allow using mouse Note: this only works for tmux version >= 2.1
set -g mouse on
Copy mouse-selected text to clipboard
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe "xclip" \; display-message "Copied to clipboard."
Decrease command delay (increase vim responsiveness)
set -g escape-time 1
Setup ‘v’ to begin selection
bind-key -T copy-mode-vi v send -X begin-selection
Increase repeat time for repeatable commands
set -g repeat-time 1000
Start window and pane index at 1
set -g base-index 1
set -g pane-base-index 1
Highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
Automatic renumber/rename windows
set -g renumber-windows on
set -g automatic-rename on
A nice article explaining clipboards: https://medium.freecodecamp.org/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
Set terminal title
set -g set-titles on
set -g set-titles-string '#h ❐ #S ● #I #W'
Slightly longer pane indicators/status messages display time
set -g display-panes-time 800
set -g display-time 1000
24 hour clock
setw -g clock-mode-style 24
Rather than constraining window size to the maximum size of any client connected to the session, constrain window size to the maximum size of any client connected to that window. Much more reasonable.
setw -g aggressive-resize on
Status bar
set-option -g status on
set -g status-position bottom
set -g status-style "dim"
set -g status-interval 2
set -g status-justify left
Show host name, session, window, pane in the left
set -g status-left-length 50
set -g status-left ' '
Date and time on right side
set -g status-right-length 60
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
From tmuxline.vim. If the snapshot file is not present, load a defualt one.
if-shell "test -f ~/cli-utils/tmuxline" "source ~/cli-utils/tmuxline"
if-shell "test -f ~/.tmux-status.conf" "source ~/.tmux-status.conf"
Bold messages
set -g message-style "bold"
setw -g mode-style "bold"
Tmux prefix: `C-j` for usual sessions, `C-k` for nested sessions.
unbind C-b
set -g prefix 'C-j'
bind-key -n 'C-k' send-prefix
Quickly reload .tmux.conf
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
New window
bind t new-window
Window splitting: `|` vertical, `-` horizontal
unbind %
bind | split-window -h -c "#{pane_current_path}"
unbind '"'
bind - split-window -v -c "#{pane_current_path}"
Enhanced C-l that now clears both screen and history
bind ` send-keys C-l \; run 'tmux clear-history'
For vim-tmux-navigator. Smart pane switching with awareness of Vim splits. See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
Caveat: only works in normal mode
bind h if-shell "$is_vim" "send-keys :TmuxNavigateLeft Enter" "select-pane -L"
bind j if-shell "$is_vim" "send-keys :TmuxNavigateDown Enter" "select-pane -D"
bind k if-shell "$is_vim" "send-keys :TmuxNavigateUp Enter" "select-pane -U"
bind l if-shell "$is_vim" "send-keys :TmuxNavigateRight Enter" "select-pane -R"
bind \ if-shell "$is_vim" "send-keys :TmuxNavigatePrevious Enter" "select-pane -l"
Resize panes
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
Repeat last shell command on the right pane (if it happens to be a shell) binding to “m” for “make”
bind m select-pane -t 2 \; \
send-keys q C-c C-m clear C-m \
tmux Space clear-history C-m \
Up Up Up C-m \; \
last-pane
Enter copy-mode
bind-key -n C-q copy-mode
History navigation
bind-key -T copy-mode-vi Home send -X history-top
bind-key -T copy-mode-vi End send -X history-bottom
bind-key -T copy-mode-vi -n S-PPage send -X halfpage-up
bind-key -T copy-mode-vi -n S-NPage send -X halfpage-down
Swap right pane in window 1 with default pane in window 2, binding to “p” for “pane_swap”. Make sure our current window is listed as 1
- create a second window if it does not exist
- select our 1 window again in case we created a new one
- select our 2nd pane in 1 window
- join that pane to window 2
- select the pane above the one we just moved there
- move that pane to window 1
bind p \
if-shell 'tmux select-window -t :1' '' 'move-window -t :1' \; \
if-shell 'test $(tmux list-panes | wc -l) -gt 1' '' 'split-window -h' \; \
if-shell 'tmux select-window -t :2' '' 'new-window' \; \
select-window -t 1 \; \
select-pane -t 2 \; \
join-pane -t 2.1 \; \
select-pane -U \; \
join-pane -h -t 1.1 \; \
last-pane
Clock
bind-key c clock-mode
Show pane indicators
bind-key p display-panes
Hit `prefix + I` to fetch the plugins and source them. Hit `prefix + U` to update plugins.
List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-open'
Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
Use the custom theme and enable image previews. For best experiences, set the terminal to use solarized light colors.
set colorscheme custom
set draw_borders true
set line_numbers relative
Then there is a plugin that sets glyph for each file included in contrib/
and is set up by running install.sh
.
For image preview, we use `img2txt` from `libcaca` `w3m`
set preview_images true
set preview_images_method w3m
The following systemd
timer switches color scheme twice everyday based on
machine time.
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
[Unit]
Description=Set the color scheme based on system time
[Service]
Type=simple
ExecStart=%h/cli-utils/set_dynamic_colors
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
[Unit]
Description=color scheme switch timer
[Timer]
OnCalendar=*-*-* 6:00:00
OnCalendar=*-*-* 18:00:00
Persistent=true
[Install]
WantedBy=timers.target
To use this timer, first refresh systemd
daemon by running
systemctl --user daemon-reload
Then enable/start the timer
systemctl --user enable night-and-day.timer
systemctl --user start night-and-day.timer
The following systemd
timer updates RSS feeds every 20
minutes.
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
[Unit]
Description=Update RSS Feeds
[Service]
Type=simple
ExecStart=newsboat -x reload
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
[Unit]
Description=RSS Feeds Update Timer
[Timer]
OnCalendar=*:0/20
Persistent=true
[Install]
WantedBy=timers.target
To use this timer, first refresh systemd
daemon by running
systemctl --user daemon-reload
Then enable/start the timer
systemctl --user enable newsboat-update.timer
systemctl --user start newsboat-update.timer
The following systemd
timer runs mbsync
every 20
minutes.
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
[Unit]
Description=Sync Maildirs
[Service]
Type=simple
ExecStart=%h/cli-utils/get_mails
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
[Unit]
Description=Maildir Sync Timer
[Timer]
OnCalendar=*:0/20
Persistent=true
[Install]
WantedBy=timers.target
! DO NOT EDIT
! This file is generated by conf.org from xywei/conforg,
! all changes will be overwritten.
!! The default colors are "Gruvbox":
*.color0: #1d2021
*.color1: #cc241d
*.color2: #98971a
*.color3: #d79921
*.color4: #458588
*.color5: #b16286
*.color6: #689d6a
*.color7: #a89984
*.color8: #928374
*.color9: #fb4934
*.color10: #b8bb26
*.color11: #fabd2f
*.color12: #83a598
*.color13: #d3869b
*.color14: #8ec07c
*.color15: #ebdbb2
!! Transparency (0-255):
*.alpha: 230
!! Emacs transparency (0-100):
Emacs.alpha: 100
!! Set a default font and font size as below:
!! *.font: Monospace-11;
XTerm*faceName: DejaVu Sans Mono for Powerline
Scrolling control
! do not scroll with output
URxvt*scrollTtyOutput: false
! scroll in relation to buffer (with mouse scroll or Shift+Page Up)
URxvt*scrollWithBuffer: true
! scroll back to the bottom on keypress
URxvt*scrollTtyKeypress: true
! disable the scrollback buffer for the secondary screen
URxvt*secondaryScreen: 1
URxvt*secondaryScroll: 0
! hide scroll bar
URxvt.scrollBar: false
Fonts installed from:
- WenQuanYi Zen Hei (Chinese) font from
any/wqy-zenhei
- WenQuanYi Micro Hei (Chinese) font from
any/wqy-microhei
- Nerd fonts from
aur/nerd-fonts-complete
URxvt.font: xft:Inconsolata Nerd Font Mono:pixelsize=20:minspace=False,xft:WenQuanYi Micro Hei Mono:pixelsize=20,xft:WenQuanYi Zen Hei Mono:pixelsize=20,xft:DejaVu Sans Mono Nerd Font Complete:pixelsize=20:minspace=False
URxvt*letterSpace: 0
i3-status and i3’s window decorations respect Xresources.
NOTE: dpi
can be changed through -d
option of install.sh
.
Xft.dpi: 150
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
Map Capslock to be Esc
TODO: switch to setxkbmap
clear Lock
keycode 0x42=Escape
This section contains configurations for zshell. To change the default shell for the current user, run
chsh -s /bin/zsh
I am not using any framework for my configurations. If you are new to zsh, you will probably be interested in checking out one of them, e.g., oh-my-zsh.
A way to profile the startup time as explained in this blog post is to use
this snippet at the start of zshrc
:
And then add this at the end:
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
<<start-profiling>>
export CONFORG_DIR=<<conforg-dir>>
export CONDA_DIR=<<conda-dir>>
export CLI_UTILS_DIR=<<cli-utils-dir>>
export SCRIPTS_DIR=<<scripts-dir>>
Do nothing if not running interactively
case $- in
*i*) ;;
*) return;;
esac
Use emacs mode
bindkey -e
Fix GPG complaints
export GPG_TTY=$(tty)
Make Java apps follw the Gtk look and feel.
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
Let lightdm
pick up the settings as well.
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
Just to add some fun..
if [ -f $CONFORG_DIR/contrib/bash-insulter/src/bash.command-not-found ]; then
source $CONFORG_DIR/contrib/bash-insulter/src/bash.command-not-found
fi
Starting from conda 4.4
, it uses conda activate
command instead of the
old source activate
, which is a nice move: it is no longer needed to add
it to PATH
.
if [ -f $CONDA_DIR/etc/profile.d/conda.sh ]; then
. $CONDA_DIR/etc/profile.d/conda.sh
fi
Saves the need to type full paths.
setopt auto_cd
cdpath=($HOME/Nextcloud $HOME/Research)
Set PATH to include:
- cli-utils: my scripts
- scripts: local scripts
export PATH=$HOME/.local/bin:$PATH
export PATH=$CLI_UTILS_DIR:$PATH
export PATH=$SCRIPTS_DIR:$PATH
Use vim
to open man pages, which
- enables coloring
- highlights current search math
- and has
vim
keybindings (plusq
for quit)
export MANPAGER="sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu' \
-c 'nnoremap i <nop>' \
-c 'nnoremap <Space> <C-f>' \
-c 'noremap q :quit<CR>' -\""
Set default editor to be neovim
export EDITOR="nvim"
export VISUAL="nvim"
Enable 256 color support in terminal
export TERM=screen-256color
Allow using pip outside a virtual env
export PIP_REQUIRE_VIRTUALENV=false
Setup zkbd to use some keys in zsh. It prompts for an interactive setup when used for the first time. Note that the file generated sometimes does not have the correct filename.
On first start, zkbd
will prompt for an interactive test of keyboard, which
generates ~/.zkbd/term-name-xxx
file. Make a copy of this file named,
e.g., screen-256color-pc-linux-gnu
to let it be sourced.
Sometimes system update changes what the key sends (why??). If that happens,
simply remove the aforementioned config file and zsh
will prompt for retests
on next start.
autoload zkbd
[[ ! -f ${ZDOTDIR:-$HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE ]] && zkbd
source ${ZDOTDIR:-$HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE
[[ -n ${key[Backspace]} ]] && bindkey "${key[Backspace]}" backward-delete-char
[[ -n ${key[Insert]} ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n ${key[Home]} ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n ${key[PageUp]} ]] && bindkey "${key[PageUp]}" up-line-or-history
[[ -n ${key[Delete]} ]] && bindkey "${key[Delete]}" delete-char
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
[[ -n ${key[PageDown]} ]] && bindkey "${key[PageDown]}" down-line-or-history
[[ -n ${key[Up]} ]] && bindkey "${key[Up]}" up-line-or-search
[[ -n ${key[Left]} ]] && bindkey "${key[Left]}" backward-char
[[ -n ${key[Down]} ]] && bindkey "${key[Down]}" down-line-or-search
[[ -n ${key[Right]} ]] && bindkey "${key[Right]}" forward-char
Save 1000 commands and enable history sharing among all terminals
SAVEHIST=1000
HISTFILE=~/.zsh_history
setopt inc_append_history
Enable completion by putting compinit
at the end of the zshrc
autoload -Uz compinit
Git command autocompletion
GIT_COMPLETION_BASH=/usr/share/git/completion/git-completion.zsh
if [ -f $GIT_COMPLETION_ZSH ]; then
zstyle ':completion:*:*:git:*' script $GIT_COMPLETION_ZSH
fi
Conda commands autocompletion
fpath+=$CONFORG_DIR/contrib/conda-zsh-completion
compinit conda
zstyle ':completion::complete:*' use-cache 1
Taskwarrior. For Arch Linux, install `community/task`. This also sets the alias `t`.
zstyle ':completion:*:*:task:*' verbose yes
zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:*:task:*' group-name ''
alias t=task
Enable color support of ls and also add handy aliases. MacOS’s `ls` does not accept `–color`.
case `uname` in
Darwin)
# commands for OS X go here
alias ls='gls --color=auto'
alias dir='gdir --color=auto'
alias vdir='gvdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ctags='/usr/local/bin/ctags'
;;
Linux)
# commands for Linux go here
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
;;
FreeBSD)
# commands for FreeBSD go here
;;
esac
Theme settings
POWERLEVEL9K_COLOR_SCHEME='light'
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon context dir vcs anaconda)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)
source $CONFORG_DIR/contrib/powerlevel9k/powerlevel9k.zsh-theme
Some aliases for ls
alias ll='ls -alhF'
alias la='ls -A'
alias l='ls -CF'
Display images in kitty
alias icat='kitty +kitten icat'
Use nvim
for everything
alias vi='nvim'
alias vim='nvim'
Use Bash as the default shell for Emacs, due to compatibility issues for certain
plugins.
Also, use Fcitx
input method (IME) for emacs
alias emacs='SHELL=/bin/bash LC_CTYPE=zh_CN.UTF-8 emacs'
alias ec='emacsclient -n -c'
Force tmux to accept UTF-8
alias tmux='tmux -u'
Other tmux aliases
alias ta='tmux attach -t'
alias tad='tmux attach -d -t'
alias ts='tmux new-session -s'
alias tl='tmux list-sessions'
alias tksv='tmux kill-server'
alias tkss='tmux kill-session -t'
A simple calculator. Alias equal sign
disabled due to incompatibility with
zsh-sytax-highlighting
.
autoload -U zcalc
function __calc_plugin {
zcalc -e "$*"
}
aliases[calc]='noglob __calc_plugin'
# aliases[=]='noglob __calc_plugin'
Solarized dircolors. Choices are:
- dircolors.256dark
- dircolors.ansi-dark
- dircolors.ansi-light
- dircolors.ansi-universal
export DIRCOLORTHEME='dircolors.256dark'
export DIRCOLOR_DIR=$CONFORG_DIR/contrib/dircolors-solarized
case `uname` in
Darwin)
# commands for OS X go here
eval `gdircolors $DIRCOLOR_DIR/${DIRCOLORTHEME:-dircolors.256dark}`
;;
Linux)
# commands for Linux go here
eval `dircolors $DIRCOLOR_DIR/${DIRCOLORTHEME:-dircolors.256dark}`
;;
FreeBSD)
# commands for FreeBSD go here
;;
esac
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
tldr
provides fast cheatsheet style references to command line utilities.
export TLDR_COLOR_NAME="cyan"
export TLDR_COLOR_DESCRIPTION="grey"
export TLDR_COLOR_BLANK="grey"
export TLDR_COLOR_PARAMETER="grey"
export TLDR_CACHE_ENABLED=1
export TLDR_CACHE_MAX_AGE=720
To update cache, run tldr -u
.
fzf
fuzzy completion and keybindings.
source /usr/share/fzf/completion.zsh
source /usr/share/fzf/key-bindings.zsh
Speed up zsh compinit by only checking cache once a day.
On slow systems, checking the cached .zcompdump
file to see if it must be
regenerated adds a noticable delay to zsh startup.
This little hack restricts it to once a day.
Credit of this trick goes to here.
The globbing is a little complicated here:
- ‘#q’ is an explicit glob qualifier that makes globbing work within zsh’s construct.
- ‘N’ makes the glob pattern evaluate to nothing when it doesn’t match (rather than throw a globbing error)
- ’.’ matches “regular files”
- ‘mh+24’ matches files (or directories or whatever) that are older than 24 hours.
for dump in $HOME/.zcompdump(N.mh+24); do
# echo "Updating completion cache.."
compinit
compdump
done
compinit -C
compdef _task t=task
Kitty the terminal emulator of choice. The important thing here is to make sure the call to kitty to load the zsh completions happens after the call to compinit.
if type "kitty" > /dev/null; then
kitty + complete setup zsh | source /dev/stdin
fi
Load syntax highlighting, which can be installed from
community/zsh-syntax-highlighting
.
(It must be at the end of the .zshrc
file).
if [ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
Stop profiling
<<stop-profiling>>
This section contains configurations for zathura
.
- Use
J, K
to zoom. - Use
i
to invert colors. - Use
p
to print.
# DO NOT EDIT
# This file is generated by conf.org from xywei/conforg,
# all changes will be overwritten.
set statusbar-h-padding 0
set statusbar-v-padding 0
set first-page-column 1
set page-padding 1
map K zoom in
map J zoom out
map i recolor
map p print
Put all color configs into Xresources
, so that I can control them with a
simple script for a global, uniform looking system.
(Further, time-dependent colorschemes).