5
file:emacs/literal-programming-emacs-config.org
source link: https://blog.oyanglul.us/emacs/literal-programming-emacs-config.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Literal Programming Emacs Configure Literal Programming Emacs Configure
Table of Contents
Fonts
Download JetBrain Mono font.
(if (member "JetBrains Mono" (font-family-list))
(set-frame-font "JetBrains Mono 14"))
(when (eq system-type 'gnu/linux)
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font) charset
(font-spec :family "Noto Sans CJK SC"))))
(global-prettify-symbols-mode 1)
t
Default Settings
;; Setting
(load-theme 'misterioso t)
(server-start)
(keyboard-translate ?\C-h ?\C-?)
(column-number-mode 1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(menu-bar-mode -1)
(delete-selection-mode 1)
(global-auto-revert-mode 1)
(electric-indent-mode t)
(setq-default
make-backup-files nil
indent-tabs-mode nil)
;; make unix lineendings default
(setq default-buffer-file-coding-system 'utf-8-unix)
(when (eq system-type 'darwin)
(setq mac-option-modifier 'alt)
(setq mac-option-modifier 'super) ; make opt key do Super
(setq mac-command-modifier 'meta))
meta
;;(setenv "PATH" "${HOME}/.nix-profile/bin:/usr/local/bin:/usr/bin:/sbin:/bin")
${HOME}/.nix-profile/bin:/usr/local/bin:/usr/bin:/sbin:/bin
Modes
ace jump mode
You can move your cursor to ANY position ( across window and frame ) in emacs by using only 3 times key press.
(use-package ace-jump-mode
:ensure t
:bind
("C-c SPC" . ace-jump-mode)
("C-c u SPC" . ace-jump-mode-pop-mark)
("C-c l SPC" . ace-jump-line-mode))
ace-jump-line-mode
company
text completion framework
(use-package company
:config
(add-hook 'after-init-hook 'global-company-mode)
)
t
Dhall
(use-package dhall-mode
:ensure t
:config
(setq
;; uncomment the next line to disable automatic format
;; dhall-format-at-save nil
;; comment the next line to use unicode syntax
;; dhall-format-arguments (\` ("--ascii"))
;; header-line is obsoleted by lsp-mode
dhall-use-header-line nil))
expand region
(use-package expand-region
:bind
("C-8" . er/expand-region)
("C--" . er/contract-region))
er/contract-region
forge
;;(use-package forge
;;:after magit)
Haskell
(use-package lsp-haskell
:config
(setq lsp-haskell-server-path "/nix/store/rpji6p4srv56y24mhbqwc4dmgxknd0x2-haskell-language-server-1.1.0.0/bin/haskell-language-server-wrapper")
(setq haskell-stylish-on-save t)
:hook
(haskell-mode . lsp))
lsp |
(use-package helm
:ensure t
:bind
("M-x" . helm-M-x)
("C-x b" . helm-mini)
("M-y" . helm-show-kill-ring)
:bind (:map helm-map
("<tab>" . helm-execute-persistent-action) ; rebind tab to run persistent action
("C-i" . helm-execute-persistent-action) ; make TAB works in terminal
("C-z" . helm-select-action))
:config
(helm-autoresize-mode 1)
(setq
helm-M-x-fuzzy-match t
helm-buffers-fuzzy-matching t
helm-recentf-fuzzy-match t
helm-ag-fuzzy-match t ;(ref: ag-fuzzy-match)
helm-locate-fuzzy-match t
)
)
(use-package helm-swoop
:ensure t
:bind (("M-m" . helm-multi-swoop-projectile)
("M-M" . helm-swoop-back-to-last-point))
:init
(bind-key "M-m" 'helm-swoop-from-isearch isearch-mode-map))
(use-package projectile
:ensure t
:bind-keymap
("C-c p" . projectile-command-map)
:config
(projectile-global-mode)
(setq projectile-indexing-method 'alien
projectile-enable-caching t
projectile-completion-system 'helm))
(use-package helm-projectile
:ensure t
:config
(helm-projectile-on)
)
(use-package ido
:bind
:config
(setq ido-everywhere t
ido-enable-flex-matching t)
(ido-mode 1))
ido-find-file
indent guide
(use-package indent-guide
:hook (prog-mode . indent-guide-mode))
indent-guide-mode | rainbow-delimiters-mode | (lambda nil (flyspell-prog-mode) (setq company-backends (delete 'company-ispell company-backends)) (message company-ispell disable)) |
key chord
(use-package key-chord
:config
(key-chord-mode 1)
(setq key-chord-two-keys-delay 0.03)
(key-chord-define-global "vr" 'vr/replace)
(key-chord-define-global "ln" 'display-line-numbers-mode)
(key-chord-define-global ",." "<>\C-b")
(key-chord-define-global " u" 'capitalize-word)
)
t
Langtool
Install LanguageTool version 3.0 or later (and java) https://languagetool.org/
extract them into /usr/local/share/LanguageTool
(use-package langtool
:config
(setq langtool-language-tool-jar "/usr/local/share/LanguageTool/languagetool-commandline.jar"
langtool-disabled-rules '("WHITESPACE_RULE"
"EN_UNPAIRED_BRACKETS"
"COMMA_PARENTHESIS_WHITESPACE"
"EN_QUOTES")
langtool-default-language "en-US")
)
t
magit
(use-package magit
:bind
("C-x g" . magit-status))
magit-status
multi cursor
(use-package multiple-cursors
:bind
("C-<" . mc/mark-previous-like-this)
("C->" . mc/mark-next-like-this)
("C-*" . mc/mark-all-like-this))
mc/mark-all-like-this
Nya mode
(use-package nyan-mode
:ensure t
:config (nyan-mode t))
on screen
(use-package on-screen
:ensure t
:config
(on-screen-global-mode 1)
(setq on-screen-highlight-method 'narrow-line))
narrow-line
org mode
(when (cl-search "27." (emacs-version))
(require 'org-tempo))
(setq org-startup-folded 'content)
(setq org-startup-indented nil)
(setq org-startup-with-inline-images t)
(setq org-startup-truncated nil)
(setq org-src-tab-acts-natively t)
(setq js-indent-level 2)
2
(use-package org-crypt
:config
(org-crypt-use-before-save-magic)
(setq org-crypt-key "A506C38D5CC847D0DF01134ADA8B833B52604E63")
(setq org-tags-exclude-from-inheritance '("crypt"))
)
t
(setq org-agenda-files (quote ("~/Dropbox/org")))
(setq org-refile-targets (quote ((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9))))
(setq org-directory "~/Dropbox/org")
(setq org-default-notes-file "~/Dropbox/org/refile.org")
;; I use C-c c to start capture mode
(global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-c a") 'org-agenda)
;; Capture templates for: TODO tasks, Notes, appointments, phone calls, meetings, and org-protocol
(setq org-capture-templates
(quote (("t" "Todo" entry (file+headline "~/Dropbox/org/refile.org" "Todos")
"* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
("n" "Note" entry (file+headline "~/Dropbox/org/note.org" "Notes")
"* %?\n%U\n%a\n" :clock-in t :clock-resume t)
("w" "Work" entry (file+headline "~/Dropbox/org/myob.org" "Work Notes")
"* %?\n%U\n" :clock-in t :clock-resume t)
)))
(setq org-refile-use-outline-path t)
; Targets complete directly with IDO
(setq org-outline-path-complete-in-steps nil)
; Use IDO for both buffer and file completion and ido-everywhere to t
(setq org-completion-use-ido t)
(setq ido-everywhere t)
(setq ido-max-directory-size 100000)
(ido-mode (quote both))
; Use the current window when visiting files and buffers with ido
(setq ido-default-file-method 'selected-window)
(setq ido-default-buffer-method 'selected-window)
; Use the current window for indirect buffer display
(setq org-indirect-buffer-display 'current-window)
current-window
prompt
(defalias 'yes-or-no-p 'y-or-n-p)
(setq kill-buffer-query-functions
(remq 'process-kill-buffer-query-function
kill-buffer-query-functions))
PureScript
(use-package psc-ide
:init
(setq psc-ide-use-npm-bin t)
:config
(add-hook 'purescript-mode-hook
(lambda ()
(psc-ide-mode)
(company-mode)
(flycheck-mode)
(turn-on-purescript-indentation)))
)
rainbow delimiter
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode))
rainbow-delimiters-mode | (lambda nil (flyspell-prog-mode) (setq company-backends (delete 'company-ispell company-backends)) (message company-ispell disable)) |
Restclient
(use-package restclient
:config
(add-to-list 'company-backends 'company-restclient))
;; :config
;; ;
;
;; :hook (company-mode))
Scala Metals
;; Enable scala-mode for highlighting, indentation and motion commands
(use-package scala-mode
:mode "\\.s\\(cala\\|bt\\)$"
)
;; Enable sbt mode for executing sbt commands
(use-package sbt-mode
:commands sbt-start sbt-command
:config
;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31
;; allows using SPACE when in the minibuffer
(substitute-key-definition
'minibuffer-complete-word
'self-insert-command
minibuffer-local-completion-map)
;; sbt-supershell kills sbt-mode: https://github.com/hvesalai/emacs-sbt-mode/issues/152
(setq sbt:program-options '("-Dsbt.supershell=false"))
)
(use-package lsp-mode
;; Optional - enable lsp-mode automatically in scala files
:hook (scala-mode . lsp)
(lsp-mode . lsp-lens-mode)
(dhall-mode . lsp)
(haskell-mode . lsp)
:config (setq lsp-prefer-flymake nil))
;; Add metals backend for lsp-mode
(use-package lsp-metals)
;; Enable nice rendering of documentation on hover
(use-package lsp-ui)
shell-mode
(setq comint-output-filter-functions
(remove 'ansi-color-process-output comint-output-filter-functions))
(add-hook 'shell-mode-hook
(lambda ()
;; Disable font-locking in this buffer to improve performance
(font-lock-mode -1)
;; Prevent font-locking from being re-enabled in this buffer
(make-local-variable 'font-lock-function)
(setq font-lock-function (lambda (_) nil))
(add-hook 'comint-preoutput-filter-functions 'xterm-color-filter nil t)))
(setenv "TERM" "xterm-256color")
xterm-256color
smartparens
(use-package smartparens
:init
(require 'smartparens-config)
:config
(smartparens-global-mode t)
(show-smartparens-global-mode t))
textmate
(use-package textmate
:init
(textmate-mode)
(bind-keys
:map *textmate-mode-map*
("M--" . text-scale-decrease)
("M-=" . text-scale-increase)
("M-}" . textmate-shift-right)
("M-<backspace>" . kill-whole-line)
("M-c" . kill-ring-save)
("M-{" . textmate-shift-left)
("M-/" . comment-line)
("M-l" . textmate-select-line)
))
textmate-select-line
unicode
(use-package unicode-fonts
:config
(unicode-fonts-setup))
t
web-mode
(use-package web-mode
:mode "\\.html$'" "\\.jsx$" "\\.tsx$"
:init
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)
)
which key
(use-package which-key
:config
(which-key-mode)
(setq which-key-use-C-h-commands t)
(setq which-key-paging-key "<f5>")
)
t
yasnippet
(use-package yasnippet
:config
(yas-global-mode 1))
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK