Watch
1
0
Fork
You've already forked dotfiles
0

Emacs (and Vim) config

This commit is contained in:
asnev 2026-11-17 16:40:27 +07:00
commit 4bda4263c6
Signed by: asnev
SSH key fingerprint: SHA256:8hagYq9hDUuS5clQ78FKhIoQDvg5crdkYMHX+3g7wB4
9 changed files with 6011 additions and 47 deletions

View file

@ -1,14 +1,5 @@
;;; -*- lexical-binding: t -*- ;;; -*- lexical-binding: t -*-
;;; ________ _______ __ __ ;;; Emacs Bedrock (early-init.el)
;;; / | / \ / | / |
;;; $$$$$$$$/ _____ ____ ______ _______ _______ $$$$$$$ | ______ ____$$ | ______ ______ _______$$ | __
;;; $$ |__ / \/ \ / \ / |/ | $$ |__$$ |/ \ / $$ |/ \ / \ / $$ | / |
;;; $$ | $$$$$$ $$$$ |$$$$$$ /$$$$$$$//$$$$$$$/ $$ $$</$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$/$$ |_/$$/
;;; $$$$$/ $$ | $$ | $$ |/ $$ $$ | $$ \ $$$$$$$ $$ $$ $$ | $$ $$ | $$/$$ | $$ $$ | $$ $$<
;;; $$ |_____$$ | $$ | $$ /$$$$$$$ $$ \_____ $$$$$$ | $$ |__$$ $$$$$$$$/$$ \__$$ $$ | $$ \__$$ $$ \_____$$$$$$ \
;;; $$ $$ | $$ | $$ $$ $$ $$ / $$/ $$ $$/$$ $$ $$ $$ | $$ $$/$$ $$ | $$ |
;;; $$$$$$$$/$$/ $$/ $$/ $$$$$$$/ $$$$$$$/$$$$$$$/ $$$$$$$/ $$$$$$$/ $$$$$$$/$$/ $$$$$$/ $$$$$$$/$$/ $$/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
@ -32,8 +23,8 @@
;; Setting *-resize-pixelwise to `t' lets frames/windows resize ;; Setting *-resize-pixelwise to `t' lets frames/windows resize
;; smoothly at sub-character increments ;; smoothly at sub-character increments
(setq frame-resize-pixelwise t) ;(setq frame-resize-pixelwise t)
; (setq window-resize-pixelwise t) ;(setq window-resize-pixelwise t)
(when (fboundp 'tool-bar-mode) ; When in a GUI, disable tool bar; (when (fboundp 'tool-bar-mode) ; When in a GUI, disable tool bar;
(tool-bar-mode -1)) ; all these tools are in the menu-bar anyway (tool-bar-mode -1)) ; all these tools are in the menu-bar anyway

5
emacs/.emacs.d/history Normal file
View file

@ -0,0 +1,5 @@
;; -*- mode: emacs-lisp; lexical-binding: t; coding: utf-8-emacs-unix -*-
;; Minibuffer history file, automatically generated by ‘savehist’.
(setq savehist-minibuffer-history-variables '(extended-command-history file-name-history))
(setq file-name-history '("~/dotfiles/emacs/.emacs.d/init.el" "~/dotfiles/emacs/.emacs.d/early-init.el" "~/dotfiles/emacs/.emacs.d/init.el"))

View file

@ -1,18 +1,5 @@
;;; -*- lexical-binding: t -*- ;;; -*- lexical-binding: t -*-
;;; ________ _______ __ __ ;;; Emacs Bedrock (init.el)
;;; / | / \ / | / |
;;; $$$$$$$$/ _____ ____ ______ _______ _______ $$$$$$$ | ______ ____$$ | ______ ______ _______$$ | __
;;; $$ |__ / \/ \ / \ / |/ | $$ |__$$ |/ \ / $$ |/ \ / \ / $$ | / |
;;; $$ | $$$$$$ $$$$ |$$$$$$ /$$$$$$$//$$$$$$$/ $$ $$</$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$/$$ |_/$$/
;;; $$$$$/ $$ | $$ | $$ |/ $$ $$ | $$ \ $$$$$$$ $$ $$ $$ | $$ $$ | $$/$$ | $$ $$ | $$ $$<
;;; $$ |_____$$ | $$ | $$ /$$$$$$$ $$ \_____ $$$$$$ | $$ |__$$ $$$$$$$$/$$ \__$$ $$ | $$ \__$$ $$ \_____$$$$$$ \
;;; $$ $$ | $$ | $$ $$ $$ $$ / $$/ $$ $$/$$ $$ $$ $$ | $$ $$/$$ $$ | $$ |
;;; $$$$$$$$/$$/ $$/ $$/ $$$$$$$/ $$$$$$$/$$$$$$$/ $$$$$$$/ $$$$$$$/ $$$$$$$/$$/ $$$$$$/ $$$$$$$/$$/ $$/
;;; Minimal init.el
;;; Contents:
;;;
;;; - Basic settings ;;; - Basic settings
;;; - Discovery aids ;;; - Discovery aids
;;; - Minibuffer/completion/searching settings ;;; - Minibuffer/completion/searching settings
@ -46,7 +33,7 @@
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t))
;; If you want to turn off the welcome screen, uncomment this ;; If you want to turn off the welcome screen, uncomment this
;(setopt inhibit-splash-screen t) (setopt inhibit-splash-screen t)
(setopt initial-major-mode 'fundamental-mode) ; default mode for the *scratch* buffer (setopt initial-major-mode 'fundamental-mode) ; default mode for the *scratch* buffer
(setopt display-time-default-load-average nil) ; this information is useless for most (setopt display-time-default-load-average nil) ; this information is useless for most
@ -319,7 +306,7 @@ If the new path's directories does not exist, create them."
(use-package emacs (use-package emacs
:config :config
(load-theme 'modus-vivendi)) ; for light theme, use modus-operandi (load-theme 'modus-vivendi-tinted)) ; for light theme, use modus-operandi
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
@ -376,7 +363,7 @@ If the new path's directories does not exist, create them."
;; This sets the default font for Emacs. Height is in 1/10 pt; configure as desired. ;; This sets the default font for Emacs. Height is in 1/10 pt; configure as desired.
;; The example font listed here, Iosevka Output, is available here: https://codeberg.org/ashton314/iosevka-output ;; The example font listed here, Iosevka Output, is available here: https://codeberg.org/ashton314/iosevka-output
;; '(default ((t (:weight normal :height 130 :width expanded :family "Iosevka Output")))) '(default ((t (:weight normal :height 80 :width expanded :family "Iosevka Nerd Font Mono"))))
) )
(setq gc-cons-threshold (or bedrock--initial-gc-threshold 800000)) (setq gc-cons-threshold (or bedrock--initial-gc-threshold 800000))

View file

@ -0,0 +1,12 @@
## Here is an example for Common-Lisp.
## Adapted from http://cl-cad.blogspot.com
## (litetabs@gmail.com)
syntax "lisp" "\.lisp$" "asd" "\.l$"
color green "\<(defun|with-open-stream|format|setf|apply|and|car|caar|cadr|cdar|cddr|cdr|close|cond|cons|count|do|eql|equal|eval|if|let*|let|list|load|make-package|mapcar|mapc|not|null|numberp|open|or|pprint|prin1|princ|print|provide|read|require|setq|slot-value|sort|stringp|terpri|write|case|progn|when|loop|unless|with-output-to-string|labels|return-from|handler-case|eval-when|declare|with-open-file|multiple-value-bind|with-standard-io-syntax|getf|remove-if-not|dolist|consp)\>"
color red "\<(error|else|for|in-package|defpackage|defsystem|lambda)\>"
color cyan "\<(defclass|defstruct|defvar|defconstant|defmethod|defgeneric|defparameter|defmacro)\>"
color brightred "\<(t|nil)\>"
icolor yellow "\:\{?[0-9A-Z_!@#$*?-]+\}?"
color brightgreen ""(\\.|[^"])*""
icolor blue "\*\{?[0-9A-Z_!@#$*?-]+\}?"
color cyan "(^|[[:space:]]);.*$"

View file

@ -28,16 +28,14 @@ bind ^S whereis main
bind Sh-M-F findnext main bind Sh-M-F findnext main
bind Sh-M-B findprevious main bind Sh-M-B findprevious main
# search keybinds: file browser
unbind ^S browser
bind ^S whereis browser
bind Sh-M-F findnext browser
bind Sh-M-B findprevious browser
# text copying (killing) from editor # text copying (killing) from editor
unbind M-K main unbind M-K main
bind M-K copy main bind M-K copy main
bind Sh-M-K cutfromcursor main
# yanking (actually pasting)
unbind ^Y main
unbind ^U main
bind ^Y paste main
# copy from editor into system (Wayland) clipboard # copy from editor into system (Wayland) clipboard
bind Sh-M-C "{execute}| wl-copy > /dev/null 2>&1 {enter}{exit}n" main bind Sh-M-C "{execute}| wl-copy > /dev/null 2>&1 {enter}{exit}n" main
@ -54,8 +52,6 @@ unbind M-A main
unbind M-E main unbind M-E main
bind M-A beginpara main bind M-A beginpara main
bind M-E endpara main bind M-E endpara main
bind M-( beginpara main
bind M-) endpara main
# text marking keybind # text marking keybind
bind ^Space mark main bind ^Space mark main
@ -64,7 +60,12 @@ bind ^Space mark main
unbind ^L main unbind ^L main
bind ^L cycle main bind ^L cycle main
# editor cursor navigation by word boundaries (a la Emacs) # page up/down
unbind M-V main
bind M-V pageup main
bind Sh-M-V verbatim main
# editor cursor navigation by word boundaries
bind M-F nextword main bind M-F nextword main
bind M-B prevword main bind M-B prevword main

View file

@ -0,0 +1,88 @@
if !get(g:, 'lisp_rainbow', 0)
finish
endif
let s:cpo_save = &cpo
set cpo&vim
let s:levels = 10
let s:fams = ['C', 'Q', 'QQ', 'QS', 'QQS', 'U']
let s:all = []
for s:f in s:fams
for s:i in range(s:levels)
call add(s:all, 'schemeRb' . s:f . s:i)
endfor
endfor
syn clear schemeForm
exe 'syn cluster schemeSyntaxCluster add=' . join(s:all, ',')
let s:members = [ 'schemeFunction',
\ 'schemeKeyword',
\ 'schemeSyntax',
\ 'schemeExtraSyntax',
\ 'schemeLibrarySyntax',
\ 'schemeSyntaxSyntax' ]
let s:code = { 'allow': ['C', 'QS', 'QQS'],
\ 'base' : ['schemeUnquote', 'schemeDatumCommentForm', '@schemeImportCluster'] }
let s:quote = { 'allow': ['Q', 'QS'],
\ 'base' : ['schemeQuasiquote', 'schemeQuasiquoteForm', 'schemeUnquote', 'schemeForm', 'schemeDatumCommentForm', 'schemeImport', '@schemeImportCluster'] + s:members }
let s:quasi = { 'allow': ['QQ', 'QQS', 'U'],
\ 'base' : ['schemeQuote', 'schemeQuoteForm', 'schemeForm', 'schemeDatumCommentForm', 'schemeImport', '@schemeImportCluster'] + s:members }
let s:paren = [['(', ')'], ["\\[", "\\]"]]
let s:qopen = [["'['`]*#\\?(", ')']]
let s:qqopen = [["`['`]*#\\?(", ')']]
let s:unq = [[',@\?(', ')']]
let s:spec = { 'C': [s:code, s:paren, 1],
\ 'U': [s:code, s:unq, 0],
\ 'Q': [s:quote, s:paren, 0],
\ 'QS': [s:quote, s:qopen, 1],
\ 'QQ': [s:quasi, s:paren, 0],
\ 'QQS': [s:quasi, s:qqopen, 1] }
for s:f in s:fams
let [s:ctx, s:pairs, s:top] = s:spec[s:f]
for s:i in range(s:levels)
let s:next = (s:i + 1) % s:levels
let s:allow = map(copy(s:ctx.allow), '"schemeRb" . v:val . s:next')
let s:excl = filter(copy(s:all), 'index(s:allow, v:val) < 0')
let s:contains = 'contains=ALLBUT,' . join(s:ctx.base + s:excl, ',')
let s:opt = (s:i == 0 && s:top) ? '' : 'contained '
for s:p in s:pairs
exe 'syn region schemeRb' . s:f . s:i 'matchgroup=hlLevel' . s:i
\ 'start=/' . s:p[0] . '/ end=/' . s:p[1] . '/' s:opt . s:contains
endfor
endfor
endfor
if &bg == "dark"
hi def hlLevel0 ctermfg=red guifg=red1
hi def hlLevel1 ctermfg=yellow guifg=orange1
hi def hlLevel2 ctermfg=green guifg=yellow1
hi def hlLevel3 ctermfg=cyan guifg=greenyellow
hi def hlLevel4 ctermfg=magenta guifg=green1
hi def hlLevel5 ctermfg=red guifg=springgreen1
hi def hlLevel6 ctermfg=yellow guifg=cyan1
hi def hlLevel7 ctermfg=green guifg=slateblue1
hi def hlLevel8 ctermfg=cyan guifg=magenta1
hi def hlLevel9 ctermfg=magenta guifg=purple1
else
hi def hlLevel0 ctermfg=red guifg=red3
hi def hlLevel1 ctermfg=darkyellow guifg=orangered3
hi def hlLevel2 ctermfg=darkgreen guifg=orange2
hi def hlLevel3 ctermfg=blue guifg=yellow3
hi def hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
hi def hlLevel5 ctermfg=red guifg=green4
hi def hlLevel6 ctermfg=darkyellow guifg=paleturquoise3
hi def hlLevel7 ctermfg=darkgreen guifg=deepskyblue4
hi def hlLevel8 ctermfg=blue guifg=darkslateblue
hi def hlLevel9 ctermfg=darkmagenta guifg=darkviolet
endif
let &cpo = s:cpo_save
unlet s:cpo_save

2914
vim/.vim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

51
vim/.vimrc Normal file
View file

@ -0,0 +1,51 @@
" This `.vimrc' is written for configuring `vim-classic', an LTS release of
" Vim 8. YMMV if using a newer release of Vim.
" options
set background=dark
set cursorline
set expandtab
set hidden
set hlsearch
set ignorecase
set laststatus=2
set listchars=eol:$,tab:»\ ,trail:~,extends:>,precedes:<,space:·
set mouse=a
set number
set relativenumber
set shiftwidth=4
set sj=-50 " jumpy scrolling (like Emacs)
set smartcase
set tabstop=4
set termguicolors
set nocopyindent
set noswapfile
set noundofile
" vim-plug
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-commentary'
Plug 'ThunderBoltCODMYT/gruber-darker.vim'
let g:gruber_contrast = 'soft'
Plug 'LnL7/vim-nix'
call plug#end()
" rainbow s-expressions + fix
augroup fix_lisp_rainbow
autocmd!
autocmd ColorScheme * let g:lisp_rainbow = 1
augroup END
" colorscheme
colorscheme gruber-darker
" set leader key to space
nnoremap <SPACE> <Nop>
let mapleader = " "
" copy to system clipboard (Wayland)
vnoremap <leader>y :w !wl-copy<CR><CR>
nnoremap <leader>p :r !wl-paste<CR>