Commit eaa76191 authored by David Sveningsson's avatar David Sveningsson
Browse files

emacs: move more config

parent 8f9a6811
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
;; MELPA
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
......@@ -11,20 +8,15 @@
'(
;; misc
company
editorconfig
evil-numbers
flycheck
solarized-theme
string-inflection
projectile
;; modes
js2-mode
json-mode
markdown-mode
web-mode
yaml-mode
tide
tide
))
;; use-package
......@@ -39,28 +31,6 @@
;; load configuration from init.org
(org-babel-load-file "~/.dotfiles/global/emacs.d/init.org")
(use-package smerge-mode
:commands smerge-mode
:init
(progn
(setq smerge-command-prefix (kbd "C-c v"))))
(use-package minions
:if window-system
:ensure t
:init (minions-mode)
:config
(setq x-underline-at-descent-line t)
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
(use-package moody
:if window-system
:ensure t
:config
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
;; Load additional files
(load "~/.dotfiles/global/skeletons.el")
......@@ -75,34 +45,6 @@
(global-set-key (kbd "<f9>") 'compile)
(global-unset-key (kbd "<f10>"))
;; bind C-c [+-] as repeatable increment/decrement number (via evil-numbers)
(global-set-key (kbd "C-c +") 'ext/inc-at-pt)
(global-set-key (kbd "C-c -") 'ext/dec-at-pt)
(defvar ext/incdec-at-point
(let ((map (make-sparse-keymap)))
(define-key map (kbd "+") 'ext/inc-at-pt)
(define-key map (kbd "-") 'ext/dec-at-pt)
map))
(defun ext/inc-at-pt (amount)
(interactive "p*")
(evil-numbers/inc-at-pt amount)
(set-transient-map ext/incdec-at-point))
(defun ext/dec-at-pt (amount)
(interactive "p*")
(evil-numbers/dec-at-pt amount)
(set-transient-map ext/incdec-at-point))
;; string-inflection (cycle camelCase, snake_case etc)
(global-set-key (kbd "C-c C-u") 'ext/string-inflection-all-cycle)
(defvar ext/string-inflection-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-u") 'ext/string-inflection-all-cycle)
map))
(defun ext/string-inflection-all-cycle ()
(interactive)
(string-inflection-all-cycle)
(set-transient-map ext/string-inflection-map t))
;; ;; PuTTY fixes.
;; (define-key input-decode-map "\eOA" [(C up)])
;; (define-key input-decode-map "\eOB" [(C down)])
......@@ -123,7 +65,7 @@
;; file; follow link?" every time I open a symlink to a versioned
;; file.
(setq vc-follow-symlinks t)
(setq require-final-newline 't) ; require newlines at EOF
; Turn on flyspell-prog-mode in all modes except ..., which should use
; full flyspell-mode.
......@@ -134,10 +76,6 @@
(flyspell-mode t)
(flyspell-prog-mode))))
; Activate CUA by default (without C-z as it interferes with suspend)
(setq cua-remap-control-z 'nil)
(when (fboundp 'cua-mode ) (cua-mode 1))
; Activate ido mode by default
(ido-mode 1)
(setq ido-enable-flex-matching t)
......@@ -147,9 +85,6 @@
(global-font-lock-mode 1) ; GNU Emacs
(setq font-lock-auto-fontify t)) ; XEmacs
; force transient mark
(transient-mark-mode 1)
(require 'site-gentoo nil 1) ; Gentoo site packages
;;
......
......@@ -6,10 +6,14 @@
#+END_SRC
* Configuration
#+BEGIN_SRC emacs-lisp
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
; disable menubar/toolbar by default (as early as possible or they pop
; up for a short while while loading cruft)
(menu-bar-mode -1)
(tool-bar-mode -1)
(toggle-scroll-bar -1)
; truncate lines by default
(setq-default truncate-lines t);
......@@ -33,7 +37,31 @@
(setq read-file-name-completion-ignore-case t);
(setq-default fill-column 80)
; require newlines at EOF
(setq require-final-newline 't)
(setq line-move-visual nil)
; force transient mark
(transient-mark-mode 1)
#+END_SRC
* Theme
#+BEGIN_SRC emacs-lisp
(use-package solarized-theme
:ensure t
:config
(load-theme 'solarized-dark t)
(let ((line (face-attribute 'mode-line :underline)))
(set-face-attribute 'mode-line nil :overline line)
(set-face-attribute 'mode-line-inactive nil :overline line)
(set-face-attribute 'mode-line-inactive nil :underline line)
(set-face-attribute 'mode-line nil :box nil)
(set-face-attribute 'mode-line-inactive nil :box nil))
(setq solarized-distinct-fringe-background t
solarized-high-contrast-mode-line t
solarized-scale-org-headlines nil))
#+END_SRC
* Swiper / Ivy / Counsel
Swiper gives us a really efficient incremental search with regular expressions
and Ivy / Counsel replace a lot of ido or helms completion functionality
......@@ -110,6 +138,18 @@
(progn
(global-set-key [remap other-window] 'ace-window)))
#+END_SRC
* Cua
#+BEGIN_SRC emacs-lisp
; Activate CUA by default (without C-z as it interferes with suspend)
(setq cua-remap-control-z 'nil)
(setq cua-auto-tabify-rectangles nil)
(cua-mode 1)
#+END_SRC
* Editorconfig
#+BEGIN_SRC emacs-lisp
(use-package editorconfig
:ensure t)
#+END_SRC
* Javascript
** add-node-modules-path
Adds the ~node_modules/.bin~ directory to exec_path.
......@@ -198,11 +238,18 @@
:init
(add-to-list 'auto-mode-alist '("\\.ngdoc\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("CHANGELOG.md\\'" . markdown-mode)))
#+END_SRC
(defun markdown-hook ()
"markdown hook"
(flyspell-mode 1))
(add-hook 'markdown-mode-hook 'markdown-hook)
#+END_SRC
* smerge
#+BEGIN_SRC emacs-lisp
(use-package smerge-mode
:commands smerge-mode
:init
(progn
(setq smerge-command-prefix (kbd "C-c v"))))
* Hydra
#+BEGIN_SRC emacs-lisp
(use-package hydra
......@@ -215,6 +262,16 @@
(projectile-mode +1)
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))
;; Window title from projectile
(setq frame-title-format
'(""
"%b"
(:eval
(let ((project-name (projectile-project-name)))
(unless (string= "-" project-name)
(format " in [%s]" project-name))))))
#+END_SRC
* Org mode
** Pin repo
......@@ -315,22 +372,36 @@ Default configuration.
:after treemacs magit
:ensure t)
#+END_SRC
* Theme
* Minions / moody
#+BEGIN_SRC emacs-lisp
(use-package solarized-theme
(use-package minions
:if window-system
:ensure t
:init (minions-mode)
:config
(load-theme 'solarized-dark t)
(let ((line (face-attribute 'mode-line :underline)))
(set-face-attribute 'mode-line nil :overline line)
(set-face-attribute 'mode-line-inactive nil :overline line)
(set-face-attribute 'mode-line-inactive nil :underline line)
(set-face-attribute 'mode-line nil :box nil)
(set-face-attribute 'mode-line-inactive nil :box nil))
(setq solarized-distinct-fringe-background t
solarized-high-contrast-mode-line t
solarized-scale-org-headlines nil))
(setq x-underline-at-descent-line t)
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
(use-package moody
:if window-system
:ensure t
:config
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
#+END_SRC
* String inflection
cycle camelCase, snake_case etc
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-c C-u") 'ext/string-inflection-all-cycle)
(defvar ext/string-inflection-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-u") 'ext/string-inflection-all-cycle)
map))
(defun ext/string-inflection-all-cycle ()
(interactive)
(string-inflection-all-cycle)
(set-transient-map ext/string-inflection-map t))
#+END_SRC
* Custom functions
** inhibit-dtw
......@@ -350,3 +421,22 @@ Default configuration.
(setq-local my-inhibit-dtw t)
(message "dtw disabled"))))
#+END_SRC
** {inc,dec}-at-pt
bind C-c [+-] as repeatable increment/decrement number (via evil-numbers)
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-c +") 'ext/inc-at-pt)
(global-set-key (kbd "C-c -") 'ext/dec-at-pt)
(defvar ext/incdec-at-point
(let ((map (make-sparse-keymap)))
(define-key map (kbd "+") 'ext/inc-at-pt)
(define-key map (kbd "-") 'ext/dec-at-pt)
map))
(defun ext/inc-at-pt (amount)
(interactive "p*")
(evil-numbers/inc-at-pt amount)
(set-transient-map ext/incdec-at-point))
(defun ext/dec-at-pt (amount)
(interactive "p*")
(evil-numbers/dec-at-pt amount)
(set-transient-map ext/incdec-at-point))
#+END_SRC
......@@ -126,7 +126,6 @@
(smart-tabs-insinuate 'c 'c++ 'javascript)))
(setq-default tab-width 2) ; or any other preferred value
(setq cua-auto-tabify-rectangles nil)
;; flycheck
(when (require 'flycheck nil :noerror)
......@@ -139,6 +138,8 @@
(global-set-key (kbd "C-<tab>") 'company-complete-common-or-cycle)
(setq company-idle-delay 0)
(setq tramp-mode nil)) ;; company launches tramp when typing /m trying to autocomplete files over ssh (wat...)
;; aligns annotation to the right hand side
(setq company-tooltip-align-annotations t)
;; editorconfig
(when (require 'editorconfig nil :noerror)
......@@ -152,5 +153,3 @@
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)
;; aligns annotation to the right hand side
(setq company-tooltip-align-annotations t)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment