From 582dd92fffe3824b48a5c2bfb91f4549741f7902 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Tue, 6 Dec 2022 22:25:03 +0400 Subject: [PATCH] Improvements to IdeaVim and Emacs init --- .emacs.bankruptcy/init.org | 182 +++++++++++++++++++++++------------ .ideavimrc | 190 +++++++++++++++++++------------------ 2 files changed, 218 insertions(+), 154 deletions(-) diff --git a/.emacs.bankruptcy/init.org b/.emacs.bankruptcy/init.org index 020fb1a..808a4db 100644 --- a/.emacs.bankruptcy/init.org +++ b/.emacs.bankruptcy/init.org @@ -5,7 +5,6 @@ #+TOC: true ** Early Init - *** Garbage Collection The default Garbage Collector is triggered at 800 KB, way too conservative, let's bump to 512 MB. @@ -129,6 +128,7 @@ need to benchmark slow init times later. ;; (setq confirm-kill-emacs 'y-or-n-p) (require 'recentf) +(recentf-mode t) (setq recentf-auto-cleanup 'never) (setq recentf-keep '(file-remote-p file-readable-p)) @@ -165,10 +165,10 @@ I don't even know how you resume from GUI mode, we'll find a use for this keybin Use Dashboard.el. First load `all-the-icons` for nicer rendering #+begin_src emacs-lisp -(straight-use-package 'all-the-icons) +;; (straight-use-package 'all-the-icons) (straight-use-package 'dashboard) +(require 'dashboard) (dashboard-setup-startup-hook) - (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) (setq dashboard-items '((recents . 8) (bookmarks . 8))) @@ -177,7 +177,9 @@ Use Dashboard.el. First load `all-the-icons` for nicer rendering (setq dashboard-set-file-icons t) (setq dashboard-set-navigator t) (setq dashboard-set-heading-icons t) -(add-hook 'dashboard-mode-hook (lambda () (setq-local line-spacing 12))) +(add-hook 'dashboard-mode-hook (lambda () + (setq-local line-spacing 12) + (dashboard-jump-to-recents))) #+end_src *** Olivetti @@ -349,50 +351,6 @@ Emacs is an great operating system, if only it had a good text editor... (evil-set-leader nil (kbd "C-SPC")) (evil-set-leader 'normal (kbd "SPC")) -(evil-define-key 'normal 'global - (kbd "w") 'save-buffer - (kbd "q") 'kill-buffer-and-window - (kbd "k") 'kill-this-buffer - (kbd "h") 'help-command - (kbd "hf") 'helpful-callable - (kbd "hv") 'helpful-variable - (kbd "hk") 'helpful-key - (kbd "ho") 'helpful-symbol - (kbd "hg") 'helpful-at-point - (kbd "fb") 'bookmark-jump - (kbd "fr") 'consult-recent-file - (kbd "ff") 'project-find-file - (kbd "fi") 'joe/edit-init - (kbd "bl") 'mode-line-other-buffer - (kbd "ba") 'consult-buffer - (kbd "bb") 'consult-project-buffer - (kbd "bi") 'ibuffer - (kbd "bm") 'joe/toggle-buffer-mode - (kbd "br") 'joe/revert-buffer-no-confirm - (kbd "gg") 'magit-status - (kbd "gc") 'magit-clone - (kbd "ss") 'joe/vterm-here - (kbd "sv") 'vterm - (kbd "tv") 'vterm-other-window - (kbd "Ba") 'joe/bookmark-set-and-save - (kbd "Bd") 'bookmark-delete - (kbd "mr") 'joe/compile-run - (kbd "mc") 'joe/compile-comp - (kbd "ct") 'consult-theme - (kbd "cl") 'consult-line - (kbd "ci") 'consult-imenu - (kbd "cy") 'consult-yank-from-kill-ring - (kbd "cg") 'consult-ripgrep - (kbd "cF") 'consult-find - (kbd "co") 'consult-outline - (kbd "C-h") 'evil-window-left - (kbd "C-j") 'evil-window-down - (kbd "C-k") 'evil-window-up - (kbd "C-l") 'evil-window-right - (kbd "tn") 'tab-new - (kbd "tc") 'tab-close - (kbd "tr") 'tab-rename) - (evil-define-key 'normal 'global (kbd "q") 'avy-goto-word-0) (evil-define-key 'normal 'global (kbd "M-1") '(lambda () (interactive) (tab-bar-select-tab 1))) @@ -444,6 +402,52 @@ Emacs is an great operating system, if only it had a good text editor... (setq evil-goggles-duration 0.075) (setq evil-goggles-pulse t) (setq evil-goggles-async-duration 0.55) + +(add-hook 'emacs-startup-hook (lambda () +(evil-define-key 'normal 'global + (kbd "w") 'save-buffer + (kbd "q") 'kill-buffer-and-window + (kbd "k") 'kill-this-buffer + (kbd "h") 'help-command + (kbd "hf") 'helpful-callable + (kbd "hv") 'helpful-variable + (kbd "hk") 'helpful-key + (kbd "ho") 'helpful-symbol + (kbd "hg") 'helpful-at-point + (kbd "fb") 'bookmark-jump + (kbd "fr") 'consult-recent-file + (kbd "ff") 'project-find-file + (kbd "fi") 'joe/edit-init + (kbd "bl") 'mode-line-other-buffer + (kbd "ba") 'consult-buffer + (kbd "bb") 'consult-project-buffer + (kbd "bi") 'ibuffer + (kbd "bm") 'joe/toggle-buffer-mode + (kbd "br") 'joe/revert-buffer-no-confirm + (kbd "gg") 'magit-status + (kbd "gc") 'magit-clone + (kbd "ss") 'joe/vterm-here + (kbd "sv") 'vterm + (kbd "tv") 'vterm-other-window + (kbd "Ba") 'joe/bookmark-set-and-save + (kbd "Bd") 'bookmark-delete + (kbd "mr") 'joe/compile-run + (kbd "mc") 'joe/compile-comp + (kbd "ct") 'consult-theme + (kbd "cl") 'consult-line + (kbd "ci") 'consult-imenu + (kbd "cy") 'consult-yank-from-kill-ring + (kbd "cg") 'consult-ripgrep + (kbd "cF") 'consult-find + (kbd "co") 'consult-outline + (kbd "C-h") 'evil-window-left + (kbd "C-j") 'evil-window-down + (kbd "C-k") 'evil-window-up + (kbd "C-l") 'evil-window-right + (kbd "tn") 'tab-new + (kbd "tc") 'tab-close + (kbd "tr") 'tab-rename))) + #+end_src ** Buffers #+begin_src emacs-lisp @@ -941,11 +945,56 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i #+begin_src emacs-lisp ;; (straight-use-package 'yasnippet) (straight-use-package 'markdown-mode) +;; (straight-use-package 'posframe) +;; (straight-use-package '(lsp-bridge +;; :type git +;; :host github +;; :repo "manateelazycat/lsp-bridge" +;; :files (:defaults "*.py" "core/*" "langserver/*")));; (straight-use-package 'lsp-mode) + + +;; (straight-use-package +;; '(acm-terminal :type git :host github :repo "twlz0ne/acm-terminal")) +;; (straight-use-package +;; '(popon :type git :repo "https://codeberg.org/akib/emacs-popon.git")) + + ;; (straight-use-package 'lsp-mode) ;; (straight-use-package 'lsp-ui) +(evil-global-set-key 'normal (kbd "M-e") #'flymake-goto-next-error) +(evil-global-set-key 'normal (kbd "M-S-e") #'flymake-goto-prev-error) +;; (setq lsp-ui-peek-always-show t) +;; (setq lsp-ui-sideline-show-hover t) +;; (setq lsp-ui-doc-enable t) +;; (setq lsp-rust-analyzer-server-display-inlay-hints t) +;; (setq lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial") +;; (setq lsp-rust-analyzer-display-chaining-hints t) +;; (setq lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names nil) +;; (setq lsp-rust-analyzer-display-closure-return-type-hints t) +;; (setq lsp-rust-analyzer-display-parameter-hints t) +;; (setq lsp-rust-analyzer-display-reborrow-hints t) +;; (setq lsp-rust-analyzer-cargo-watch-command "clippy") +;; (setq lsp-eldoc-render-all t) +;; (setq lsp-eldoc-enable-hover nil) +;; (setq lsp-idle-delay 0.2) +;; (straight-use-package 'eglot) +;; (setq eldoc-echo-area-use-multiline-p t) +;; (setq eldoc-echo-area-prefer-doc-buffer t) +;; (setq eldoc-idle-delay 0.1) +;; (setq lsp-eldoc-render-all nil) ;; (setq lsp-keymap-prefix "C-c c") +;; (setq eldoc-documentation-strategy ) + +;; (defun joe/eldoc-display-docs (interactive) +;; (interactive (list t)) +;; (with-current-buffer eldoc--doc-buffer +;; (let ((s (buffer-string))) +;; (with-current-buffer (generate-new-buffer "*persisted eldoc*") +;; (insert s) +;; (display-buffer (current-buffer)))))) + ;; (require 'lsp) ;; (lsp-enable-which-key-integration t) ;; (straight-use-package 'eglot) @@ -957,20 +1006,23 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i ;; (add-to-list 'completion-at-point-functions #'cape-symbol) ;; (add-to-list 'completion-at-point-functions #'cape-file) ;; (add-to-list 'completion-at-point-functions #'cape-dabbrev) -(straight-use-package 'kind-icon) +;; (straight-use-package 'kind-icon) ;; (require 'kind-icon) ;; (setq completion-in-region-function #'consult-completion-in-region) ;; (setq completion-in-region-function (kind-icon-enhance-completion completion-in-region-function)) -(setq completion-in-region-function - (kind-icon-enhance-completion - (lambda (&rest args) - (let ((marginalia-classifiers nil)) - (apply #'consult-completion-in-region args))))) +;; (setq completion-in-region-function +;; (kind-icon-enhance-completion +;; (lambda (&rest args) +;; (let ((marginalia-classifiers nil)) +;; (apply #'consult-completion-in-region args))))) (straight-use-package 'company) (require 'company) -;; (setq company-transformers '()) +(setq company-minimum-prefix-length 1) +(setq company-tooltip-align-annotations t) + (setq company-minimum-prefix-length 1) +(setq company-transformers '()) (add-to-list 'completion-at-point-functions #'elisp-completion-at-point) (with-eval-after-load 'company @@ -983,7 +1035,7 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i (define-key company-active-map (kbd "") (lambda () (interactive) (company-complete-common-or-cycle -1))) (setq company-idle-delay 0.15 - company-tooltip-idle-delay 20 + company-tooltip-idle-delay 0.5 company-require-match nil company-frontends '(company-preview-frontend company-echo-metadata-frontend) ;; company-frontends @@ -1063,9 +1115,6 @@ it doesn't close it. (popper-close-latest)))))) (add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err) -(global-set-key (kbd "C-c e n") #'flymake-goto-next-error) -(global-set-key (kbd "C-c e p") #'flymake-goto-prev-error) - #+end_src *** Go @@ -1073,7 +1122,7 @@ it doesn't close it. (straight-use-package 'go-mode) ;; (straight-use-package 'go-imports) #+end_src -** FSharp +*** FSharp #+begin_src emacs-lisp ;; (straight-use-package 'eglot) (straight-use-package 'fsharp-mode) @@ -1083,8 +1132,21 @@ it doesn't close it. *** Rust #+begin_src emacs-lisp (straight-use-package 'rust-mode) +(straight-use-package 'rustic) +(straight-use-package 'parsec) ;; Required by evcxr-mode +(straight-use-package + '(evcxr + :type git + :host github + :repo "serialdev/evcxr-mode" + :config + (add-hook 'rust-mode-hook #'evcxr-minor-mode))) ;; (straight-use-package 'flycheck) #+end_src +*** Json +#+begin_src emacs-lisp +(straight-use-package 'json) +#+end_src ** Magit The best git porcelain/client I've ever used. Also kill stray magit buffers left over as explained [[https://manueluberti.eu/emacs/2018/02/17/magit-bury-buffer/][here]] diff --git a/.ideavimrc b/.ideavimrc index 8af8de0..3af7940 100755 --- a/.ideavimrc +++ b/.ideavimrc @@ -1,130 +1,132 @@ let mapleader = " " +set so=3 set incsearch -set hlsearch set clipboard+=unnamed set number set relativenumber -set surround -set multiple-cursors -set ideajoin +"" set idearefactormode=visual set idearefactormode=visual set ignorecase set commentary -set NERDTree set highlightedyank +set NERDTree +set ideajoin +set surround +set multiple-cursors " TODO Find bindings for these -" nnoremap rc :action ChooseRcnConfiguration -" nnoremap ;b :action ToggleLineBreakpoint -" nnoremap ;e :action EvaluateExpression -" nnoremap ;d :action Debug -" nnoremap ;r :action Resume -" nnoremap ;s :action StepInto -" nnoremap ;n :action StepOver +" map rc :action ChooseRcnConfiguration +" map ;b :action ToggleLineBreakpoint +" map ;e :action EvaluateExpression +" map ;d :action Debug +" map ;r :action Resume +" map ;s :action StepInto +" map ;n :action StepOver " nmap :action **** Repeat last command " Find out about VCS tool " We need to get good bindings for window navigation " IDE has nice search behavior, consider adding these " map / :action Find -" nnoremap n :action FindNext -" nnoremap N :action FindPrevious +" map n :action FindNext +" map N :action FindPrevious " vnoremap n :action FindNext " vnoremap N :action FindPrevious -" nnoremap * :action FindWordAtCaret -" nnoremap # :action FindWordAtCaret +" map * :action FindWordAtCaret +" map # :action FindWordAtCaret -nnoremap f :action FindInPath +map ' ` +map Y y$ +map $ g_ +map vv ^vg_ +vnoremap < >gv +map gt (GotoTypeDeclaration) -nnoremap :action EditorIncreaseFontSize -nnoremap :action EditorDecreaseFontSize -nnoremap :action EditorResetFontSize +map f (FindInPath) +map (ToggleDistractionFreeMode) +map (EditorIncreaseFontSize) +map (EditorDecreaseFontSize) +map (EditorResetFontSize) -nnoremap ) :action MethodDown -nnoremap ( :action MethodUp +map ) (MethodDown) +map ( (MethodUp) -nnoremap \ q -nnoremap q :action KJumpAction.Word0 +map \ q +map q (KJumpAction.Word0) -noremap rl :source ~/.ideavimrc -noremap i :e ~/.ideavimrc +map i :e ~/.ideavimrc -nnoremap p :action SearchEverywhere -nnoremap c :action GotoClass -nnoremap t :action FileStructurePopup -nnoremap f :action GotoFile -nnoremap r :action RecentFiles -nnoremap u :action GotoTest +map p (SearchEverywhere) +map c (GotoClass) +map s (FileStructurePopup) +map f (GotoFile) +map r (RecentFiles) +map (GotoAction) +" map u (GotoTest) -nnoremap zd :action CollapseDocComments -nnoremap zD :action ExpandDocComments +map zd (CollapseDocComments) +map zD (ExpandDocComments) -nnoremap H :action MoveEditorToOppositeTabGroup -nnoremap L :action MoveEditorToOppositeTabGroup -nnoremap 2 -nnoremap 2 +map H (MoveEditorToOppositeTabGroup) +map L (MoveEditorToOppositeTabGroup) +noremap 2 +noremap 2 -nnoremap gt :action GotoTypeDeclaration -nnoremap h :action HideAllWindows -nnoremap q :action CloseContent -nnoremap d :action QuickImplementations -nnoremap t :action QuickJavaDoc -nnoremap e :action ShowErrorDescription -nnoremap u :action FindUsages -nnoremap rn :action RenameElement -nnoremap c :action ChangeColorScheme -nnoremap ; :actionlist -nnoremap bb :action BuildCurrentProject -nnoremap br :action Run -nnoremap bc :action RunClass -nnoremap bd :action Debug -nnoremap bs :action BuildSolutionAction +map h (HideAllWindows) +map q (CloseContent) +map d (QuickImplementations) +map t (QuickJavaDoc) +map e (ShowErrorDescription) +map u (FindUsages) +map rn (RenameElement) +map c (ChangeColorScheme) +map bb (BuildCurrentProject) +map br (Run) +map bc (RunClass) +map bd (Debug) +map bs (BuildSolutionAction) +map ; :actionlist -vnoremap gq :action aligncarets.AlignAction -nnoremap w :action SaveDocument -nnoremap or :action ManageRecentProjects +map w (SaveDocument) +map or (ManageRecentProjects) -noremap - :action LocateInSolutionView +" noremap - (LocateInSolutionView) noremap - :action SelectInProjectView -noremap = :action ReformatCode -vnoremap = :action ReformatCode -nnoremap / :nohlsearch -nnoremap g/ :action Find -nnoremap :action GotoAction +map = (ReformatCode) +" vnoremap = (ReformatCode) +map / :nohlsearch +map g/ (Find) -" So we jump to both line and column for marks -nnoremap ' ` -nnoremap Y y$ -nnoremap $ g_ -nnoremap vv ^vg_ -nnoremap g; :action JumpToLastChange -nnoremap g, :action JumpToNextChange +map g; (JumpToLastChange) +map g, (JumpToNextChange) -nnoremap :action GoToTab1 -nnoremap :action GoToTab2 -nnoremap :action GoToTab3 -nnoremap :action GoToTab4 -nnoremap :action GoToTab5 -nnoremap :action GoToTab6 -nnoremap :action GoToTab7 -nnoremap :action GoToTab8 -nnoremap :action GoToTab9 +map (GoToTab1) +map (GoToTab2) +map (GoToTab3) +map (GoToTab4) +map (GoToTab5) +map (GoToTab6) +map (GoToTab7) +map (GoToTab8) +map (GoToTab9) -nnoremap :action MoveLineDown -nnoremap :action MoveLineUp -nnoremap h -nnoremap l -noremap :action SurroundWithLiveTemplate +map (MoveLineDown) +map (MoveLineUp) +map h +map l +map j +map k +map (SurroundWithLiveTemplate) -nnoremap :action EditorCloneCaretBelow -nnoremap :action EditorCloneCaretAbove -nnoremap A; -inoremap A; -" nnoremap :action ToggleDistractionFreeMode -" nnoremap :action ToggleFullScreen -nnoremap :action GotoNextError -nnoremap :action GotoPreviousError -nnoremap moo'o -nnoremap moO'o -nnoremap :action ParameterNameHints +map (EditorCloneCaretBelow) +map (EditorCloneCaretAbove) +map A; +map A, +imap A; +map (GotoNextError) +map (GotoPreviousError) +map moo'o +map moO'o +map (ParameterNameHints)