aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-11-23 20:26:01 +0000
committerYann Herklotz <ymherklotz@gmail.com>2018-11-23 20:26:01 +0000
commit5fc4ec4bf2c47eacbf0efe5d2e845c68b6491741 (patch)
tree226998ac8762f8f263491a95902fbc9561d55fe2
parent69d9281ef2fb8833f3d57f6a3203ee1fc264e582 (diff)
downloaddotfiles-5fc4ec4bf2c47eacbf0efe5d2e845c68b6491741.tar.gz
dotfiles-5fc4ec4bf2c47eacbf0efe5d2e845c68b6491741.zip
Add ido and smex
-rw-r--r--emacs/loader.org83
-rw-r--r--zsh/.zsh/function.zsh3
2 files changed, 77 insertions, 9 deletions
diff --git a/emacs/loader.org b/emacs/loader.org
index db800db..efcf8ab 100644
--- a/emacs/loader.org
+++ b/emacs/loader.org
@@ -292,7 +292,43 @@ programming and looking at source code.
#+BEGIN_SRC emacs-lisp
(use-package eshell
:ensure nil
- :bind (("C-c e" . eshell)))
+ :bind (("C-c e" . eshell))
+ :init
+ (defun eshell/vi (&rest args)
+ "Invoke `find-file' on the file.
+ \"vi +42 foo\" also goes to line 42 in the buffer."
+ (while args
+ (if (string-match "\\`\\+\\([0-9]+\\)\\'" (car args))
+ (let* ((line (string-to-number (match-string 1 (pop args))))
+ (file (pop args)))
+ (find-file file)
+ (goto-line line))
+ (find-file (pop args)))))
+
+ (defun eshell/em (&rest args)
+ "Open a file in emacs. Some habits die hard."
+ (if (null args)
+ ;; If I just ran "emacs", I probably expect to be launching
+ ;; Emacs, which is rather silly since I'm already in Emacs.
+ ;; So just pretend to do what I ask.
+ (bury-buffer)
+ ;; We have to expand the file names or else naming a directory in an
+ ;; argument causes later arguments to be looked for in that directory,
+ ;; not the starting directory
+ (mapc #'find-file (mapcar #'expand-file-name (eshell-flatten-list (reverse args))))))
+
+ (defun y/eshell-here ()
+ "Go to eshell and set current directory to the buffer's directory"
+ (interactive)
+ (let ((dir (file-name-directory (or (buffer-file-name)
+ default-directory))))
+ (eshell)
+ (eshell/pushd ".")
+ (cd dir)
+ (goto-char (point-max))
+ (eshell-kill-input)
+ (eshell-send-input)))
+ (global-set-key (kbd "C-c i") #'y/eshell-here))
#+END_SRC
#+RESULTS:
@@ -503,6 +539,25 @@ Enable winner mode to save window state.
*** Ivy
#+BEGIN_SRC emacs-lisp
+ (use-package flx-ido
+ :config
+ (ido-mode 1)
+ (ido-everywhere 1)
+ (flx-ido-mode 1)
+ ;; disable ido faces to see flx highlights.
+ (setq ido-enable-flex-matching t)
+ (setq ido-use-faces nil))
+
+ (use-package smex
+ :bind (("M-x" . smex)
+ ("M-X" . smex-major-mode-commands))
+ :config
+ (smex-initialize))
+#+END_SRC
+
+#+RESULTS:
+
+#+BEGIN_COMMENT emacs-lisp
(use-package ivy
:bind
(("C-c s" . swiper)
@@ -520,7 +575,7 @@ Enable winner mode to save window state.
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
(setq ivy-re-builders-alist
'((t . ivy--regex-fuzzy))))
-#+END_SRC
+#+END_COMMENT
#+RESULTS:
: counsel-unicode-char
@@ -645,11 +700,8 @@ incrementally selecting more and more of the text.
(flyspell-buffer))
(use-package ispell
+ :ensure nil
:config
- (when (executable-find "hunspell")
- (setq-default ispell-program-name "hunspell")
- (setq ispell-really-hunspell t))
-
;; (setq ispell-program-name "aspell"
;; ispell-extra-args '("--sug-mode=ultra"))
:bind (("C-c N" . spell-buffer-german)
@@ -683,6 +735,8 @@ incrementally selecting more and more of the text.
(setq TeX-PDF-mode t)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-buffer)
+ (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
+
(defun turn-on-outline-minor-mode ()
(outline-minor-mode 1))
@@ -692,9 +746,19 @@ incrementally selecting more and more of the text.
(autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
(autoload 'reftex-citation "reftex-cite" "Make citation" nil)
(autoload 'reftex-index-phrase-mode "reftex-index" "Phrase Mode" t)
- (add-hook 'latex-mode-hook 'turn-on-reftex)) ; with Emacs latex mode
+ (add-hook 'latex-mode-hook 'turn-on-reftex)
+ (defun turn-on-outline-minor-mode ()
+ (outline-minor-mode 1))
+
+ (add-hook 'LaTeX-mode-hook 'turn-on-outline-minor-mode)
+ (add-hook 'latex-mode-hook 'turn-on-outline-minor-mode)
+ (setq outline-minor-mode-prefix "\C-c \C-o")
+ ) ; with Emacs latex mode
#+END_SRC
+#+RESULTS:
+: t
+
** Markdown
Markdown is the standard for writing documentation. This snippet loads GFM
(Github Flavoured Markdown) style.
@@ -927,10 +991,13 @@ to install clang format script).
#+BEGIN_SRC emacs-lisp
(use-package clang-format
- :bind (("C-c i" . 'clang-format-region)
+ :bind (("C-c C-i" . 'clang-format-region)
("C-c u" . 'clang-format-buffer)))
#+END_SRC
+#+RESULTS:
+: clang-format-buffer
+
*** Clojure
Using Cider for clojure environment.
diff --git a/zsh/.zsh/function.zsh b/zsh/.zsh/function.zsh
index 0404c0b..f726fae 100644
--- a/zsh/.zsh/function.zsh
+++ b/zsh/.zsh/function.zsh
@@ -2,7 +2,8 @@ alias fdisk='fdisk --color=always'
alias grep='grep --color=always'
alias ls='ls --color=always'
alias l='ls -la --color=always'
-alias vi='vim'
+alias vi='nvim'
+alias vim='nvim'
alias emc='emacsclient -c -a ""'
alias em='emacsclient -nw -a ""'
# alias lspasscp='lpass show -c --password $(lpass ls | fzf | awk '{print $(NF)}' | sed 's/\\]//g')'