Last active
September 27, 2019 04:31
-
-
Save tirkarthi/1f2dcd4c018ee8e42536554fd560d0f2 to your computer and use it in GitHub Desktop.
Emacs config
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
;; Add modes and deactivate modes | |
(menu-bar-mode -1) | |
;; Added by Package.el. This must come before configurations of | |
;; installed packages. Don't delete this line. If you don't want it, | |
;; just comment it out by adding a semicolon to the start of the line. | |
;; You may delete these explanatory comments. | |
(package-initialize) | |
(require 'package) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) | |
(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. | |
'(cua-mode t nil (cua-base)) | |
'(cua-prefix-override-inhibit-delay 0.5) | |
'(custom-safe-themes | |
(quote | |
("ed8cf6d52a2ba9ed7a29a8aac81d83c362a9b62f48b558932a77130163fe9972" "a800120841da457aa2f86b98fb9fd8df8ba682cebde033d7dbf8077c1b7d677a" default))) | |
'(mode-line-format | |
(quote | |
("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification " " mode-line-position mode-line-misc-info | |
(vc-mode vc-mode) | |
" " mode-line-modes mode-line-end-spaces))) | |
'(org-export-backends (quote (ascii html icalendar latex md odt))) | |
'(package-selected-packages | |
(quote | |
(protobuf-mode exwm dash magithub cider deadgrep git-link tldr clj-refactor vue-mode lua-mode vlf elixir-mode kotlin-mode monky helm-dash yafolding parinfer inf-clojure slime cloc clojars clojure-mode-extra-font-locking fzf helm webpaste pastebin hackernews tree-mode rg restclient gotham-theme yaml-mode expand-region paredit-everywhere pcre2el undo-tree babel use-package editorconfig fsharp-mode magit typescript-mode pyfmt flycheck-d-unittest comment-dwim-2 snippet ac-dcd haskell-mode swift-mode swift3-mode toml-mode scala-mode coffee-mode markdown-preview-mode markdown-mode perl6-mode go-mode elpy pylint ag py-autopep8 jedi monokai-theme web-mode d-mode python-mode rust-mode))) | |
'(python-shell-interpreter "python3") | |
'(safe-local-variable-values | |
(quote | |
((cider-refresh-after-fn . "integrant.repl/resume") | |
(cider-refresh-before-fn . "integrant.repl/suspend")))) | |
'(send-mail-function (quote smtpmail-send-it))) | |
(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. | |
) | |
(package-install-selected-packages) | |
(setq python-indent-offset 4) | |
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode)) | |
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)) | |
(add-to-list 'auto-mode-alist '("\\.pyx\\'" . python-mode)) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
;; python and jedi bindings | |
(add-hook 'python-mode-hook 'jedi:setup t) | |
(setq jedi:complete-on-dot t) | |
(add-hook 'python-mode-hook 'jedi:ac-setup t) | |
;; buffer related shortcurts | |
(global-set-key (kbd "M-p") 'previous-buffer) | |
(global-set-key (kbd "M-n") 'next-buffer) | |
(global-set-key (kbd "M-s") 'ag) | |
(global-set-key (kbd "C-x =") 'er/expand-region) | |
(global-set-key (kbd "M-;") 'comment-dwim-2) | |
(global-set-key (kbd "M-k") 'kill-this-buffer) | |
(global-set-key (kbd "C-c g") 'magit-status) | |
(setq org-src-fontify-natively t) | |
(windmove-default-keybindings) | |
(desktop-save-mode 1) | |
(global-linum-mode 1) | |
(show-paren-mode 1) | |
(load-theme 'monokai) | |
(setq ag-reuse-buffers 't) | |
(require 'ac-dcd) | |
;; hg annotate | |
(setq vc-hg-annotate-switches "-dqun") | |
(use-package editorconfig | |
:ensure t | |
:config | |
(editorconfig-mode 1)) | |
(defun next-code-buffer () | |
(interactive) | |
(let (( bread-crumb (buffer-name) )) | |
(next-buffer) | |
(while | |
(and | |
(string-match-p "^\*" (buffer-name)) | |
(not ( equal bread-crumb (buffer-name) )) ) | |
(next-buffer)))) | |
(global-set-key [remap next-buffer] 'next-code-buffer) | |
(defun previous-code-buffer () | |
(interactive) | |
(let (( bread-crumb (buffer-name) )) | |
(previous-buffer) | |
(while | |
(and | |
(string-match-p "^\*" (buffer-name)) | |
(not ( equal bread-crumb (buffer-name) )) ) | |
(previous-buffer)))) | |
(global-set-key [remap previous-buffer] 'previous-code-buffer) | |
(org-babel-do-load-languages | |
'org-babel-load-languages '((calc . t) (python . t) (C . t) (clojure . t))) | |
(defalias 'yes-or-no-p 'y-or-n-p) | |
(global-undo-tree-mode t) | |
;; eww customisations | |
(setq shr-color-visible-luminance-min 70) | |
;; set isearch as dired search | |
(setq dired-isearch-filenames t) | |
(setq-default fill-column 120) | |
;; (setq my/terminal-buffer "*terminal*") | |
(which-function-mode) | |
(tool-bar-mode -1) | |
;; (term "/bin/zsh") | |
(use-package ht) | |
(when (eq system-type 'darwin) | |
(eval-after-load 'paredit | |
'(progn | |
;; C-left | |
(define-key paredit-mode-map (kbd "M-[ 5 d") | |
'paredit-forward-barf-sexp) | |
;; C-right | |
(define-key paredit-mode-map (kbd "M-[ 5 c") | |
'paredit-forward-slurp-sexp) | |
;; ESC-C-left | |
(define-key paredit-mode-map (kbd "ESC M-[ 5 d") | |
'paredit-backward-slurp-sexp) | |
;; ESC-C-right | |
(define-key paredit-mode-map (kbd "ESC M-[ 5 c") | |
'paredit-backward-barf-sexp)))) | |
(add-to-list 'exec-path "/usr/local/bin") | |
(define-abbrev-table 'python-mode-abbrev-table | |
'(("ipdb" "import ipdb; ipdb.set_trace()") | |
("pdb" "import pdb; pdb.set_trace()") | |
("bt" "breakpoint()"))) | |
(set-default 'abbrev-mode t) | |
(setq save-abbrevs nil) | |
(setq cider-cljs-lein-repl | |
"(do (require 'figwheel-sidecar.repl-api) | |
(figwheel-sidecar.repl-api/start-figwheel!) | |
(figwheel-sidecar.repl-api/cljs-repl))") | |
(rg-define-search rg-foo | |
"Search for thing at point in files matching the current file" | |
:query ask | |
:files all | |
:dir ask) | |
(defun python-bugs-url () | |
(interactive) | |
(let ((commit-message (magit-rev-format "%B" | |
(magit-rev-parse | |
(magit-branch-or-commit-at-point)))) | |
(bugs-base-url "https://bugs.python.org/issue") | |
(pr-base-url "https://github.com/python/cpython/pull/") | |
(bugs-pr-regex "bpo-\\([0-9]+\\).*\\(GH-\\|#\\)\\([0-9]+\\)")) | |
(when (string-match bugs-pr-regex commit-message) | |
(let ((bug-url (concat bugs-base-url (match-string 1 commit-message))) | |
(pr-url (concat pr-base-url (match-string 3 commit-message)))) | |
(browse-url bug-url) | |
(browse-url pr-url))))) | |
(magit-define-popup-action 'magit-log-popup | |
?z | |
"Open bug in browser" | |
'python-bugs-url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment