Created
May 17, 2022 19:55
-
-
Save akaszynski/595c346ac4e192a31736da487a5da8e7 to your computer and use it in GitHub Desktop.
My emacs init file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'package);; init.el --- Emacs configuration | |
;; INSTALL PACKAGES | |
;; -------------------------------------- | |
;; (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t) | |
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) | |
;; (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) | |
(package-initialize) | |
(when (not package-archive-contents) | |
(package-refresh-contents)) | |
;; https://stackoverflow.com/a/60638601/850781 | |
;; (custom-set-variables | |
;; '(gnutls-algorithm-priority "normal:-vers-tls1.3")) | |
(setq package-check-signature nil) | |
(defvar myPackages | |
'(better-defaults | |
;; Python env | |
elpy | |
flycheck | |
jedi | |
cython-mode | |
magit | |
material-theme | |
;; LaTeX | |
;; latex-preview-pane | |
;; flycheck-cython | |
;; C/C++ | |
;; company | |
;; company-irony | |
;; irony | |
;; flycheck-irony | |
;; zygospore | |
;; ;; helm-gtags | |
;; ;; helm | |
;; yasnippet | |
;; ws-butler | |
;; volatile-highlights | |
use-package | |
;; undo-tree | |
;; iedit | |
;; dtrt-indent | |
;; counsel-projectile | |
;; clean-aindent-mode | |
;; anzu | |
;; misc | |
markdown-mode | |
;; emacs as an OS | |
desktop-environment | |
;; exwm | |
)) | |
(mapc #'(lambda (package) | |
(unless (package-installed-p package) | |
(package-install package))) | |
myPackages) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; General settings | |
;; | |
;; Confirm on exit | |
(setq confirm-kill-emacs #'y-or-n-p) | |
;; backup in one place. flat, no tree structure | |
(setq backup-directory-alist '(("" . "~/.emacs.d/backup"))) | |
(setq-default indent-tabs-mode nil) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; enable desktop enviornment (binds brightness and sound keys) | |
(require 'desktop-environment) | |
(desktop-environment-mode) | |
(setq desktop-environment-brightness-get-command "light") | |
(setq desktop-environment-brightness-set-command "light %s") | |
(setq desktop-environment-brightness-get-regexp "^\\([0-9]+\\)") | |
(setq desktop-environment-brightness-normal-increment "-A 10") | |
(setq desktop-environment-brightness-normal-decrement "-U 10") | |
(setq desktop-environment-brightness-small-increment "-A 5") | |
(setq desktop-environment-brightness-small-decrement "-U 5") | |
(setq desktop-environment-volume-set-command "amixer -D pulse sset Master %s") | |
(setq desktop-environment-volume-get-command "amixer -D pulse") | |
(setq desktop-environment-volume-normal-increment "5%+") | |
(setq desktop-environment-volume-normal-decrement "5%-") | |
(setq desktop-environment-volume-toggle-command "amixer -D pulse set Master toggle") | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; ggtags | |
;; see: https://askubuntu.com/questions/839852/emacs-c-ide-gnu-global-helm-gtags | |
(setq ggtags-use-idutils t) | |
(setq ggtags-use-project-gtagsconf nil) | |
(add-hook 'c-mode-common-hook | |
(lambda () | |
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode) | |
(ggtags-mode 1)))) | |
;; (setq ggtags-global-mode 1) | |
; Allow very large database files | |
;; (setq ggtags-oversize-limit 104857600) | |
;; (setq ggtags-sort-by-nearness t) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; C/C++ irony ;;; | |
(add-hook 'c++-mode-hook 'irony-mode) | |
(add-hook 'c-mode-hook 'irony-mode) | |
(add-hook 'objc-mode-hook 'irony-mode) | |
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options) | |
;; (eval-after-load 'company | |
;; '(add-to-list 'company-backends 'company-irony)) | |
;; (eval-after-load 'flycheck | |
;; '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; BASIC CUSTOMIZATION | |
;; ------------------- | |
(setq inhibit-startup-message t) ;; hide the startup message | |
(load-theme 'material t) ;; load material theme | |
(global-linum-mode t) ;; enable line numbers | |
;; disable toolbar and menu | |
(tool-bar-mode -1) | |
(menu-bar-mode -1) | |
(toggle-scroll-bar -1) | |
;; disable flashing | |
(setq visible-bell nil | |
ring-bell-function #'ignore) | |
;; 4k scaling (need to make this optional based on resolution) | |
;; (set-face-attribute 'default nil :height 160) ;; for 80 char | |
(set-face-attribute 'default nil :height 130) ;; for 100 char | |
;; (if (string= system-name "voyager") | |
;; (set-face-attribute 'default nil :height 150) | |
;; (add-to-list 'default-frame-alist '(font . "-DAMA-Ubuntu Mono-normal-normal-normal-*-22-22-75-75-m-0-iso10646-1" )) | |
;; ) | |
;; disable line numbers | |
(global-linum-mode 0) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; latex ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; word count function | |
(defun latex-word-count () | |
(interactive) | |
(shell-command (concat "texcount " | |
"-unicode " | |
"-inc " | |
(shell-quote-argument buffer-file-name))) | |
) | |
;; enable spellchecking | |
(add-hook 'latex-mode-hook 'flyspell-mode) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; elpy ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(elpy-enable) | |
(setq elpy-rpc-python-command "/usr/bin/python3.8") | |
(setq elpy-rpc-backend "jedi") | |
(setq elpy-rpc-ignored-buffer-size 640000) | |
(setq elpy-rpc-python-command "/home/alex/python/py38/bin/python") | |
;; https://github.com/jorgenschaefer/elpy/issues/1381 | |
(setq elpy-eldoc-show-current-function nil) | |
(when (require 'flycheck nil t) | |
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules)) | |
(add-hook 'elpy-mode-hook 'flycheck-mode)) | |
(global-flycheck-mode) | |
;; flycheck | |
(custom-set-variables | |
;; custom-set-variables was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(ansi-color-faces-vector | |
[default bold shadow italic underline bold bold-italic bold]) | |
'(ansi-color-names-vector | |
(vector "#ffffff" "#f36c60" "#8bc34a" "#fff59d" "#4dd0e1" "#b39ddb" "#81d4fa" "#263238")) | |
'(auth-source-save-behavior nil) | |
'(custom-enabled-themes (quote (material))) | |
'(custom-safe-themes | |
(quote | |
("90a6f96a4665a6a56e36dec873a15cbedf761c51ec08dd993d6604e32dd45940" "f149d9986497e8877e0bd1981d1bef8c8a6d35be7d82cba193ad7e46f0989f6a" "7922b14d8971cce37ddb5e487dbc18da5444c47f766178e5a4e72f90437c0711" "89885317e7136d4e86fb842605d47d8329320f0326b62efa236e63ed4be23c58" "d4f8fcc20d4b44bf5796196dbeabec42078c2ddb16dcb6ec145a1c610e0842f3" "afd761c9b0f52ac19764b99d7a4d871fc329f7392dfc6cd29710e8209c691477" "a24c5b3c12d147da6cef80938dca1223b7c7f70f2f382b26308eba014dc4833a" "732b807b0543855541743429c9979ebfb363e27ec91e82f463c91e68c772f6e3" "98cc377af705c0f2133bb6d340bf0becd08944a588804ee655809da5d8140de6" "5dc0ae2d193460de979a463b907b4b2c6d2c9c4657b2e9e66b8898d2592e3de5" default))) | |
'(display-battery-mode t) | |
'(fci-rule-color "#37474f") | |
'(flycheck-python-flake8-executable "python3") | |
'(flycheck-python-pycompile-executable "python3") | |
'(flymake-gui-warnings-enabled nil) | |
'(hl-sexp-background-color "#1c1f26") | |
'(package-selected-packages | |
(quote | |
(elpy markdown-mode desktop-environment flycheck-irony company-irony zygospore helm-gtags helm yasnippet ws-butler volatile-highlights use-package undo-tree iedit dtrt-indent counsel-projectile company clean-aindent-mode anzu))) | |
'(vc-annotate-background nil) | |
'(vc-annotate-color-map | |
(quote | |
((20 . "#f36c60") | |
(40 . "#ff9800") | |
(60 . "#fff59d") | |
(80 . "#8bc34a") | |
(100 . "#81d4fa") | |
(120 . "#4dd0e1") | |
(140 . "#b39ddb") | |
(160 . "#f36c60") | |
(180 . "#ff9800") | |
(200 . "#fff59d") | |
(220 . "#8bc34a") | |
(240 . "#81d4fa") | |
(260 . "#4dd0e1") | |
(280 . "#b39ddb") | |
(300 . "#f36c60") | |
(320 . "#ff9800") | |
(340 . "#fff59d") | |
(360 . "#8bc34a")))) | |
'(vc-annotate-very-old-color nil)) | |
(add-hook 'flycheck-mode-hook #'my-keep-flycheck-off) | |
(defun my-keep-flycheck-off () | |
(when (and (eq major-mode 'rst-mode) | |
(buffer-file-name) | |
(string= (file-name-extension (buffer-file-name)) "rst")) | |
(flycheck-mode -1))) | |
(setq elpy-rpc-virtualenv-path "/home/alex/python/py38/") | |
(setq python-shell-interpreter "/home/alex/python/py38/bin/ipython" | |
python-shell-interpreter-args "--simple-prompt -i" | |
) | |
(setq python-python-command "/usr/bin/python3.8") | |
;; for running python 2 | |
;; (setq python-shell-interpreter "ipython2") | |
;; (setq python-python-command "/usr/bin/python2") | |
;; for flycheck | |
(setq-default flycheck-flake8-maximum-line-length 99) | |
;; for jedi | |
;; (add-hook 'python-mode-hook 'jedi:setup) | |
(setq jedi:complete-on-dot t) ; optional | |
;; windows setup on startup | |
;; (split-window-horizontally) | |
;; https://emacs.stackexchange.com/questions/13989/inferior-python-shell-slow-crash-on-long-lines | |
(setq python-shell-enable-font-lock nil) | |
;;;;;;;;;;;;;;;;;;;;; Useful keyboard commands ;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; comment lines | |
(defun comment-or-uncomment-region-or-line () | |
"Comments or uncomments the region or the current line if there's no active region." | |
(interactive) | |
(let (beg end) | |
(if (region-active-p) | |
(setq beg (region-beginning) end (region-end)) | |
(setq beg (line-beginning-position) end (line-end-position))) | |
(comment-or-uncomment-region beg end))) | |
(global-set-key (kbd "C-x C-;") 'comment-or-uncomment-region-or-line) | |
;; duplicate a line | |
;; (defun duplicate-line() | |
;; (interactive) | |
;; (move-beginning-of-line 1) | |
;; (kill-line) | |
;; (yank) | |
;; (open-line 1) | |
;; (next-line 1) | |
;; (yank) | |
;; ) | |
;; (global-set-key (kbd "C-i") 'duplicate-line) | |
;; python send region | |
(defun python-shell-send-region-or-line nil | |
"Sends from python-mode buffer to a python shell, intelligently." | |
(interactive) | |
(cond ((region-active-p) | |
(setq deactivate-mark t) | |
(python-shell-send-region (region-beginning) (region-end)) | |
(python-nav-forward-statement) | |
) (t (elpy-shell-send-statement)))) | |
(eval-after-load 'python | |
'(define-key python-mode-map (kbd "C-;") 'python-shell-send-region-or-line)) | |
(defun sh-send-line-or-region (&optional step) | |
(interactive ()) | |
(let ((proc (get-process "shell")) | |
pbuf min max command) | |
(unless proc | |
(let ((currbuff (current-buffer))) | |
(shell) | |
(switch-to-buffer currbuff) | |
(setq proc (get-process "shell")) | |
)) | |
(setq pbuff (process-buffer proc)) | |
(if (use-region-p) | |
(setq min (region-beginning) | |
max (region-end)) | |
(setq min (point-at-bol) | |
max (point-at-eol))) | |
(setq command (concat (buffer-substring min max) "\n")) | |
(with-current-buffer pbuff | |
(goto-char (process-mark proc)) | |
(insert command) | |
(move-marker (process-mark proc) (point)) | |
) ;;pop-to-buffer does not work with save-current-buffer -- bug? | |
(process-send-string proc command) | |
(display-buffer (process-buffer proc) t) | |
(when step | |
(goto-char max) | |
(next-line)) | |
(setq comint-scroll-to-bottom-on-output t) | |
)) | |
(defun sh-send-line-or-region-and-step () | |
(interactive) | |
(sh-send-line-or-region t)) | |
(defun sh-switch-to-process-buffer () | |
(interactive) | |
(pop-to-buffer (process-buffer (get-process "shell")) t)) | |
;; (eval-after-load 'ansys-mode | |
;; '(define-key ansys-mode-map (kbd "C-;") 'sh-send-line-or-region-and-step)) | |
;; kill up to, but not including ARGth occurrence of CHAR. | |
(autoload 'zap-up-to-char "misc" | |
"Kill up to, but not including ARGth occurrence of CHAR. | |
\(fn arg char)" | |
'interactive) | |
(global-set-key "\M-z" 'zap-up-to-char) | |
(custom-set-faces | |
;; custom-set-faces was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
) | |
;; for running ANSYS | |
;; (add-to-list 'load-path "/home/alex/.emacs.d/ansys/") | |
;; .mac is the macro suffix of ANSYS i. e. these macros can be called | |
;; in the ANSYS command prompt like a regular ANSYS function (without | |
;; the suffix .mac) | |
;; (add-to-list 'auto-mode-alist '("\\.mac\\'" . ansys-mode)) | |
;; .dat and .inp are WorkBench's solver input file suffixes | |
;; (add-to-list 'auto-mode-alist '("\\.dat\\'" . ansys-mode)) | |
;; (add-to-list 'auto-mode-alist '("\\.inp\\'" . ansys-mode)) | |
;; .anf is the suffix for "ANSYS Neutral" files which include mostly | |
;; gometric data but also some APDL snippets. | |
;; (add-to-list 'auto-mode-alist '("\\.anf$" . ansys-mode)) | |
;; (autoload 'ansys-mode "ansys-mode" nil t) | |
;; (put 'erase-buffer 'disabled nil) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; mu4e | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu/mu4e") | |
;; (require 'mu4e) | |
;; ;; (require 'mu4e) | |
;; (setq mu4e-maildir "/home/alex/mbsync") | |
;; (setq max-specpdl-size 5000) | |
;; ;; use mu4e for e-mail in emacs | |
;; (setq mail-user-agent 'mu4e-user-agent) | |
;; ;; don't save messages to Sent Messages, Gmail/IMAP takes care of this | |
;; (setq mu4e-sent-messages-behavior 'delete) | |
;; ;; tell message-mode how to send mail | |
;; (setq message-send-mail-function 'smtpmail-send-it) | |
;; (setq mu4e-sent-folder "/home/alex/Maildir/sent" | |
;; ;; mu4e-drafts-folder "/[Gmail].Drafts" | |
;; mu4e-trash-folder "/[Gmail].Trash" | |
;; user-mail-address "[email protected]" | |
;; smtpmail-default-smtp-server "smtp.gmail.com" | |
;; smtpmail-smtp-server "smtp.gmail.com" | |
;; smtpmail-smtp-service 587) | |
;; (setq mu4e-user-mail-address-list '("[email protected]")) | |
;; (setq mu4e-compose-dont-reply-to-self t) | |
;; (setq mu4e-attachment-dir "~/Downloads") | |
;; ;; something about ourselves | |
;; (setq | |
;; user-mail-address "[email protected]" | |
;; user-full-name "Alex Kaszynski") | |
;; (defun no-auto-fill () | |
;; "Turn off auto-fill-mode." | |
;; (auto-fill-mode -1)) | |
;; (add-hook 'mu4e-compose-mode-hook #'no-auto-fill) | |
;; (add-hook 'mu4e-compose-mode-hook 'flyspell-mode) | |
;; ;; (setq mu4e-get-mail-command "true") | |
;; (setq mu4e-get-mail-command "mbsync gmail-inbox") | |
;; (setq mu4e-update-interval 600) | |
;; ;; required for mbsync | |
;; (setq mu4e-change-filenames-when-moving t) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; eww | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; eww disable images | |
(defun my/eww-toggle-images () | |
"Toggle whether images are loaded and reload the current page from cache." | |
(interactive) | |
(setq-local shr-inhibit-images (not shr-inhibit-images)) | |
(eww-reload t) | |
(message "Images are now %s" | |
(if shr-inhibit-images "off" "on"))) | |
;; ;; minimal rendering by default | |
(setq-default shr-inhibit-images t) ; toggle with `I` | |
;; (setq-default shr-use-fonts nil) ; toggle with `F` | |
;; Auto-rename new eww buffers | |
(defun xah-rename-eww-hook () | |
"Rename eww browser's buffer so sites open in new page." | |
(rename-buffer "eww" t)) | |
(add-hook 'eww-mode-hook #'xah-rename-eww-hook) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; shell | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defun sh-send-line-or-region (&optional step) | |
(interactive ()) | |
(let ((proc (get-process "shell")) | |
pbuf min max command) | |
(unless proc | |
(let ((currbuff (current-buffer))) | |
(shell) | |
(switch-to-buffer currbuff) | |
(setq proc (get-process "shell")) | |
)) | |
(setq pbuff (process-buffer proc)) | |
(if (use-region-p) | |
(setq min (region-beginning) | |
max (region-end)) | |
(setq min (point-at-bol) | |
max (point-at-eol))) | |
(setq command (concat (buffer-substring min max) "\n")) | |
(with-current-buffer pbuff | |
(goto-char (process-mark proc)) | |
(insert command) | |
(move-marker (process-mark proc) (point)) | |
) ;;pop-to-buffer does not work with save-current-buffer -- bug? | |
(process-send-string proc command) | |
(display-buffer (process-buffer proc) t) | |
(when step | |
(goto-char max) | |
(next-line)) | |
) | |
) | |
(defun sh-send-line-or-region-and-step () | |
(interactive) | |
(sh-send-line-or-region t)) | |
(defun sh-switch-to-process-buffer () | |
(interactive) | |
(pop-to-buffer (process-buffer (get-process "shell")) t)) | |
;; Assigning it to a global. Python will override this | |
(global-set-key (kbd "C-;") 'sh-send-line-or-region-and-step) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; toggle themes between material light and dark | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defcustom default-light-color-theme 'material-light | |
"default light theme") | |
(defcustom default-dark-color-theme 'material | |
"default dark theme") | |
;; (defun toggle-theme () | |
;; (interactive) | |
;; (let ((is-light (find default-light-color-theme custom-enabled-themes))) | |
;; (dolist (theme custom-enabled-themes) | |
;; (disable-theme theme)) | |
;; (load-theme (if is-light default-dark-color-theme default-light-color-theme)))) | |
;; (if window-system | |
;; (progn | |
;; (global-set-key (kbd "<f11>") 'toggle-dark-light-theme) | |
;; (load-theme 'solarized-light) | |
;; (set-face-font 'default (if (eq window-system 'w32) | |
;; "Consolas-10" "Liberation Mono-10")))) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; EXWM | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; (require 'exwm) | |
;; (require 'exwm-config) | |
;; ;; Start EXWM when running under X11 | |
;; (if (eq window-system 'x) | |
;; (exwm-config-default) | |
;; ) | |
;; ;; default char-mode | |
;; ;; (setq exwm-manage-configurations '((t char-mode t))) | |
;; ;; s-m to swtich between line-mode and char-mode | |
;; (setq exwm-input-global-keys | |
;; `( | |
;; ([?\s-m] . exwm-input-toggle-keyboard) | |
;; ;; Bind "s-&" to launch applications ('M-&' also works if the output | |
;; ;; buffer does not bother you). | |
;; ([?\s-w] . exwm-workspace-switch) | |
;; ;; Bind "s-0" to "s-9" to switch to a workspace by its index. | |
;; ,@(mapcar (lambda (i) | |
;; `(,(kbd (format "s-%d" i)) . | |
;; (lambda () | |
;; (interactive) | |
;; (exwm-workspace-switch-create ,i)))) | |
;; (number-sequence 0 9)) | |
;; ([?\s-&] . (lambda (command) | |
;; (interactive (list (read-shell-command "$ "))) | |
;; (start-process-shell-command command nil command))))) | |
;; permits other programs to use the kill-ring | |
;; (require 'gpastel) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; org mode | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; prevent demoting heading also shifting text inside sections | |
(setq org-adapt-indentation nil) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; dired | |
(setq dired-listing-switches "-alh") | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Enabled commands | |
(put 'downcase-region 'disabled nil) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; function-args | |
;; (require 'function-args) | |
;; (fa-config-default) | |
;; (define-key c-mode-map [(tab)] 'company-complete) | |
;; (define-key c++-mode-map [(tab)] 'company-complete) | |
(put 'upcase-region 'disabled nil) | |
;; misc | |
(setq-default fill-column 79) | |
(setq-default tab-width 4) | |
;; ensure that we use the right python version when switching virtual enviornments | |
(use-package pyvenv | |
:ensure t | |
:config | |
(pyvenv-mode t) | |
;; Set correct Python interpreter | |
(setq pyvenv-post-activate-hooks | |
(list (lambda () | |
(setq python-shell-interpreter (concat pyvenv-virtual-env "bin/ipython3") | |
python-shell-interpreter-args "--simple-prompt -i" | |
) | |
(setq elpy-rpc-python-command (concat pyvenv-virtual-env "/bin/python") | |
) | |
))) | |
(setq pyvenv-post-deactivate-hooks | |
(list (lambda () | |
(setq python-shell-interpreter "ipython3" | |
python-shell-interpreter-args "--simple-prompt -i" | |
) | |
(setq elpy-rpc-python-command "/home/alex/python/py38/bin/python") | |
))) | |
) | |
;; (setq elpy-rpc-python-command "/home/alex/projects/playright/.venv/bin/python") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment