Setup modernisation efforts. Switch to flycheck, evil swiper integration, ripgrep and fzf mimicking neovim config behaviour
This commit is contained in:
parent
5b770758d0
commit
f82787aef8
204
config.org
204
config.org
|
|
@ -561,6 +561,8 @@ Install the package, enable it and ensure that it always is installed, and then
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package evil
|
||||
:ensure t
|
||||
:config
|
||||
(evil-define-key '(normal) 'global "/" (lambda () (interactive) (swiper)))
|
||||
:init
|
||||
(evil-mode 1))
|
||||
#+END_SRC
|
||||
|
|
@ -593,18 +595,21 @@ Install the package, enable it and ensure that it always is installed, and then
|
|||
(use-package which-key
|
||||
:ensure t
|
||||
:init
|
||||
(setq which-key-idle-delay 0)
|
||||
(setq which-key-idle-secondary-delay 0)
|
||||
(which-key-mode))
|
||||
#+END_SRC
|
||||
*** Ivy
|
||||
Ivy is an autocompletion framework, it will automatically fuzzy find search words for you. This includes file managing, searching, and more via its extensibility and the Counsel package.
|
||||
Install the package, enable it and ensure that it always is installed, and then make sure that ivy-mode is enabled by default:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package ivy
|
||||
:ensure t
|
||||
:init
|
||||
(ivy-mode 1)
|
||||
:bind
|
||||
("C-s" . swiper))
|
||||
(use-package ivy
|
||||
:ensure t
|
||||
:init
|
||||
(ivy-mode 1)
|
||||
;; :bind
|
||||
;; ("C-s" . swiper)
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
Ivy Configuration
|
||||
|
|
@ -628,8 +633,81 @@ Install the package, enable it and ensure that it always is installed, and then
|
|||
A collection of Ivy-enhanced versions of common Emacs commands.
|
||||
Install the package, enable it and ensure that it always is installed:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;;(use-package counsel
|
||||
;; :ensure t
|
||||
;; :config
|
||||
;; (counsel-mode))
|
||||
|
||||
;; Taken from https://raw.githubusercontent.com/protesilaos/dotfiles/aa8a5d96b013462cfa622e396e65abb66725318a/emacs/.emacs.d/emacs-init.org
|
||||
;; Thank you Protesilaos Stavrou!
|
||||
(use-package counsel
|
||||
:ensure t)
|
||||
:ensure t
|
||||
:after ivy
|
||||
:custom
|
||||
(counsel-yank-pop-preselect-last t)
|
||||
(counsel-yank-pop-separator "\n—————————\n")
|
||||
(counsel-rg-base-command
|
||||
"rg -SHn --no-heading --color never --no-follow --hidden %s")
|
||||
(counsel-find-file-occur-cmd ; TODO Simplify this
|
||||
"ls -a | grep -i -E '%s' | tr '\\n' '\\0' | xargs -0 ls -d --group-directories-first")
|
||||
:config
|
||||
(defun prot/counsel-fzf-rg-files (&optional input dir)
|
||||
"Run `fzf' in tandem with `ripgrep' to find files in the
|
||||
present directory. Both of those programs are external to
|
||||
Emacs."
|
||||
(interactive)
|
||||
(let ((process-environment
|
||||
(cons (concat "FZF_DEFAULT_COMMAND=rg -Sn --color never --files --no-follow --hidden")
|
||||
process-environment)))
|
||||
(counsel-fzf input dir)))
|
||||
|
||||
(defun prot/counsel-fzf-dir (arg)
|
||||
"Specify root directory for `counsel-fzf'."
|
||||
(prot/counsel-fzf-rg-files ivy-text
|
||||
(read-directory-name
|
||||
(concat (car (split-string counsel-fzf-cmd))
|
||||
" in directory: "))))
|
||||
|
||||
(defun prot/counsel-rg-dir (arg)
|
||||
"Specify root directory for `counsel-rg'."
|
||||
(let ((current-prefix-arg '(4)))
|
||||
(counsel-rg ivy-text nil "")))
|
||||
|
||||
(ivy-add-actions
|
||||
'counsel-fzf
|
||||
'(("r" prot/counsel-fzf-dir "change root directory")
|
||||
("g" prot/counsel-rg-dir "use ripgrep in root directory")))
|
||||
|
||||
(ivy-add-actions
|
||||
'counsel-rg
|
||||
'(("r" prot/counsel-rg-dir "change root directory")
|
||||
("z" prot/counsel-fzf-dir "find files with fzf in root directory")))
|
||||
|
||||
;; Remove commands that only work with key bindings
|
||||
(put 'counsel-find-symbol 'no-counsel-M-x t)
|
||||
:bind (("M-x" . counsel-M-x)
|
||||
("C-x f" . counsel-find-file)
|
||||
("s-f" . counsel-find-file)
|
||||
("s-F" . find-file-other-window)
|
||||
("C-x b" . ivy-switch-buffer)
|
||||
("s-b" . ivy-switch-buffer)
|
||||
("C-x B" . counsel-switch-buffer-other-window)
|
||||
("s-B" . counsel-switch-buffer-other-window)
|
||||
("C-x d" . counsel-dired)
|
||||
("s-d" . counsel-dired)
|
||||
("s-D" . dired-other-window)
|
||||
("C-x C-r" . counsel-recentf)
|
||||
("s-r" . counsel-recentf)
|
||||
("s-y" . counsel-yank-pop)
|
||||
("C-h f" . counsel-describe-function)
|
||||
("C-h v" . counsel-describe-variable)
|
||||
("C-s" . counsel-rg)
|
||||
("M-s g" . counsel-git-grep)
|
||||
("C-x C-f" . prot/counsel-fzf-rg-files)
|
||||
:map ivy-minibuffer-map
|
||||
("C-r" . counsel-minibuffer-history)
|
||||
("s-y" . ivy-next-line) ; Avoid 2× `counsel-yank-pop'
|
||||
("C-SPC" . ivy-restrict-to-matches)))
|
||||
#+END_SRC
|
||||
|
||||
Counsel Support in Projectile.
|
||||
|
|
@ -763,7 +841,24 @@ lua-mode is a major mode for editing Lua sources in Emacs.
|
|||
|
||||
(add-to-list 'auto-mode-alist '("\\.iy\\'" . lua-mode))
|
||||
#+END_SRC
|
||||
** Swift Mode
|
||||
Major-mode for Apple's Swift programming language.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package swift-mode
|
||||
:ensure t)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.swift\\'" . swift-mode))
|
||||
|
||||
;; For LSP
|
||||
;;(use-package lsp-sourcekit
|
||||
;; :after lsp-mode
|
||||
;; :config
|
||||
;; ;;(setq lsp-sourcekit-executable "/ssh:work-laptop:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp")
|
||||
;; (setq lsp-sourcekit-executable "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp")
|
||||
;; )
|
||||
|
||||
#+END_SRC
|
||||
** Snippets
|
||||
YASnippet is a template system for Emacs. It allows you to type an abbreviation and automatically expand it into function templates.
|
||||
|
||||
|
|
@ -819,7 +914,7 @@ A batteries-included Emacs major mode for TSX/JSX files.
|
|||
(jtsx-typescript-mode . hs-minor-mode))
|
||||
:custom
|
||||
;; Optional customizations
|
||||
;; (js-indent-level 2)
|
||||
(js-indent-level 8)
|
||||
;; (typescript-ts-mode-indent-offset 2)
|
||||
;; (jtsx-switch-indent-offset 0)
|
||||
;; (jtsx-indent-statement-block-regarding-standalone-parent nil)
|
||||
|
|
@ -844,7 +939,7 @@ A batteries-included Emacs major mode for TSX/JSX files.
|
|||
(define-key mode-map (kbd "C-c j w") 'jtsx-wrap-in-jsx-element)
|
||||
(define-key mode-map (kbd "C-c j u") 'jtsx-unwrap-jsx)
|
||||
(define-key mode-map (kbd "C-c j d") 'jtsx-delete-jsx-node))
|
||||
|
||||
|
||||
(defun jtsx-bind-keys-to-jtsx-jsx-mode-map ()
|
||||
(jtsx-bind-keys-to-mode-map jtsx-jsx-mode-map))
|
||||
|
||||
|
|
@ -854,7 +949,45 @@ A batteries-included Emacs major mode for TSX/JSX files.
|
|||
(add-hook 'jtsx-jsx-mode-hook 'jtsx-bind-keys-to-jtsx-jsx-mode-map)
|
||||
(add-hook 'jtsx-tsx-mode-hook 'jtsx-bind-keys-to-jtsx-tsx-mode-map))
|
||||
#+END_SRC
|
||||
** LSP Mode
|
||||
** Flycheck
|
||||
Flycheck is a modern version of Flymake, provides error messages
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package flycheck
|
||||
:ensure t
|
||||
:config
|
||||
(add-hook 'after-init-hook #'global-flycheck-mode))
|
||||
|
||||
;; Display errors inline
|
||||
(use-package flycheck-inline
|
||||
:after flycheck
|
||||
:ensure t
|
||||
:config
|
||||
(add-hook 'flycheck-mode-hook #'flycheck-inline-mode))
|
||||
#+END_SRC
|
||||
** LSP
|
||||
*** Eglot Mode
|
||||
Emacs Polyglot is the Emacs LSP client that stays out of your way, built into emacs.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;;(with-eval-after-load 'eglot
|
||||
;; (add-to-list 'eglot-server-programs '(swift-mode . ("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp")))
|
||||
;; )
|
||||
|
||||
(with-eval-after-load 'eglot
|
||||
(add-to-list 'eglot-server-programs
|
||||
'(swift-mode . ("sourcekit-lsp"))))
|
||||
|
||||
;; Ensure eglot is using flycheck
|
||||
(use-package flycheck-eglot
|
||||
:ensure t
|
||||
:after (flycheck eglot)
|
||||
:config
|
||||
(global-flycheck-eglot-mode 1))
|
||||
|
||||
(add-hook 'prog-mode-hook 'eglot-ensure)
|
||||
#+END_SRC
|
||||
*** LSP Mode
|
||||
LSP mode will give you IDE capabilities in Emacs, using Microsoft's
|
||||
Universal Language Server Protocol. The same one that VSCode uses for
|
||||
linting, autocompletion. Etc. Install the package, enable it and
|
||||
|
|
@ -863,8 +996,8 @@ activated on Programming Related Major Modes, and set a keychord for
|
|||
the custom prefix. Please check
|
||||
`https://github.com/emacs-lsp/lsp-mode#installation` for instructions
|
||||
on how to install the Programming Language Servers that you want.
|
||||
*** Lsp Mode
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
**** Lsp Mode
|
||||
+BEGIN_SRC emacs-lisp
|
||||
(use-package lsp-mode
|
||||
:ensure t
|
||||
:hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
|
||||
|
|
@ -875,10 +1008,10 @@ on how to install the Programming Language Servers that you want.
|
|||
|
||||
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
|
||||
(setq lsp-keymap-prefix "C-l")
|
||||
#+END_SRC
|
||||
+END_SRC
|
||||
|
||||
*** Configuration
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
**** Configuration
|
||||
+BEGIN_SRC emacs-lisp
|
||||
;; optionally
|
||||
(use-package lsp-ui
|
||||
:commands lsp-ui-mode
|
||||
|
|
@ -904,14 +1037,23 @@ on how to install the Programming Language Servers that you want.
|
|||
|
||||
;; New luau lsp for roblox implementation
|
||||
(with-eval-after-load 'lsp-mode
|
||||
(defun return-true () t)
|
||||
|
||||
(add-to-list 'lsp-language-id-configuration
|
||||
'(lua-mode . "luau"))
|
||||
|
||||
(lsp-register-client
|
||||
(make-lsp-client :new-connection (lsp-stdio-connection "luau-lsp")
|
||||
:activation-fn (lsp-activate-on "luau")
|
||||
:server-id 'luau-lsp)))
|
||||
#+END_SRC
|
||||
:server-id 'luau-lsp))
|
||||
|
||||
(lsp-register-client
|
||||
(make-lsp-client :new-connection (lsp-tramp-connection "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp" 'return-true)
|
||||
:major-modes '(swift-mode)
|
||||
:remote? t
|
||||
:server-id 'sourcekit-lsp-tramp))
|
||||
)
|
||||
+END_SRC
|
||||
|
||||
** Edwina Dynamic Tiling
|
||||
Edwina is a dynamic window manager for Emacs. It automatically arranges your Emacs panes (called “windows” in Emacs parlance) into predefined layouts, dwm-style.
|
||||
|
|
@ -958,6 +1100,7 @@ Install the package, enable it and ensure that it always is installed, and then
|
|||
(start-process-shell-command "udiskie" nil "udiskie")
|
||||
(start-process-shell-command "dunst" nil "dunst")
|
||||
(start-process-shell-command "qpwgraph" nil "qpwgraph")
|
||||
(start-process-shell-command "kdeconnect-indicator" nil "kdeconnect-indicator")
|
||||
|
||||
;; Systemtray
|
||||
(require 'exwm-systemtray)
|
||||
|
|
@ -1131,9 +1274,32 @@ A better terminal
|
|||
(use-package vterm
|
||||
:ensure t)
|
||||
#+END_SRC
|
||||
** Libvterm
|
||||
A better terminal
|
||||
** Sudo Edit
|
||||
Allows you to edit files as root via running sudo-edit
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package sudo-edit
|
||||
:ensure t)
|
||||
#+END_SRC
|
||||
** Eshell
|
||||
*** Zoxide
|
||||
Zoxide Z like functionality, better cd inside eshell
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package eshell-z
|
||||
:init
|
||||
(add-hook 'eshell-mode-hook
|
||||
(defun my-eshell-mode-hook ()
|
||||
(require 'eshell-z)))
|
||||
:ensure t)
|
||||
#+END_SRC
|
||||
|
||||
** Default Shell
|
||||
Set the default shell used to run commands.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq shell-file-name "/bin/sh")
|
||||
#+END_SRC
|
||||
|
||||
** TRAMP
|
||||
TRAMP edit files over SSH configuration
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setopt tramp-remote-path '(tramp-own-remote-path))
|
||||
#+END_SRC
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
alias cd z $1
|
||||
2
init.el
2
init.el
|
|
@ -55,7 +55,7 @@
|
|||
'(jdee-db-spec-breakpoint-face-colors (cons "#030100" "#100e0d"))
|
||||
'(objed-cursor-color "#874804")
|
||||
'(package-selected-packages
|
||||
'(ranger omnisharp csharp-mode bug-hunter ewal-doom-themes ewal-evil-cursors ewal-spacemacs-themes ewal org-bullets company flyspell-correct-ivy evil ivy which-key use-package))
|
||||
'(lsp-sourcekit ranger omnisharp csharp-mode bug-hunter ewal-doom-themes ewal-evil-cursors ewal-spacemacs-themes ewal org-bullets company flyspell-correct-ivy evil ivy which-key use-package))
|
||||
'(pdf-view-midnight-colors '("#655370" . "#fbf8ef"))
|
||||
'(rustic-ansi-faces
|
||||
["#040201" "#874804" "#813c07" "#a45101" "#A76A19" "#D76C03" "#F09010" "#e8c99f"])
|
||||
|
|
|
|||
Loading…
Reference in New Issue