summaryrefslogtreecommitdiff
path: root/emacs/init.el
diff options
context:
space:
mode:
authorMatias Linares <matias@deprecated.org>2024-08-20 17:44:01 -0300
committerMatias Linares <matias@deprecated.org>2024-08-20 17:44:01 -0300
commit2b244039a1384561997a6e31554eedb6fd33288f (patch)
treee0aa157be3079f7d17e116af53cb91ed2ef56962 /emacs/init.el
parent0f873d646031971dd37824181b65ce457576749e (diff)
downloaddotfiles-2b244039a1384561997a6e31554eedb6fd33288f.tar.gz
update emacsHEADmaster
Diffstat (limited to 'emacs/init.el')
-rw-r--r--emacs/init.el637
1 files changed, 468 insertions, 169 deletions
diff --git a/emacs/init.el b/emacs/init.el
index ffd53f6..0fe7bce 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -1,5 +1,5 @@
;;; package --- init.el
-;;; Comentary:
+;;; Commentary:
;; A new init.el
@@ -8,14 +8,20 @@
(with-eval-after-load 'package
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t))
+;; Some testing libraries
+(cond ((file-exists-p "/home/matias/.emacs.d/libs/")
+ (progn
+ (add-to-list 'load-path "/home/matias/.emacs.d/libs/")
+ (defun load-optional-libraries ()
+ "Load testing/optional libraries defined on `peke-optional.el'"
+ (interactive)
+ (require 'peke-optional)))))
+
;; Automatic reread from disk if the underlying file changes
(setq auto-revert-interval 1)
(setq auto-revert-check-vc-info t)
(global-auto-revert-mode)
-;; Move thourgh windows with Ctrl-<arrow keys>
-(windmove-default-keybindings 'meta)
-
;; Fix archaic defaults
(setq sentence-end-double-space nil)
@@ -23,10 +29,26 @@
(when (display-graphic-p)
(context-menu-mode))
-
;; Tramp - Faster than default scp
(setq tramp-default-method "ssh")
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; Utility functions
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun append-to-list (listname elements)
+ "Append all `ELEMENTS' to `LISTNAME'
+
+Example
+ (append-to-list 'listname '(val1 val2))
+Is the same as
+ (add-to-list 'listname 'val1)
+ (add-to-list 'listname 'val2)"
+ (mapcar (lambda (elem)
+ (add-to-list listname elem))
+ elements))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
@@ -55,14 +77,13 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Show the tab-bar as soon as tab-bar functions are invoked
-(setq tab-bar-show 0)
+(setq tab-bar-show 1)
;; Add the time to the tab-bar, if visible
(add-to-list 'tab-bar-format 'tab-bar-format-align-right 'append)
(add-to-list 'tab-bar-format 'tab-bar-format-global 'append)
(setq display-time-format "%a %F %T")
(setq display-time-interval 1)
-(display-time-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
@@ -72,26 +93,110 @@
(use-package emacs
:config
+ (setq ring-bell-function 'ignore
+ use-package-compute-statistics t)
(if (display-graphic-p)
(progn
- (load-theme 'modus-operandi)
- (set-face-attribute 'default nil :font "Fantasque Sans Mono" :height 110)
- (set-face-attribute 'fixed-pitch nil :font "Input Mono" :height 100)
- (set-face-attribute 'variable-pitch nil :font "IBM Plex Sans" :height 110)
- (setq modus-themes-operandi-color-overrides
- '((bg-main . "#fefcf4"))))
- (load-theme 'gruvbox-dark-hard)))
+ ;(set-face-attribute 'default nil :font "Roboto Mono" :height 100)
+ ; (set-face-attribute 'variable-pitch nil :font "ETBembo")
+ (custom-theme-set-faces
+ 'user
+ '(variable-pitch ((t (:family "ETBembo" :height 120))))
+ '(fixed-pitch ((t (:family "Monospace" :height 100))))
+ ;; This is for the modeline?
+ ; '(warning ((t :weight regular :foreground "OrangeRed1")))
+ )
+ ;; Colorscheme
+ (setq modus-themes-operandi-color-overrides
+ '((bg-main . "#fefcf4")))
+ ;(load-theme 'spacemacs-dark t)
+ (setq-default cursor-type 'bar)
+ (blink-cursor-mode t)
+ (let ((bg (face-attribute 'mode-line :background)))
+ (set-face-attribute 'mode-line nil
+ :box (list :line-width 1 :color "gray60" :style nil)
+ :background bg))
+ (load-theme 'leuven t))
+ (load-theme 'modus-vivendi))
+ (add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
+ ;; Treesitter config
+ ;; Tell Emacs to prefer the treesitter mode
+ ;; You'll want to run the command `M-x
+ ;; treesit-install-language-grammar' before editing.
+ (setq major-mode-remap-alist
+ '(
+ ;; (yaml-mode . yaml-ts-mode)
+ (bash-mode . bash-ts-mode)
+ (js2-mode . js-ts-mode)
+ (typescript-mode . typescript-ts-mode)
+ (json-mode . json-ts-mode)
+ (css-mode . css-ts-mode)
+ (python-mode . python-ts-mode)
+ (perl-mode . cperl-mode)))
+ :config
+
+ ;; :hook
+ ;; Auto parenthesis matching
+ ;; ((prog-mode . electric-pair-mode))
+ :hook
+ ((emacs-lisp-mode . enable-paredit-mode)
+ ;; (eval-expression-minibuffer-setup . enable-paredit-mode)
+ (ielm-mode . enable-paredit-mode)
+ (lisp-mode . enable-paredit-mode)
+ (lisp-interaction-mode . enable-paredit-mode)
+ (scheme-mode . enable-paredit-mode)
+ (slime-repl-mode . enable-paredit-mode)
+ (scheme-mode . rainbow-delimiters-mode)))
+
+(defun my-c-mode-common-hook ()
+ ;; my customizations for all of c-mode, c++-mode, objc-mode, java-mode
+ (c-set-offset 'substatement-open 0)
+ ;; other customizations can go here
+
+ (setq c++-tab-always-indent t)
+ (setq c-basic-offset 4) ;; Default is 2
+ (setq c-indent-level 4) ;; Default is 2
+
+ (setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60))
+ (setq tab-width 4)
+ (setq indent-tabs-mode nil) ; use spaces only if nil
+ )
+
+(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
+
+;; (use-package company-qml
+;; :defer t
+;; :config
+;; (add-to-list 'company-backends 'company-qml))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Org
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Packages for org
+(use-package olivetti
+ :ensure t)
-(setq org-agenda-files (list "~/OrgRoam/agenda.org"
- "/home/work/OrgRoam/20230808170239-code_reviews.org"
- "/home/work/OrgRoam/20230808173230-tareas.org"))
+(use-package org-journal
+ :ensure t
+ :defer t
+ :bind (("C-c j t" . my/find-journal-today))
+ :init
+ (setq org-journal-prefix-key "C-c j ")
+ :config
+ (setq org-journal-dir "~/Documents/roam/journal/"
+ org-journal-date-format "%A, %d %B %Y"
+ ;; Find files of org journal in the agenda files
+ org-agenda-file-regexp "\\`\\\([^.].*\\.org\\\|[0-9]\\\{8\\\}\\\(\\.gpg\\\)?\\\)\\'"
+ org-journal-enable-agenda-integration t
+ org-journal-file-type 'weekly)
+ (add-to-list 'org-agenda-files org-journal-dir)
+ :preface
+ (defun my/find-journal-today ()
+ (interactive)
+ (org-journal-new-entry t)))
(use-package org
:hook ((org-mode . visual-line-mode) ; wrap lines at word breaks
@@ -103,6 +208,7 @@
("C-c a" . org-agenda))
:config
(require 'org-tempo) ; Abbrv support for code blocks
+ (require 'org-agenda)
(add-to-list 'org-export-backends 'md)
;; Make org-open-at-point follow file links in the same window
@@ -110,40 +216,72 @@
;; Make exporting quotes better
(setq org-export-with-smart-quotes t)
- (setq org-confirm-babel-evaluate nil) ; Dont prompt for evaluation
- )
+ ;; Dont prompt for evaluation
+ (setq org-confirm-babel-evaluate nil)
+ ;; This variable hides bold, italics, etc. markers
+ (setq org-hide-emphasis-markers t)
+
+ ;; This things are fixed instead of variable
+ (custom-theme-set-faces
+ 'user
+ '(org-block ((t (:inherit fixed-pitch))))
+ '(org-code ((t (:inherit fixed-pitch))))
+ '(org-document-info ((t (:foreground "dark orange"))))
+ '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
+ '(org-indent ((t (:inherit (org-hide fixed-pitch)))))
+ '(org-link ((t (:foreground "royal blue" :underline t))))
+ '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch)))))
+ '(org-property-value ((t (:inherit fixed-pitch))) t)
+ '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
+ '(org-table ((t (:inherit fixed-pitch))))
+ '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold))))
+ '(org-verbatim ((t (:inherit (shadow fixed-pitch))))))
+ (org-babel-do-load-languages 'org-babel-load-languages '((shell . t)
+ (sql . t)
+ (sqlite . t)
+ (restclient . t)
+ (python . t)
+ (ruby . t))))
+
(add-hook 'org-mode-hook (lambda ()
(auto-fill-mode)
(variable-pitch-mode)
(bug-reference-mode)
- (olivetti-mode)
- (olivetti-set-width 100)))
+ ;(olivetti-mode)
+ ;(olivetti-set-width 100)
+ ))
(use-package org-roam
:ensure t
:defer t
:init (setq org-roam-v2-ack t)
:custom
- (org-roam-directory "~/OrgRoam")
+ (org-roam-directory "~/Documents/roam")
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert))
:config
;; (org-roam-setup) ;; One shot?
(org-roam-db-autosync-mode)
- (setq org-roam-index-file "~/OrgRoam/index.org")
+ (setq org-roam-index-file "~/Documents/roam/index.org")
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-side-window)
(side . right)
(window-width . 0.4)
- (window-height . fit-window-to-buffer))))
-
-(use-package org-jira
- :config (setq jiralib-url "https://comprandoengrupo.atlassian.net"))
+ (window-height . fit-window-to-buffer)))
+ ;; Better python identation
+ (setq org-edit-src-content-indentation 0))
(use-package org-modern
- :ensure t
- :init (global-org-modern-mode))
+ :defer t
+ :hook ((org-mode . org-modern-mode))
+ :config
+ (setq org-tags-column 0
+ org-auto-align-tags nil
+ org-catch-invisible-edits 'show-and-error
+ org-insert-heading-respect-content t
+ org-hide-emphasis-markers t
+ org-pretty-entities t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
@@ -154,58 +292,50 @@
;; Vertico: better vertical completion for minibuffer commands
(use-package vertico
:ensure t
+ :bind
+ (:map vertico-map
+ ("<tab>" . vertico-insert))
+
:init
;; You'll want to make sure that e.g. fido-mode isn't enabled
(vertico-mode))
+(use-package vertico-posframe
+ :ensure t
+ :hook (after-init . vertico-posframe-mode)
+ :custom
+ (vertico-posframe-parameters
+ '((left-fringe . 8)
+ (right-fringe . 8))))
+
;; Marginalia: annotations for minibuffer
(use-package marginalia
:ensure t
:config
(marginalia-mode))
-(use-package corfu
- :ensure t
- :custom
- (corfu-cycle t)
- :bind
- (:map corfu-map
- ("SPC" . corfu-insert-separator))
- :hook ((prog-mode . corfu-mode)
- (shell-mode . corfu-mode)
- (eshell-mode . corfu-mode))
- :init (global-corfu-mode))
-
-;; Part of corfu
-(use-package corfu-popupinfo
- :after corfu
- :hook (corfu-mode . corfu-popupinfo-mode)
- :custom
- (corfu-popupinfo-delay '(0.25 . 0.1))
- (corfu-popupinfo-hide nil)
- :config
- (corfu-popupinfo-mode))
-
-;; Make corfu popup come up in terminal overlay
-(use-package corfu-terminal
- :if (not (display-graphic-p))
- :ensure t
- :config
- (corfu-terminal-mode))
+;; (use-package company
+;; :ensure t
+;; :hook ((prog-mode . company-mode)
+;; (comint-mode . company-mode))
+;; :bind
+;; (:map company-mode-map
+;; ("C-;" . company-complete))
+;; :config
+;; ;; Don't trigger completion automaticly
+;; (setq company-idle-delay nil
+;; company-global-modes '(prog-mode org-mode lisp-mode elisp-mode emacs-lisp-mode sly-repl-mode)))
-;; Pretty icons for corfu
-(use-package kind-icon
- :if (display-graphic-p)
- :ensure t
- :after corfu
- :config
- (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
+(use-package corfu
+ :defer t
+ :hook (after-init . global-corfu-mode)
+ :bind (("C-;" . completion-at-point)))
;; Orderless: powerful completion style
(use-package orderless
:ensure t
:config
- (setq completion-styles '(orderless)))
+ (setq completion-styles '(orderless basic)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
@@ -213,59 +343,108 @@
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Treesiter config
+;; Define some aliases for eshell
+(defun eshell/open (file)
+ (find-file file))
+;; Treesiter config
(use-package emacs
- :config
- ;; Treesitter config
- ;; Tell Emacs to prefer the treesitter mode
- ;; You'll want to run the command `M-x treesit-install-language-grammar' before editing.
- (setq major-mode-remap-alist
- '(;(yaml-mode . yaml-ts-mode)
- (bash-mode . bash-ts-mode)
- (js2-mode . js-ts-mode)
- (typescript-mode . typescript-ts-mode)
- (json-mode . json-ts-mode)
- (css-mode . css-ts-mode)
- (python-mode . python-ts-mode)))
- :hook
- ;; Auto parenthesis matching
- ((prog-mode . electric-pair-mode)))
+ )
;; Eglot
(use-package eglot
- ;; no :ensure t here because it's built-in
-
- ;; Configure hooks to automatically turn-on eglot for selected modes
- ; :hook
- ; (((python-mode ruby-mode elixir-mode) . eglot))
-
+ :defer t
:custom
(eglot-send-changes-idle-time 0.1)
-
+ (eglot-events-buffer-size 1000)
+ (eglot-report-progress nil)
:config
(fset #'jsonrpc--log-event #'ignore) ; massive perf boost---don't log every event
;; Sometimes you need to tell Eglot where to find the language server
- ; (add-to-list 'eglot-server-programs
- ; '(haskell-mode . ("haskell-language-server-wrapper" "--lsp")))
(add-to-list 'eglot-server-programs
- '(python-ts-mode . ("pylsp" "--tcp" "--port" :autoport)))
+ '(qml-mode . ("qmlls6")))
+ (add-to-list 'eglot-server-programs
+ '(c++-mode . ("clangd" "-log=error" "--clang-tidy" "--background-index" "--limit-results=500"
+ "--completion-style=bundled")))
)
+
+;; Flymake
+(use-package flymake
+ :defer t
+ :hook ((prog-mode . flymake-mode)))
+
;; YAML
(use-package yaml-mode :ensure t)
+(use-package outline-indent
+ :defer t
+ :hook ((yaml-mode . outline-indent-minor-mode)
+ (yaml-ts-mode . outline-indent-minor-mode))
+ :custom
+ (outline-indent-shift-width 2))
+
+(use-package qml-mode
+ :defer t)
+
;; JSON
-(use-package json-mode :ensure t)
-(add-hook 'js-json-mode-hook
- (lambda ()
- (define-key js-json-mode-map (kbd "<f5>") 'json-pretty-print-buffer)))
+(use-package json-mode
+ :ensure t
+ :bind
+ (("C-c j p" . json-pretty-print-buffer)))
;; Lisp
-(use-package slime :defer t :ensure t)
+;; (use-package sly :defer t :ensure t)
+(use-package slime
+ :ensure t
+ :defer t)
+(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl")
+;; (use-package slime-company
+;; :ensure t
+;; :after (slime company)
+;; :config
+(setq slime-company-completion 'fuzzy
+ slime-company-after-completion 'slime-company-just-one-space)
+(slime-setup '(slime-fancy slime-company))
+;; (add-to-list 'load-path "/home/matias/Workspace/swank-chicken/")
+;; (autoload 'chicken-slime "chicken-slime" "SWANK backend for Chicken" t)
+;; (setq slime-csi-path "/home/matias/.local/bin/csi"
+;; swank-chicken-port 4015)
+;; (add-hook 'scheme-mode-hook (lambda () (slime-mode t)))
+
+;; Indenting module body code at column 0
+(defun scheme-module-indent (state indent-point normal-indent) 0)
+(put 'module 'scheme-indent-function 'scheme-module-indent)
+
+(put 'and-let* 'scheme-indent-function 1)
+(put 'parameterize 'scheme-indent-function 1)
+(put 'handle-exceptions 'scheme-indent-function 1)
+(put 'when 'scheme-indent-function 1)
+(put 'unless 'scheme-indent-function 1)
+(put 'match 'scheme-indent-function 1)
+
+
+;; Scheme
+;; (use-package geiser-chicken
+;; :ensure t)
+
+
+;; Racket
+(use-package racket-mode
+ :defer t)
+
+(use-package rainbow-delimiters
+ :ensure t
+ :hook ((lisp-mode . rainbow-delimiters-mode)))
+
+;; Jenkinsfile
+(use-package jenkinsfile-mode
+ :ensure t)
+(setq-default indent-tabs-mode nil)
+
;; Rest client
(use-package restclient :defer t :ensure t)
@@ -275,10 +454,18 @@
:bind (("s-g" . magit-status)
("C-c g" . magit-status)))
+;; Forge
+(use-package forge
+ :after magit
+ :ensure t)
+
;; python-mode configuration
+(setq python-indent-guess-indent-offset-verbose nil)
+
(use-package pyvenv
:ensure t
+ :defer t
:config
;; Set correct Python interpreter
(setq pyvenv-post-activate-hooks
@@ -297,13 +484,27 @@
"-v"
'("--db" "Create db" "--create-db")))
-(add-hook 'python-ts-mode-hook
- (lambda ()
- (define-key python-ts-mode-map (kbd "C-c p") 'python-pytest-dispatch)
- (define-key python-ts-mode-map (kbd "C-c m p") 'ceg/pre-commit-run-current-file)))
+;; Perl
+(with-eval-after-load 'cperl
+ (setq cperl-indent-parens-as-block t
+ cperl-close-paren-offset (- cperl-indent-level)))
;; Load path from shell environment
-(use-package exec-path-from-shell :ensure t :defer t)
+;; (use-package exec-path-from-shell :ensure t :defer t)
+
+(add-to-list 'exec-path "/home/matias/.local/share/gem/ruby/3.0.0/bin")
+
+(use-package cmake-project
+ :defer t
+ :preface
+ (defun maybe-cmake-project-mode ()
+ (when (or (file-exists-p "CMakeLists.txt")
+ (file-exists-p (expand-file-name "CMakeLists.txt" (projectile-project-root))))
+ (cmake-project-mode)))
+ :hook
+ (c-mode . maybe-cmake-project-mode)
+ (c++-mode . maybe-cmake-project-mode))
+
;; sh-mode configuration
(use-package flymake-shellcheck
@@ -311,67 +512,144 @@
:init
(add-hook 'sh-mode-hook 'flymake-shellcheck-load))
+(use-package nerd-icons
+ :defer t
+ :ensure t)
+
+(use-package doom-modeline
+ :ensure t
+ :hook (after-init . doom-modeline-mode)
+ :config
+ (set-face-attribute 'doom-modeline-warning nil :weight 'regular :foreground "OrangeRed2")
+ (set-face-attribute 'doom-modeline-urgent nil :weight 'regular)
+ (set-face-attribute 'doom-modeline-info nil :weight 'regular)
+ (set-face-attribute 'doom-modeline-buffer-file nil :weight 'regular)
+ (set-face-attribute 'doom-modeline-buffer-modified nil :weight 'semi-bold :foreground "black")
+ (set-face-attribute 'doom-modeline-buffer-major-mode nil :weight 'regular :italic t)
+ :custom
+ (doom-modeline-buffer-encoding nil)
+ (doom-modeline-minor-modes nil)
+ (doom-modeline-buffer-modification-icon t)
+ (doom-modeline-time nil)
+ (doom-modeline-vcs-max-length 35)
+ (doom-modeline-env-python-executable "python"))
-;; Moodline
-(use-package mood-line :ensure t)
-(mood-line-mode)
-
-;; Fix for flycheck with eglot
-;; https://gitlab.com/jessieh/mood-line/-/merge_requests/11
-(require 'cl-lib)
-
-(defun mood-line--checker-flymake-count-errors ()
- "Return alist with count of all current flymake diagnostic reports.
-
-Counts will be returned in an alist as the cdr of the following keys:
-`'note-count' | All notes reported by checker
-`'error-count' | All errors reported by checker
-`'warning-count' | All warnings reported by checkero
-`'issue-count' | All errors and warnings reported by checker
-`'all-count' | Everything reported by checker"
- (let ((error-count 0)
- (warning-count 0)
- (note-count 0))
- (progn
- (cl-loop
- with warning-level = (warning-numeric-level :warning)
- with note-level = (warning-numeric-level :debug)
- for state being the hash-values of flymake--state
- do (cl-loop
- with diags = (flymake--state-diags state)
- for diag in diags do
- (let ((severity (flymake--lookup-type-property (flymake--diag-type diag) 'severity
- (warning-numeric-level :error))))
- (cond ((> severity warning-level) (cl-incf error-count))
- ((> severity note-level) (cl-incf warning-count))
- (t (cl-incf note-count)))))))
- `((note-count . ,note-count)
- (error-count . ,error-count)
- (warning-count . ,warning-count)
- (issue-count . ,(+ warning-count
- error-count))
- (all-count . ,(+ note-count
- warning-count
- error-count)))))
+;; This will echo the diagnostics in the minibuffer
+(setq lsp-diagnostics-provider :flymake)
;; IMenu everywhere
(use-package imenu-anywhere
:ensure t
:bind (("C-." . imenu-anywhere)))
+(defcustom ignore-directories '("venv" "__pycache__" "*.egg-info")
+ "Directories to be ignored by `projectile', `treemacs', etc."
+ :group 'peke
+ :type '(repeat string))
+
+(defcustom ignore-files '()
+ "Files to be ignored by `projectile', `treemacs', etc."
+ :group 'peke
+ :type '(repeat string))
+
;; Projectile
(use-package projectile
- :init
- (setq projectile-use-git-grep t))
-(projectile-mode +1)
-(define-key projectile-mode-map (kbd "M-p") 'projectile-command-map)
+ :hook (after-init . projectile-mode)
+ :preface
+ (defun ignored-projectile-generic-command ()
+ (cond
+ (projectile-fd-executable
+ (let ((exclude-flags (mapcar (lambda (dir) (format "-E %s" dir))
+ ignore-directories)))
+ (format "%s . -0 --type f --color=never %s --strip-cwd-prefix"
+ projectile-fd-executable
+ (string-join exclude-flags " "))))
+ (t projectile-generic-comand)))
+ :config
+ (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
+ :custom
+ (projectile-indexing-method 'hybrid)
+ (projectile-sort-order 'modification-time)
+ (projectile-use-git-grep t)
+ (projectile-generic-command (ignored-projectile-generic-command)))
+
+(use-package treemacs
+ :ensure t
+ :preface
+ (defun peke/treemacs-ignore-file-p (filename absolute-path)
+ ;; TODO: Terminar esto con los defcustom de mas arria
+ (string-equal "venv" filename))
+ :bind
+ ("<f5>" . treemacs)
+ ("M-0" . treemacs-select-window)
+ :custom
+ (treemacs-is-never-other-window t)
+ (treemacs-space-between-root-nodes nil)
+ :config
+ (add-to-list 'treemacs-ignored-file-predicates #'peke/treemacs-ignore-file-p)
+ :hook
+ (treemacs-mode . treemacs-project-follow-mode))
+(use-package treemacs-projectile
+ :after (treemacs projectile)
+ :ensure t)
-(use-package projectile-rails
- :defer t :ensure t
- :init (projectile-rails-global-mode))
-(define-key projectile-rails-mode-map (kbd "C-c r")
- 'projectile-rails-command-map)
+(use-package treemacs-icons-dired
+ :hook (dired-mode . treemacs-icons-dired-enable-once)
+ :ensure t)
+
+(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
+ :ensure t
+ :after (treemacs)
+ :config (treemacs-load-all-the-icons-with-workaround-font "Hermit"))
+
+
+;; (use-package treemacs-tab-bar ;;treemacs-tab-bar if you use tab-bar-mode
+;; :after (treemacs)
+;; :ensure t
+;; :config (treemacs-set-scope-type 'Tabs))
+
+(use-package all-the-icons
+ :ensure t
+ :if (display-graphic-p))
+
+;; Window purpose
+(use-package window-purpose
+ :ensure t
+ :defer t
+ :hook (after-init . purpose-mode)
+ :config
+ (add-to-list 'purpose-user-mode-purposes '(python-mode . py))
+ (add-to-list 'purpose-user-mode-purposes '(inferior-python-mode . py-repl))
+ (purpose-compile-user-configuration))
+
+(use-package helpful
+ :ensure t
+ :defer t
+ :bind (:map global-map
+ ("C-h f" . #'helpful-callable)
+ ("C-h v" . #'helpful-variable) ; Mnemonic: link → insert
+ ("C-h k" . #'helpful-key)
+ ("C-h x" . #'helpful-command)))
+
+(use-package perspective
+ :defer t
+ :ensure t
+ :hook (after-init . persp-mode)
+ :bind
+ ("C-x C-b" . persp-list-buffers) ; or use a nicer switcher, see below
+ :custom
+ (persp-mode-prefix-key (kbd "C-c M-p")) ; pick your own prefix key here
+)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
@@ -379,21 +657,15 @@ Counts will be returned in an alist as the cdr of the following keys:
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defun ceg/pre-commit-run-current-file ()
- "Run pre-commit with the current file name"
+(defun my/reload-dir-locals ()
(interactive)
- (let ((full-command (concat "pre-commit run --file " buffer-file-name " | sed 's;^ceg/;;g'")))
- (compile full-command)))
+ (let ((enable-local-variables :all))
+ (hack-dir-local-variables-non-file-buffer)))
-(defun ceg/pre-commit-run ()
- "Run pre-commit with the current file name"
+(defun my/find-emacs-init ()
+ "`'find-file' to `emacs' init file."
(interactive)
- (let ((full-command (concat "pre-commit run | sed 's;^ceg/;;g'")))
- (compile full-command)))
-
-(add-hook 'python-mode (lambda ()
- (local-set-key ("C-c o")
- 'ceg/pre-commit-run)))
+ (find-file "~/.emacs.d/init.el"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
@@ -402,25 +674,52 @@ Counts will be returned in an alist as the cdr of the following keys:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-key global-map (kbd "RET") 'newline-and-indent)
-(global-set-key (kbd "C-x C-b") 'ibuffer)
-(global-set-key (kbd "C-;") 'completion-at-point)
+;(global-set-key (kbd "C-x C-b") 'ibuffer)
+; (global-set-key (kbd "C-;") 'completion-at-point)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "M-z") 'zap-up-to-char)
(global-set-key (kbd "C-.") #'imenu-anywhere)
(global-set-key (kbd "M-o") 'other-window)
+(global-set-key (kbd "C-c m i") 'my/find-emacs-init)
+
+(provide 'init)
+;;; init.el ends here
(custom-set-variables
;; custom-set-variables was added by Custom.
;; 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.
'(custom-safe-themes
- '("919fabfc5cb6165ce07b9d8668f78fe75fe8bd08566006bc87513c29b4f34ade" "3770d0ae70172461ee0a02edcff71b7d480dc54066e8960d8de9367d12171efb" default))
+ '("cdad4e5bc718111deb1f1a2a35e9781e11724144a1eb2064732c337160946760" "cfb0bb44259cf576124b900613628f4b589df1c3860185d24fffde6666bc88cf" "7fd8b914e340283c189980cd1883dbdef67080ad1a3a9cc3df864ca53bdc89cf" "f3781be0be23cc71c89b317489e07a4ad3e885f84c0a618692b53bbd69e60843" "9bed3fb18c8d18acca50f3609efcaa8d1c72027802cec8d291d4577e3e48b825" "871b064b53235facde040f6bdfa28d03d9f4b966d8ce28fb1725313731a2bcc8" "d445c7b530713eac282ecdeea07a8fa59692c83045bf84dd112dd738c7bcad1d" "48ea73e4e893ae318e4b0e3dda47ba78e322779a2107fa1aa9a71380590c03c5" "3770d0ae70172461ee0a02edcff71b7d480dc54066e8960d8de9367d12171efb" "835d934a930142d408a50b27ed371ba3a9c5a30286297743b0d488e94b225c5f" "98ef36d4487bf5e816f89b1b1240d45755ec382c7029302f36ca6626faf44bbd" "7b8f5bbdc7c316ee62f271acf6bcd0e0b8a272fdffe908f8c920b0ba34871d98" "de8f2d8b64627535871495d6fe65b7d0070c4a1eb51550ce258cd240ff9394b0" "1781e8bccbd8869472c09b744899ff4174d23e4f7517b8a6c721100288311fa5" "e7820b899036ae7e966dcaaec29fd6b87aef253748b7de09e74fdc54407a7a02" "7e0dec7d9f3821acba56ab19083ed059a94753ed79ee89b0d8167b727ed6cb81" "bbb13492a15c3258f29c21d251da1e62f1abb8bbd492386a673dcfab474186af" "a5270d86fac30303c5910be7403467662d7601b821af2ff0c4eb181153ebfc0a" "ba323a013c25b355eb9a0550541573d535831c557674c8d59b9ac6aa720c21d3" default))
+ '(eglot-events-buffer-size 0 nil nil "Customized with use-package eglot")
+ '(eldoc-echo-area-use-multiline-p nil)
+ '(package-selected-packages
+ '(ob-graphql graphql-mode standard-themes leuven-theme outline-indent corfu company-qml qml-mode cmake-project eldoc-overlay kanagawa-theme nano-theme theme-looper org-bullets spacemacs-theme perspective flycheck slime-company gruvbox-theme paredit slime acme-theme plan9-theme racket-mode rainbow-delimiters helpful frame-mode cmake-mode csv-mode ob-restclient daemons yaml-mode window-purpose vertico-posframe treemacs restclient pyvenv python-pytest projectile-rails org-roam org-modern org-journal orderless olivetti marginalia json-mode jenkinsfile-mode imenu-anywhere forge doom-modeline company all-the-icons))
'(safe-local-variable-values
- '((python-pytest-executable . "pytest")
- (python-shell-interpreter-args . "/home/work/Workspace/ceg-intranet/ceg/manage.py shell_plus --plain"))))
+ '((projectile-project-run-cmd . "./build/bin/kode-reviewer")
+ (projectile-project-run-cmd . "./build/bin/kodereviewer")
+ (projectile-project-compilation-cmd . "cmake -DCMAKE_BUILD_TYPE=Debug --build build -j8")
+ (projectile-project-compilation-cmd . "cmake --build build -j8")
+ (projectile-project-compilation-cmd . "ccmake --build build -j8")
+ (projectile-project-compilation-cmd . "cmake --build build -j8")
+ (projectile-project-compilation-cmd "cmake --build build -j8")
+ (projectile-project-run-cmd . "./build/bp"))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; 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.
- )
+ '(fixed-pitch ((t (:family "Monospace" :height 100))))
+ '(org-block ((t (:inherit fixed-pitch))))
+ '(org-code ((t (:inherit fixed-pitch))))
+ '(org-document-info ((t (:foreground "dark orange"))))
+ '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
+ '(org-indent ((t (:inherit (org-hide fixed-pitch)))))
+ '(org-link ((t (:foreground "royal blue" :underline t))))
+ '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch)))))
+ '(org-property-value ((t (:inherit fixed-pitch))))
+ '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
+ '(org-table ((t (:inherit fixed-pitch))))
+ '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold))))
+ '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))
+ '(variable-pitch ((t (:family "ETBembo" :height 120)))))