Skip to content

Commit

Permalink
configure ibuffer and dired sidebars
Browse files Browse the repository at this point in the history
  • Loading branch information
mcraveiro committed Mar 1, 2024
1 parent a12ceb0 commit c7c8888
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 129 deletions.
149 changes: 22 additions & 127 deletions config/features.org
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ surrounded by word boundaries."

;; always delete and copy recursively
(require 'dired)
(setq dired-recursive-deletes 'always)
(setq dired-recursive-copies 'always)
(setq dired-recursive-deletes 'always
dired-recursive-copies 'always)

;; if there is a dired buffer displayed in the next window, use its
;; current subdir, instead of the current subdir of this dired buffer
Expand All @@ -107,6 +107,9 @@ surrounded by word boundaries."
;; enable some really cool extensions like C-x C-j(dired-jump)
(require 'dired-x)

(use-package vscode-icon
:commands (vscode-icon-for-file))

(use-package dired-sidebar
:commands (dired-sidebar-toggle-sidebar)
:init
Expand All @@ -117,10 +120,12 @@ surrounded by word boundaries."
:config
(push 'toggle-window-split dired-sidebar-toggle-hidden-commands)
(push 'rotate-windows dired-sidebar-toggle-hidden-commands)
(setq dired-sidebar-subtree-line-prefix "__"
dired-sidebar-theme 'vscode
(setq dired-sidebar-theme 'icons
dired-sidebar-should-follow-file t
dired-sidebar-use-term-integration t
dired-sidebar-use-custom-font t
;; dired-sidebar-face `(:family "Helvetica" :height 80)
dired-sidebar-face `(:height 0.6 :family "Source Code Pro")
dired-sidebar-width 45))
#+end_src

Expand Down Expand Up @@ -337,6 +342,19 @@ surrounded by word boundaries."
(name . "^Treemacs Update")
(name . "^\\*nnimap imap.")))
)))))


(use-package ibuffer-sidebar
:commands (ibuffer-sidebar-toggle-sidebar)
:config
(setq ibuffer-sidebar-use-custom-font t
ibuffer-sidebar-face `(:family "Source Code Pro" :height 0.8)))

(defun cunene/sidebar-toggle ()
"Toggle both `dired-sidebar' and `ibuffer-sidebar'."
(interactive)
(dired-sidebar-toggle-sidebar)
(ibuffer-sidebar-toggle-sidebar))
#+end_src

** Buffers and Windows
Expand Down Expand Up @@ -785,129 +803,6 @@ ARGUMENT determines the visible heading."
(setq org-duration-format (quote h:mm)))
#+end_src

* Treemacs

Issues:

- [[https://github.com/Alexander-Miller/treemacs/issues/846][#846: treemacs dired: unwanted indentation for directories]]

#+begin_src emacs-lisp
(use-package treemacs
: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.5
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 (cunene/cache-concat"treemacs/treemacs-persist")
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow t
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-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-width 45
treemacs-width-is-initially-locked t
treemacs-text-scale -2
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-tag-follow-mode nil)
(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))

(use-package treemacs-all-the-icons)
(treemacs-load-theme "all-the-icons")

(defun cunene/setup-tab-width-treemacs-dired (&rest _)
"Set `tab-width' to 1, so tab characters don't ruin formatting."
(setq tab-width 1))

(add-hook 'treemacs-mode-hook #'cunene/setup-tab-width-treemacs-dired)

(add-hook 'dired-mode-hook
(lambda ()
(setq-local tab-width 1)))
#+end_src

* Completion

#+begin_src emacs-lisp
Expand Down
6 changes: 6 additions & 0 deletions config/quality_of_life.org
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ Links:

#+begin_src emacs-lisp
(use-package all-the-icons)
(use-package all-the-icons-dired)
(use-package all-the-icons-completion)
(use-package all-the-icons-ibuffer)
(use-package all-the-icons-nerd-fonts)
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)

(use-package doom-modeline
:hook (after-init . doom-modeline-mode)
:config
Expand Down
5 changes: 3 additions & 2 deletions custom.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(dired-sidebar inf-clojure clojure-mode dockerfile-mode terraform-mode protobuf-mode csproj-mode sharper imenu-list ztree yasnippet-snippets yaml-mode windswap which-key volatile-highlights vertico verb undo-tree treemacs-projectile treemacs-persp treemacs-magit treemacs-icons-dired treemacs-evil treemacs-all-the-icons super-save ssh sql-clickhouse smartparens smart-hungry-delete rg rainbow-mode rainbow-delimiters project-shells prodigy powershell persistent-scratch org-roam-ui org-present org-fancy-priorities orderless mustache-mode mustache mastodon marginalia lsp-ui lsp-treemacs logview llama-cpp jump-tree json-mode jq-mode jq-format inf-mongo ibuffer-projectile hl-todo hide-mode-line helpful helm-ls-git helm-c-yasnippet google-this git-timemachine git-modes git-messenger git-gutter-fringe flycheck-plantuml flycheck-eglot eyebrowse expand-region eshell-git-prompt engine-mode drag-stuff doom-themes doom-modeline dimmer diminish diff-at-point define-word dashboard crux consult-yasnippet consult-flycheck consult-eglot consult-dir company-posframe company-box color-identifiers-mode cmake-mode citeproc-org chatgpt-shell browse-kill-ring bongo bm beacon backup-walker anzu aggressive-indent))
'(ibuffer-sidebar all-the-icons-completion all-the-icons-ibuffer all-the-icons-nerd-fonts all-the-icons-dired vscode-icon dired-sidebar inf-clojure clojure-mode dockerfile-mode terraform-mode protobuf-mode csproj-mode sharper imenu-list ztree yasnippet-snippets yaml-mode windswap which-key volatile-highlights vertico verb undo-tree super-save ssh sql-clickhouse smartparens smart-hungry-delete rg rainbow-mode rainbow-delimiters project-shells prodigy powershell persistent-scratch org-roam-ui org-present org-fancy-priorities orderless mustache-mode mustache mastodon marginalia lsp-ui logview llama-cpp jump-tree json-mode jq-mode jq-format inf-mongo ibuffer-projectile hl-todo hide-mode-line helpful helm-ls-git helm-c-yasnippet google-this git-timemachine git-modes git-messenger git-gutter-fringe flycheck-plantuml flycheck-eglot eyebrowse expand-region eshell-git-prompt engine-mode drag-stuff doom-themes doom-modeline dimmer diminish diff-at-point define-word dashboard crux consult-yasnippet consult-flycheck consult-eglot consult-dir company-posframe company-box color-identifiers-mode cmake-mode citeproc-org chatgpt-shell browse-kill-ring bongo bm beacon backup-walker anzu aggressive-indent))
'(safe-local-variable-values
'((eval setq-local org-roam-db-location
(expand-file-name ".org-roam.db" org-roam-directory))
Expand All @@ -16,4 +16,5 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 5.0)))))
'(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 5.0))))
'(dired-sidebar-face ((t (:height 0.8 :foundry "Helvetica"))) t))
5 changes: 5 additions & 0 deletions snippets/inf-mongo-mode/show collections
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
name: show collections
key: sc
--
show collections
5 changes: 5 additions & 0 deletions snippets/inf-mongo-mode/show dbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
name: show dbs
key: sd
--
show dbs

0 comments on commit c7c8888

Please sign in to comment.