Trying to configure lsp-mode on Emacs
This commit is contained in:
parent
a12166d64b
commit
7233ec4d48
8 changed files with 196 additions and 7 deletions
|
@ -5,6 +5,7 @@
|
|||
home.packages = with pkgs; [
|
||||
nixpkgs-fmt
|
||||
rnix-lsp
|
||||
ack
|
||||
ranger
|
||||
calibre
|
||||
element-desktop
|
||||
|
|
|
@ -22,14 +22,22 @@
|
|||
use-package
|
||||
evil
|
||||
evil-collection
|
||||
helm
|
||||
projectile
|
||||
magit
|
||||
fira-code-mode
|
||||
format-all
|
||||
nix-mode
|
||||
lispy
|
||||
lsp-mode
|
||||
dap-mode
|
||||
which-key
|
||||
treemacs
|
||||
treemacs-evil
|
||||
treemacs-projectile
|
||||
treemacs-icons-dired
|
||||
treemacs-magit
|
||||
treemacs-persp
|
||||
]
|
||||
) ++ (
|
||||
with epkgs.elpaPackages; [
|
||||
|
|
38
users/profiles/emacs/emacs.d/config/config-helm.el
Normal file
38
users/profiles/emacs/emacs.d/config/config-helm.el
Normal file
|
@ -0,0 +1,38 @@
|
|||
(use-package helm
|
||||
:init
|
||||
(progn
|
||||
(require 'helm-config)
|
||||
(setq helm-autoresize-max-height 0)
|
||||
(setq helm-autoresize-min-height 20)
|
||||
(global-set-key (kbd "C-c h") 'helm-command-prefix)
|
||||
(global-unset-key (kbd "C-x c"))
|
||||
|
||||
(when (executable-find "ack")
|
||||
(setq helm-grep-default-command "ack -Hn --no-group --no-color %e %p %f"
|
||||
helm-grep-default-recurse-command "ack -H --no-group --no-color %e %p %f"))
|
||||
|
||||
(setq helm-semantic-fuzzy-match t
|
||||
helm-imenu-fuzzy-match t
|
||||
helm-M-x-fuzzy-match t ;; optional fuzzy matching for helm-M-x
|
||||
helm-buffers-fuzzy-matching t
|
||||
helm-recentf-fuzzy-match t
|
||||
helm-split-window-in-side-p t
|
||||
helm-buffer-max-length nil)
|
||||
|
||||
(helm-mode 1)
|
||||
(helm-autoresize-mode 1))
|
||||
|
||||
:bind
|
||||
(("C-c h" . helm-command-prefix)
|
||||
:map helm-command-map
|
||||
("b" . helm-buffers-list)
|
||||
("f" . helm-find-files)
|
||||
("m" . helm-mini)
|
||||
("o" . helm-imenu))
|
||||
:bind
|
||||
(("M-x" . helm-M-x)
|
||||
("M-y" . helm-show-kill-ring)
|
||||
("C-x b" . helm-mini)
|
||||
("C-x C-f" . helm-find-files)))
|
||||
|
||||
(provide 'config-helm)
|
|
@ -1,3 +1,8 @@
|
|||
(defun my-lsp-format-buffer ()
|
||||
(if (eq major-mode 'nix-mode)
|
||||
(lsp-format-buffer)))
|
||||
|
||||
|
||||
(use-package lsp-mode
|
||||
:init
|
||||
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
|
||||
|
@ -6,6 +11,7 @@
|
|||
(nix-mode . lsp)
|
||||
;; if you want which-key integration
|
||||
(lsp-mode . lsp-enable-which-key-integration))
|
||||
(before-save . my-lsp-format-buffer)
|
||||
:commands lsp)
|
||||
|
||||
;; optionally
|
||||
|
@ -23,4 +29,4 @@
|
|||
:config
|
||||
(which-key-mode))
|
||||
|
||||
(provide 'lsp)
|
||||
(provide 'config-lsp)
|
9
users/profiles/emacs/emacs.d/config/config-projectile.el
Normal file
9
users/profiles/emacs/emacs.d/config/config-projectile.el
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
(use-package projectile
|
||||
:init
|
||||
(projectile-mode +1)
|
||||
:bind (:map projectile-mode-map
|
||||
("s-p" . projectile-command-map)
|
||||
("C-c p" . projectile-command-map)))
|
||||
|
||||
(provide 'config-projectile)
|
103
users/profiles/emacs/emacs.d/config/config-treemacs.el
Normal file
103
users/profiles/emacs/emacs.d/config/config-treemacs.el
Normal file
|
@ -0,0 +1,103 @@
|
|||
(use-package treemacs
|
||||
:ensure t
|
||||
:defer t
|
||||
:init
|
||||
(with-eval-after-load 'winum
|
||||
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
|
||||
:config
|
||||
(progn
|
||||
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
|
||||
treemacs-deferred-git-apply-delay 0.5
|
||||
treemacs-directory-name-transformer #'identity
|
||||
treemacs-display-in-side-window t
|
||||
treemacs-eldoc-display t
|
||||
treemacs-file-event-delay 5000
|
||||
treemacs-file-extension-regex treemacs-last-period-regex-value
|
||||
treemacs-file-follow-delay 0.2
|
||||
treemacs-file-name-transformer #'identity
|
||||
treemacs-follow-after-init t
|
||||
treemacs-expand-after-init t
|
||||
treemacs-git-command-pipe ""
|
||||
treemacs-goto-tag-strategy 'refetch-index
|
||||
treemacs-indentation 2
|
||||
treemacs-indentation-string " "
|
||||
treemacs-is-never-other-window nil
|
||||
treemacs-max-git-entries 5000
|
||||
treemacs-missing-project-action 'ask
|
||||
treemacs-move-forward-on-expand nil
|
||||
treemacs-no-png-images nil
|
||||
treemacs-no-delete-other-windows t
|
||||
treemacs-project-follow-cleanup nil
|
||||
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
|
||||
treemacs-position 'left
|
||||
treemacs-read-string-input 'from-child-frame
|
||||
treemacs-recenter-distance 0.1
|
||||
treemacs-recenter-after-file-follow nil
|
||||
treemacs-recenter-after-tag-follow nil
|
||||
treemacs-recenter-after-project-jump 'always
|
||||
treemacs-recenter-after-project-expand 'on-distance
|
||||
treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
|
||||
treemacs-show-cursor nil
|
||||
treemacs-show-hidden-files t
|
||||
treemacs-silent-filewatch nil
|
||||
treemacs-silent-refresh nil
|
||||
treemacs-sorting 'alphabetic-asc
|
||||
treemacs-select-when-already-in-treemacs 'move-back
|
||||
treemacs-space-between-root-nodes t
|
||||
treemacs-tag-follow-cleanup t
|
||||
treemacs-tag-follow-delay 1.5
|
||||
treemacs-text-scale nil
|
||||
treemacs-user-mode-line-format nil
|
||||
treemacs-user-header-line-format nil
|
||||
treemacs-width 35
|
||||
treemacs-width-is-initially-locked t
|
||||
treemacs-workspace-switch-cleanup nil)
|
||||
|
||||
;; The default width and height of the icons is 22 pixels. If you are
|
||||
;; using a Hi-DPI display, uncomment this to double the icon size.
|
||||
;;(treemacs-resize-icons 44)
|
||||
|
||||
(treemacs-follow-mode t)
|
||||
(treemacs-filewatch-mode t)
|
||||
(treemacs-fringe-indicator-mode 'always)
|
||||
|
||||
(pcase (cons (not (null (executable-find "git")))
|
||||
(not (null treemacs-python-executable)))
|
||||
(`(t . t)
|
||||
(treemacs-git-mode 'deferred))
|
||||
(`(t . _)
|
||||
(treemacs-git-mode 'simple)))
|
||||
|
||||
(treemacs-hide-gitignored-files-mode nil))
|
||||
:bind
|
||||
(:map global-map
|
||||
("M-0" . treemacs-select-window)
|
||||
("C-x t 1" . treemacs-delete-other-windows)
|
||||
("C-x t t" . treemacs)
|
||||
("C-x t B" . treemacs-bookmark)
|
||||
("C-x t C-t" . treemacs-find-file)
|
||||
("C-x t M-t" . treemacs-find-tag)))
|
||||
|
||||
(use-package treemacs-evil
|
||||
:after (treemacs evil)
|
||||
:ensure t)
|
||||
|
||||
(use-package treemacs-projectile
|
||||
:after (treemacs projectile)
|
||||
:ensure t)
|
||||
|
||||
(use-package treemacs-icons-dired
|
||||
:after (treemacs dired)
|
||||
:ensure t
|
||||
:config (treemacs-icons-dired-mode))
|
||||
|
||||
(use-package treemacs-magit
|
||||
:after (treemacs magit)
|
||||
:ensure t)
|
||||
|
||||
(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
|
||||
:after (treemacs persp-mode) ;;or perspective vs. persp-mode
|
||||
:ensure t
|
||||
:config (treemacs-set-scope-type 'Perspectives))
|
||||
|
||||
(provide 'config-treemacs)
|
|
@ -1,10 +1,11 @@
|
|||
(add-to-list 'load-path "~/.emacs.d/config")
|
||||
|
||||
(setq gc-cons-threshold 100000000
|
||||
read-process-output-max (* 1024 1024)
|
||||
)
|
||||
read-process-output-max (* 1024 1024))
|
||||
|
||||
(require 'aesthetics)
|
||||
(require 'config-evil)
|
||||
(require 'lsp)
|
||||
(require 'config-helm)
|
||||
(require 'config-treemacs)
|
||||
(require 'config-lsp)
|
||||
(require 'nix)
|
|
@ -3,9 +3,32 @@
|
|||
gtk = {
|
||||
enable = true;
|
||||
font.name = "DejaVu Sans";
|
||||
iconTheme = {
|
||||
name = "Adwaita";
|
||||
package = pkgs.gnome.adwaita-icon-theme;
|
||||
theme = {
|
||||
name = "WhiteSur-dark-alt-blue";
|
||||
package = pkgs.whitesur-gtk-theme;
|
||||
};
|
||||
iconTheme = {
|
||||
#name = "Adwaita";
|
||||
#package = pkgs.gnome.adwaita-icon-theme;
|
||||
name = "WhiteSur";
|
||||
package = pkgs.whitesur-icon-theme;
|
||||
};
|
||||
};
|
||||
home.file.".icons/default" = {
|
||||
recursive = true;
|
||||
source = let
|
||||
drv = pkgs.stdenv.mkDerivation {
|
||||
name = "apple-cursor";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/ful1e5/apple_cursor/releases/download/v1.2.0/macOSBigSur.tar.gz";
|
||||
sha256 = "sha256-8QNd8EEf11MIBVUbgZy6U1ZnDIWj92EGQmKLR8Edqfw=";
|
||||
};
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
mv * $out/
|
||||
'';
|
||||
};
|
||||
in
|
||||
"${drv}/";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue