init.el: Add support for common lisp
Since the common lisp bindings were conflicting with rust cargo bindings refactor the key bindings by using major mode keymap feature of general. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
5b7fa8ae20
commit
7a8704563b
1 changed files with 286 additions and 159 deletions
211
init.el
211
init.el
|
@ -221,7 +221,8 @@
|
||||||
motion
|
motion
|
||||||
operator
|
operator
|
||||||
replace))
|
replace))
|
||||||
:config (general-define-key
|
:config
|
||||||
|
(general-define-key
|
||||||
:states '(normal visual insert emacs)
|
:states '(normal visual insert emacs)
|
||||||
:prefix "SPC"
|
:prefix "SPC"
|
||||||
:non-normal-prefix "M-SPC"
|
:non-normal-prefix "M-SPC"
|
||||||
|
@ -305,81 +306,170 @@
|
||||||
"g/" '(helm-git-grep
|
"g/" '(helm-git-grep
|
||||||
:which-key "open helm git grep")
|
:which-key "open helm git grep")
|
||||||
"g*" '(helm-git-grep-at-point
|
"g*" '(helm-git-grep-at-point
|
||||||
:which-key "open helm git grep at point")
|
:which-key "open helm git grep at point")))
|
||||||
|
|
||||||
|
(general-define-key
|
||||||
|
:states '(normal visual emacs)
|
||||||
|
:prefix "SPC m"
|
||||||
|
:keymaps 'haskell-mode-map
|
||||||
;; Haskell bindings
|
;; Haskell bindings
|
||||||
"mf" '(hindent-reformat-decl
|
"f" '(hindent-reformat-decl
|
||||||
:which-key "format declaration using hindent")
|
:which-key "format declaration using hindent")
|
||||||
"mF" '(haskell-mode-stylish-buffer
|
"F" '(haskell-mode-stylish-buffer
|
||||||
:which-key "format buffer using haskell stylish")
|
:which-key "format buffer using haskell stylish")
|
||||||
"mgg" '(intero-goto-definition
|
"gg" '(intero-goto-definition
|
||||||
:which-key "goto definition or tag")
|
:which-key "goto definition or tag")
|
||||||
"mhi" '(intero-info
|
"hi" '(intero-info
|
||||||
:which-key "get info for identifier under cursor")
|
:which-key "get info for identifier under cursor")
|
||||||
"mht" '(intero-type-at
|
"ht" '(intero-type-at
|
||||||
:which-key "get type of identifier under cursor")
|
:which-key "get type of identifier under cursor")
|
||||||
"mrs" '(intero-apply-suggestions)
|
"rs" '(intero-apply-suggestions)
|
||||||
"msb" '(intero-repl-load
|
"sb" '(intero-repl-load
|
||||||
:which-key "load/reload current buffer in repl")
|
:which-key "load/reload current buffer in repl")
|
||||||
"mic" '(intero-cd
|
"ic" '(intero-cd
|
||||||
:which-key "change directory in backend process")
|
:which-key "change directory in backend process")
|
||||||
"mid" '(intero-devel-reload
|
"id" '(intero-devel-reload
|
||||||
:which-key "reload module DevelMain")
|
:which-key "reload module DevelMain")
|
||||||
"mik" '(intero-destroy
|
"ik" '(intero-destroy
|
||||||
:which-key "stop current process & kill its associated")
|
:which-key "stop current process & kill its associated")
|
||||||
"mil" '(intero-list-buffers
|
"il" '(intero-list-buffers
|
||||||
:which-key "list hidden process buffers created")
|
:which-key "list hidden process buffers created")
|
||||||
"mir" '(intero-restart
|
"ir" '(intero-restart
|
||||||
:which-key "restart process with same config")
|
:which-key "restart process with same config")
|
||||||
"mit" '(intero-targets
|
"it" '(intero-targets
|
||||||
:which-key "set targets to use for stack ghci")
|
:which-key "set targets to use for stack ghci")
|
||||||
"msc" nil
|
"sc" nil
|
||||||
"mhT" '(haskell-intero/insert-type)
|
"hT" '(haskell-intero/insert-type)
|
||||||
"mss" '(haskell-intero/display-repl
|
"ss" '(haskell-intero/display-repl
|
||||||
:which-key "show repl without switching")
|
:which-key "show repl without switching")
|
||||||
"msS" '(haskell-intero/pop-to-repl
|
"sS" '(haskell-intero/pop-to-repl
|
||||||
:which-key "show and switch to repl")
|
:which-key "show and switch to repl")
|
||||||
"mrb" '(hlint-refactor-refactor-buffer
|
"rb" '(hlint-refactor-refactor-buffer
|
||||||
:which-key "apply all hlint suggestions")
|
:which-key "apply all hlint suggestions")
|
||||||
"mrr" '(hlint-refactor-refactor-at-point
|
"rr" '(hlint-refactor-refactor-at-point
|
||||||
:which-key "apply hlint suggestion under cursor")
|
:which-key "apply hlint suggestion under cursor"))
|
||||||
"mc." '(cargo-process-repeat
|
|
||||||
|
(general-define-key
|
||||||
|
:states '(normal visual emacs)
|
||||||
|
:prefix "SPC m"
|
||||||
|
:keymaps 'rust-mode-map
|
||||||
|
"c." '(cargo-process-repeat
|
||||||
:which-key "repeat the last cargo command")
|
:which-key "repeat the last cargo command")
|
||||||
"mcC" '(cargo-process-clean
|
"cC" '(cargo-process-clean
|
||||||
:which-key "remove build artifacts with cargo")
|
:which-key "remove build artifacts with cargo")
|
||||||
"mcX" '(cargo-process-run-example
|
"cX" '(cargo-process-run-example
|
||||||
:which-key "execute project example with cargo")
|
:which-key "execute project example with cargo")
|
||||||
"mcc" '(cargo-process-build
|
"cc" '(cargo-process-build
|
||||||
:which-key "compile project with cargo")
|
:which-key "compile project with cargo")
|
||||||
"mcd" '(cargo-process-doc
|
"cd" '(cargo-process-doc
|
||||||
:which-key "generate documentation with cargo")
|
:which-key "generate documentation with cargo")
|
||||||
"mcD" '(cargo-process-doc-open
|
"cD" '(cargo-process-doc-open
|
||||||
:which-key "open cargo docs")
|
:which-key "open cargo docs")
|
||||||
"mce" '(cargo-process-bench
|
"ce" '(cargo-process-bench
|
||||||
:which-key "run benchmarks with cargo")
|
:which-key "run benchmarks with cargo")
|
||||||
"mcf" '(cargo-process-fmt
|
"cf" '(cargo-process-fmt
|
||||||
:which-key "format all project files with rustfmt")
|
:which-key "format all project files with rustfmt")
|
||||||
"mci" '(cargo-process-init
|
"ci" '(cargo-process-init
|
||||||
:which-key "create a new project with cargo")
|
:which-key "create a new project with cargo")
|
||||||
"mcl" '(cargo-process-clippy
|
"cl" '(cargo-process-clippy
|
||||||
:which-key "run linter with cargo")
|
:which-key "run linter with cargo")
|
||||||
"mcn" '(cargo-process-new
|
"cn" '(cargo-process-new
|
||||||
:which-key "create new project with cargo")
|
:which-key "create new project with cargo")
|
||||||
"mco" '(cargo-process-current-file-tests
|
"co" '(cargo-process-current-file-tests
|
||||||
:which-key "run all tests in current file with cargo")
|
:which-key "run all tests in current file with cargo")
|
||||||
"mcs" '(cargo-process-search
|
"cs" '(cargo-process-search
|
||||||
:which-key "search for packages on crates.io")
|
:which-key "search for packages on crates.io")
|
||||||
"mct" '(cargo-process-current-test
|
"ct" '(cargo-process-current-test
|
||||||
:which-key "run the current test with cargo")
|
:which-key "run the current test with cargo")
|
||||||
"mcu" '(cargo-process-update
|
"cu" '(cargo-process-update
|
||||||
:which-key "update dependencies with cargo")
|
:which-key "update dependencies with cargo")
|
||||||
"mcx" '(cargo-process-run
|
"cx" '(cargo-process-run
|
||||||
:which-key "execute a process with cargo")
|
:which-key "execute a process with cargo")
|
||||||
"mcv" '(cargo-process-check
|
"cv" '(cargo-process-check
|
||||||
:which-key "verify a project with cargo")
|
:which-key "verify a project with cargo")
|
||||||
"mt" '(cargo-process-test
|
"t" '(cargo-process-test
|
||||||
:which-key "run test with cargo")
|
:which-key "run test with cargo")
|
||||||
"m==" '(rust-format-buffer
|
"==" '(rust-format-buffer
|
||||||
:which-key "rust reformat the buffer")))
|
:which-key "rust reformat the buffer"))
|
||||||
|
|
||||||
|
(general-define-key
|
||||||
|
:states '(normal visual emacs)
|
||||||
|
:prefix "SPC m"
|
||||||
|
:keymaps 'lisp-mode-map
|
||||||
|
"cc" '(slime-compile-file
|
||||||
|
:which-key "compile file")
|
||||||
|
"cC" '(slime-compile-and-load-file
|
||||||
|
:which-key "compile file and load")
|
||||||
|
"cl" '(slime-load-file
|
||||||
|
:which-key "load file")
|
||||||
|
"cf" '(slime-compile-defun
|
||||||
|
:which-key "compile function")
|
||||||
|
"cr" '(slime-compile-region
|
||||||
|
:which-key "compile region")
|
||||||
|
"cn" '(slime-remove-notes
|
||||||
|
:which-key "remove compilation notes")
|
||||||
|
|
||||||
|
"eb" '(slime-eval-buffer
|
||||||
|
:which-key "evaluate buffer")
|
||||||
|
"ef" '(slime-eval-defun
|
||||||
|
:which-key "evaluate top level sexpr")
|
||||||
|
"eF" '(slime-undefine-function
|
||||||
|
:which-key "undefine the fn at point")
|
||||||
|
"ee" '(slime-eval-last-expression
|
||||||
|
:which-key "evaluate last sexpr")
|
||||||
|
"er" '(slime-eval-region
|
||||||
|
:which-key "evaluate region")
|
||||||
|
|
||||||
|
"gb" '(slime-pop-find-definition-stack
|
||||||
|
:which-key "go back")
|
||||||
|
"gn" '(slime-next-note
|
||||||
|
:which-key "next note")
|
||||||
|
"gN" '(slime-previous-note
|
||||||
|
:which-key "previous note")
|
||||||
|
|
||||||
|
"ha" '(slime-apropos
|
||||||
|
:which-key "SLIME appropos")
|
||||||
|
"hA" '(slime-apropos-all
|
||||||
|
:which-key "SLIME appropos all")
|
||||||
|
"hd" '(slime-disassemble-symbol
|
||||||
|
:which-key "disassemble symbol at point")
|
||||||
|
"hh" '(slime-describe-symbol
|
||||||
|
:which-key "describe symbol at point")
|
||||||
|
"hH" '(slime-hyperspec-lookup
|
||||||
|
:which-key "hyperspec lookup symbol at point")
|
||||||
|
"hi" '(slime-inspect-definition
|
||||||
|
:which-key "inspect defintion")
|
||||||
|
"hp" '(slime-apropos-package
|
||||||
|
:which-key "browse appropos results for package's exported symbols")
|
||||||
|
"ht" '(slime-toggle-trace-definition
|
||||||
|
:which-key "toggle tracing of function at point")
|
||||||
|
"hT" '(slime-untrace-all
|
||||||
|
:which-key "untrace all functions")
|
||||||
|
"h<" '(slime-who-calls
|
||||||
|
:which-key "show all known callers")
|
||||||
|
"h>" '(slime-calls-who
|
||||||
|
:which-key "show all known callees")
|
||||||
|
|
||||||
|
"hr" '(slime-who-references
|
||||||
|
:which-key "show references to global variable")
|
||||||
|
"hm" '(slime-who-macroexpands
|
||||||
|
:which-key "show all usages of a macro")
|
||||||
|
"hs" '(slime-who-specializes
|
||||||
|
:which-key "show all methods specialized on a class")
|
||||||
|
|
||||||
|
"ma" '(slime-macroexpand-all
|
||||||
|
:which-key "macroexpand the expr at point completely")
|
||||||
|
"mo" '(slime-macroexpand-1
|
||||||
|
:which-key "macroexpand the expr at point once")
|
||||||
|
|
||||||
|
"se" '(slime-eval-last-expression-in-repl
|
||||||
|
:which-key "evaluate last sexpr in repl")
|
||||||
|
"si" '(slime
|
||||||
|
:which-key "start an inferior process")
|
||||||
|
"sq" '(slime-quit-lisp
|
||||||
|
:which-key "quit")
|
||||||
|
|
||||||
|
"tf" '(slime-toggle-fancy-trace))
|
||||||
|
|
||||||
;; custom functions
|
;; custom functions
|
||||||
(defun haskell-intero/insert-type ()
|
(defun haskell-intero/insert-type ()
|
||||||
|
@ -522,4 +612,41 @@
|
||||||
(use-package cargo
|
(use-package cargo
|
||||||
:defer t)
|
:defer t)
|
||||||
|
|
||||||
|
(use-package evil-cleverparens
|
||||||
|
:ensure t)
|
||||||
|
|
||||||
|
(use-package parinfer
|
||||||
|
:ensure t
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(setq parinfer-extensions '(defaults
|
||||||
|
pretty-parens
|
||||||
|
evil
|
||||||
|
paredit
|
||||||
|
smart-tab
|
||||||
|
smart-yank)))
|
||||||
|
:hook
|
||||||
|
((emacs-lisp-mode . parinfer-mode)
|
||||||
|
(common-lisp-mode . parinfer-mode)
|
||||||
|
(lisp-mode . parinfer-mode)))
|
||||||
|
|
||||||
|
(use-package slime
|
||||||
|
:commands slime-mode
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(setq slime-contribs '(slime-asdf
|
||||||
|
slime-fancy
|
||||||
|
slime-indentation
|
||||||
|
slime-sbcl-exts
|
||||||
|
slime-scratch)
|
||||||
|
inferior-lisp-program "sbcl")
|
||||||
|
(setq slime-complete-symbol*-fancy t)
|
||||||
|
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
|
||||||
|
(defun slime/disable-smartparens ()
|
||||||
|
(smartparens-strict-mode -1)
|
||||||
|
(turn-off-smartparens-mode))
|
||||||
|
(add-hook 'slime-repl-mode-hook #'slime/disable-smartparens))
|
||||||
|
:config
|
||||||
|
(slime-setup))
|
||||||
|
|
||||||
;;; init.el ends
|
;;; init.el ends
|
||||||
|
|
Loading…
Reference in a new issue