Various fixes
This commit is contained in:
parent
6dd587c8e8
commit
4317392ea1
7 changed files with 29 additions and 51 deletions
|
@ -50,6 +50,8 @@
|
||||||
(progn
|
(progn
|
||||||
(evil-mode 1)
|
(evil-mode 1)
|
||||||
|
|
||||||
|
(add-hook! 'find-file-hook (setq evil-shift-width tab-width))
|
||||||
|
|
||||||
(setq evil-search-module 'evil-search)
|
(setq evil-search-module 'evil-search)
|
||||||
(setq evil-magic 'very-magic)
|
(setq evil-magic 'very-magic)
|
||||||
;; Color-coded state cursors
|
;; Color-coded state cursors
|
||||||
|
@ -87,9 +89,11 @@
|
||||||
(defun my.evil-surround-escaped-pair ()
|
(defun my.evil-surround-escaped-pair ()
|
||||||
"Evil-surround function to allow escaped delimiters. e.g. \"...\""
|
"Evil-surround function to allow escaped delimiters. e.g. \"...\""
|
||||||
(let* ((input (format "\\%s" (char-to-string (read-char "\\")))))
|
(let* ((input (format "\\%s" (char-to-string (read-char "\\")))))
|
||||||
(cons input input)))
|
;; Type \\ to simply surround in single backslashes
|
||||||
(setq-default evil-surround-pairs-alist (cons '(?\\ . my.evil-surround-escaped-pair) evil-surround-pairs-alist))
|
(if (= input "\\\\")
|
||||||
))
|
(cons "\\" "\\")
|
||||||
|
(cons input input))))
|
||||||
|
(setq-default evil-surround-pairs-alist (cons '(?\\ . my.evil-surround-escaped-pair) evil-surround-pairs-alist))))
|
||||||
|
|
||||||
(use-package god-mode)
|
(use-package god-mode)
|
||||||
(use-package evil-god-state :diminish god-local-mode)
|
(use-package evil-god-state :diminish god-local-mode)
|
||||||
|
@ -108,7 +112,7 @@
|
||||||
(evil-half-cursor))
|
(evil-half-cursor))
|
||||||
|
|
||||||
;; Exit evil-exchange mode with <Esc> (silently) -- and close
|
;; Exit evil-exchange mode with <Esc> (silently) -- and close
|
||||||
;; minibuffer remotely if it happens to be open
|
;; minibuffer remotely if it happens to be left open
|
||||||
(defadvice evil-force-normal-state (before evil-esc-quit-exchange activate)
|
(defadvice evil-force-normal-state (before evil-esc-quit-exchange activate)
|
||||||
(shut-up (evil-exchange-cancel)
|
(shut-up (evil-exchange-cancel)
|
||||||
(if (minibufferp)
|
(if (minibufferp)
|
||||||
|
@ -186,7 +190,8 @@ returns nil."
|
||||||
;; Highjacks backspace and space to:
|
;; Highjacks backspace and space to:
|
||||||
;; a) expand spaces between delimiters intelligently: (|) -> ( | )
|
;; a) expand spaces between delimiters intelligently: (|) -> ( | )
|
||||||
;; b) the reverse of A: ( | ) -> (|)
|
;; b) the reverse of A: ( | ) -> (|)
|
||||||
;; c) And allow backspace to delete indented blocks intelligently
|
;; c) allow backspace to delete indented blocks intelligently
|
||||||
|
;; d) and not do any of this magic when inside a string
|
||||||
(-imap (kbd "SPC") 'my.inflate-space-maybe
|
(-imap (kbd "SPC") 'my.inflate-space-maybe
|
||||||
[remap backward-delete-char-untabify] 'my.deflate-space-maybe
|
[remap backward-delete-char-untabify] 'my.deflate-space-maybe
|
||||||
[remap delete-backward-char] 'my.deflate-space-maybe
|
[remap delete-backward-char] 'my.deflate-space-maybe
|
||||||
|
@ -246,12 +251,15 @@ returns nil."
|
||||||
(setq sp-autowrap-region nil ; let evil-surround handle this
|
(setq sp-autowrap-region nil ; let evil-surround handle this
|
||||||
sp-highlight-pair-overlay nil
|
sp-highlight-pair-overlay nil
|
||||||
sp-show-pair-delay 0
|
sp-show-pair-delay 0
|
||||||
sp-autoescape-string-quote t)
|
sp-autoescape-string-quote nil)
|
||||||
|
|
||||||
(sp-pair "{" nil :post-handlers '(("||\n[i]" "RET")))
|
(sp-pair "{" nil :post-handlers '(("||\n[i]" "RET")))
|
||||||
(sp-pair "[" nil :post-handlers '(("||\n[i]" "RET")))
|
(sp-pair "[" nil :post-handlers '(("||\n[i]" "RET")))
|
||||||
(sp-local-pair 'emacs-lisp-mode "[" nil :post-handlers '(("|" "RET")))
|
(sp-with-modes '(emacs-lisp-mode lisp-mode)
|
||||||
|
(sp-local-pair "[" nil :post-handlers '(("|" "RET"))))
|
||||||
|
|
||||||
|
(sp-pair "[" nil :unless '(sp-point-before-word-p))
|
||||||
|
(sp-pair "(" nil :unless '(sp-point-before-word-p))
|
||||||
(sp-pair "\"" nil :unless '(sp-point-after-word-p sp-point-before-word-p))
|
(sp-pair "\"" nil :unless '(sp-point-after-word-p sp-point-before-word-p))
|
||||||
(sp-pair "'" nil :unless '(sp-point-after-word-p sp-point-before-word-p))
|
(sp-pair "'" nil :unless '(sp-point-after-word-p sp-point-before-word-p))
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,9 @@ already there, move it to the true bol."
|
||||||
"Delete back to the previous column of whitespace, or as much
|
"Delete back to the previous column of whitespace, or as much
|
||||||
whitespace as possible, or just one char if that's not possible."
|
whitespace as possible, or just one char if that's not possible."
|
||||||
(interactive)
|
(interactive)
|
||||||
(cond ;; If in a string (workaround for smartparen bug)
|
(cond ;; If in a string
|
||||||
((sp-point-in-string)
|
((sp-point-in-string)
|
||||||
(if (sp-point-in-empty-sexp)
|
(call-interactively 'backward-delete-char-untabify))
|
||||||
(call-interactively 'sp-backward-delete-char)
|
|
||||||
(call-interactively 'backward-delete-char-untabify)))
|
|
||||||
;; If using tabs (or at bol), just delete normally
|
;; If using tabs (or at bol), just delete normally
|
||||||
((or indent-tabs-mode
|
((or indent-tabs-mode
|
||||||
(= (point-at-bol) (point)))
|
(= (point-at-bol) (point)))
|
||||||
|
@ -99,7 +97,7 @@ spaces on either side of the point if so. Resorts to
|
||||||
"Newline and indent; if in a comment, auto-comment and properly
|
"Newline and indent; if in a comment, auto-comment and properly
|
||||||
indent the next line."
|
indent the next line."
|
||||||
(interactive)
|
(interactive)
|
||||||
(cond ((in-string-p)
|
(cond ((sp-point-in-string)
|
||||||
(evil-ret))
|
(evil-ret))
|
||||||
((evil-in-comment-p)
|
((evil-in-comment-p)
|
||||||
(indent-new-comment-line))
|
(indent-new-comment-line))
|
||||||
|
|
|
@ -20,4 +20,4 @@
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
(setq csharp-want-imenu nil)
|
(setq csharp-want-imenu nil)
|
||||||
(add-hook 'csharp-mode-hook (lambda() (omnisharp-mode t) (flycheck-mode t)))))
|
(add-hook! 'csharp-mode-hook (omnisharp-mode t) (flycheck-mode t))))
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
'(save new-line mode-enabled)
|
'(save new-line mode-enabled)
|
||||||
flycheck-disabled-checkers
|
flycheck-disabled-checkers
|
||||||
'(emacs-lisp emacs-lisp-checkdoc))
|
'(emacs-lisp emacs-lisp-checkdoc))
|
||||||
:idle
|
:init
|
||||||
(add-hook 'after-init-hook #'global-flycheck-mode))
|
(add-hook 'after-init-hook #'global-flycheck-mode))
|
||||||
|
|
||||||
(use-package flyspell
|
(use-package flyspell
|
||||||
:commands flyspell-mode
|
:commands flyspell-mode
|
||||||
:diminish (flyspell-mode . " @")
|
|
||||||
:config
|
:config
|
||||||
(setq ispell-program-name "aspell"
|
(setq ispell-program-name "aspell"
|
||||||
ispell-list-command "--list"))
|
ispell-list-command "--list"))
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
(provide 'init-snippets)
|
(provide 'init-snippets)
|
||||||
|
|
||||||
(use-package yasnippet
|
(use-package yasnippet
|
||||||
:diminish (yas-minor-mode . " $")
|
|
||||||
:mode (("emacs.+/snippets/" . snippet-mode))
|
:mode (("emacs.+/snippets/" . snippet-mode))
|
||||||
:pre-load
|
:pre-load
|
||||||
(progn
|
(progn
|
||||||
|
|
|
@ -202,7 +202,7 @@ to abort the minibuffer."
|
||||||
:move-point nil
|
:move-point nil
|
||||||
:type inclusive
|
:type inclusive
|
||||||
:repeat nil
|
:repeat nil
|
||||||
(interactive "<r><!>")
|
(interactive "<r>")
|
||||||
(let ((mode major-mode)
|
(let ((mode major-mode)
|
||||||
(text (when (and beg end) (buffer-substring beg end))))
|
(text (when (and beg end) (buffer-substring beg end))))
|
||||||
(if text
|
(if text
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
(global-set-key (kbd "M-x") 'smex)
|
(global-set-key (kbd "M-x") 'smex)
|
||||||
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
|
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
|
||||||
(global-set-key (kbd "C-;") 'eval-expression)
|
(global-set-key (kbd "C-:") 'eval-expression)
|
||||||
(global-set-key (kbd "C-j") "5j")
|
(global-set-key (kbd "C-j") "5j")
|
||||||
(global-set-key (kbd "C-k") "5k")
|
(global-set-key (kbd "C-k") "5k")
|
||||||
|
|
||||||
|
@ -63,9 +63,7 @@
|
||||||
(vmap! ",r" 'my:run-code-region
|
(vmap! ",r" 'my:run-code-region
|
||||||
",R" 'my:send-region-to-repl)
|
",R" 'my:send-region-to-repl)
|
||||||
|
|
||||||
(nvmap! ",x" 'my:ex:scratch-buffer
|
(nvmap! ",=" 'align-regexp)
|
||||||
",X" 'my:ex:org-capture
|
|
||||||
",=" 'align-regexp)
|
|
||||||
|
|
||||||
;;;; <localleader> ;;;;;;;;;;;;;;;;;;;;;
|
;;;; <localleader> ;;;;;;;;;;;;;;;;;;;;;
|
||||||
(-nmap "\\" 'evil-execute-in-god-state)
|
(-nmap "\\" 'evil-execute-in-god-state)
|
||||||
|
@ -240,43 +238,17 @@
|
||||||
",tV" 'nosetests-pdb-module))
|
",tV" 'nosetests-pdb-module))
|
||||||
|
|
||||||
(after org
|
(after org
|
||||||
;; normal & insert state shortcuts.
|
(define-key org-mode-map (kbd "RET") nil)
|
||||||
;; (mapc (lambda (state)
|
|
||||||
;; (evil-define-key state evil-org-mode-map
|
|
||||||
;; (kbd "M--") 'my/org-insert-list-item
|
|
||||||
;; (kbd "M-l") 'org-metaright
|
|
||||||
;; (kbd "M-h") 'org-metaleft
|
|
||||||
;; (kbd "M-k") 'org-metaup
|
|
||||||
;; (kbd "M-j") 'org-metadown
|
|
||||||
;; (kbd "M-L") 'org-shiftmetaright
|
|
||||||
;; (kbd "M-H") 'org-shiftmetaleft
|
|
||||||
;; (kbd "M-K") 'org-shiftmetaup
|
|
||||||
;; (kbd "M-J") 'org-shiftmetadown
|
|
||||||
;; (kbd "<M-return>") '(lambda () (interactive)
|
|
||||||
;; (my/org-eol-call
|
|
||||||
;; '(lambda()
|
|
||||||
;; (org-insert-heading)
|
|
||||||
;; (org-metaright))))
|
|
||||||
;; (kbd "M-t") '(lambda () (interactive)
|
|
||||||
;; (my/org-eol-call
|
|
||||||
;; '(lambda()
|
|
||||||
;; (org-insert-todo-heading nil)
|
|
||||||
;; (org-metaright))))
|
|
||||||
;; ))
|
|
||||||
;; '(normal insert))
|
|
||||||
|
|
||||||
;; Formatting shortcuts
|
|
||||||
|
|
||||||
(define-key org-mode-map (kbd "C-j") nil)
|
(define-key org-mode-map (kbd "C-j") nil)
|
||||||
(define-key org-mode-map (kbd "C-k") nil)
|
(define-key org-mode-map (kbd "C-k") nil)
|
||||||
|
|
||||||
|
;; Formatting shortcuts
|
||||||
(imap evil-org-mode-map
|
(imap evil-org-mode-map
|
||||||
(kbd "s-b") (λ (my/org-surround "*")) ; bold
|
(kbd "s-b") (λ (my/org-surround "*")) ; bold
|
||||||
(kbd "s-u") (λ (my/org-surround "_")) ; underline
|
(kbd "s-u") (λ (my/org-surround "_")) ; underline
|
||||||
(kbd "s-i") (λ (my/org-surround "/")) ; italics
|
(kbd "s-i") (λ (my/org-surround "/")) ; italics
|
||||||
(kbd "s-`") (λ (my/org-surround "+")) ; strikethrough
|
(kbd "s-`") (λ (my/org-surround "+")) ; strikethrough
|
||||||
|
)
|
||||||
(kbd "<s-return>") 'org-insert-heading-after-current)
|
|
||||||
|
|
||||||
(nvmap evil-org-mode-map
|
(nvmap evil-org-mode-map
|
||||||
",l" 'org-insert-link)
|
",l" 'org-insert-link)
|
||||||
|
@ -311,8 +283,9 @@
|
||||||
">" 'org-metaright
|
">" 'org-metaright
|
||||||
"-" 'org-cycle-list-bullet
|
"-" 'org-cycle-list-bullet
|
||||||
(kbd ", SPC") 'org-archive-subtree
|
(kbd ", SPC") 'org-archive-subtree
|
||||||
|
(kbd "<S-s-return>") (λ (evil-move-beginning-of-line) (org-insert-heading) (evil-insert-state))
|
||||||
(kbd "<s-return>") (λ (org-insert-heading-after-current) (evil-insert-state))
|
(kbd "<s-return>") (λ (org-insert-heading-after-current) (evil-insert-state))
|
||||||
(kbd "RET") (λ (org-todo 'done))
|
(kbd "RET") (λ (if (org-entry-is-todo-p) (org-todo 'done)))
|
||||||
(kbd "TAB") 'org-cycle))
|
(kbd "TAB") 'org-cycle))
|
||||||
|
|
||||||
(after ruby-mode
|
(after ruby-mode
|
||||||
|
@ -368,6 +341,7 @@
|
||||||
(exmap "ag" 'my:ex:ag-search)
|
(exmap "ag" 'my:ex:ag-search)
|
||||||
(exmap "agr" 'my:ex:ag-regex-search)
|
(exmap "agr" 'my:ex:ag-regex-search)
|
||||||
(exmap "x" 'my:ex:scratch-buffer)
|
(exmap "x" 'my:ex:scratch-buffer)
|
||||||
|
(exmap "X" 'my:ex:org-capture)
|
||||||
(exmap "a" 'projectile-find-other-file)
|
(exmap "a" 'projectile-find-other-file)
|
||||||
(exmap "bx" 'my:ex:kill-buffers)
|
(exmap "bx" 'my:ex:kill-buffers)
|
||||||
(exmap "tcd" 'my:ex:tmux-chdir)
|
(exmap "tcd" 'my:ex:tmux-chdir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue