summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/cpp.el13
-rw-r--r--lisp/general.el46
-rw-r--r--lisp/mk.el4
-rw-r--r--lisp/org-custom.el2
4 files changed, 60 insertions, 5 deletions
diff --git a/lisp/cpp.el b/lisp/cpp.el
index 5bb04a8..eb7660e 100644
--- a/lisp/cpp.el
+++ b/lisp/cpp.el
@@ -13,15 +13,22 @@
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-cont-non-empty '+)
(c-set-offset 'argslist-close '+)
+ (c-set-offset 'statement-cont 0)
)
(add-hook 'c-mode-common-hook 'setup-c)
-(defun create-cpp-class()
- "Create a cpp class."
- (interactive "Enter the name of the class: ")
+(defun mk/cpp/generate-compile-commands-cmake()
+ "Regenerates a compile_commands.json database"
+ (interactive)
+ (shell-command (format "cd %s && cmake -S . -B build -D CMAKE_EXPORT_COMPILE_COMMANDS=1" (projectile-project-root)))
)
+(defun maybe-regenerate-compile-commands()
+ (if (string= (buffer-file-name) "CMakeLists.txt")
+ (mk/cpp/generate-compile-commands-cmake)))
+
+(add-hook 'after-save-hook 'maybe-regenerate-compile-commands)
(provide 'cpp)
;;; cpp.el ends here
diff --git a/lisp/general.el b/lisp/general.el
index 9b3f6c9..4b51b9b 100644
--- a/lisp/general.el
+++ b/lisp/general.el
@@ -32,6 +32,33 @@
:weight 'normal
:width 'normal)
+; Taken from: https://emacs.stackexchange.com/questions/55059/ligatures-with-the-jetbrains-mono-font
+(defconst jetbrains-ligature-mode--ligatures
+ '("-->" "//" "/**" "/*" "*/" "<!--" ":=" "->>" "<<-" "->" "<-"
+ "<=>" "==" "!=" "<=" ">=" "=:=" "!==" "&&" "||" "..." ".."
+ "|||" "///" "&&&" "===" "++" "--" "=>" "|>" "<|" "||>" "<||"
+ "|||>" "<|||" ">>" "<<" "::=" "|]" "[|" "{|" "|}"
+ "[<" ">]" ":?>" ":?" "/=" "[||]" "!!" "?:" "?." "::"
+ "+++" "??" "###" "##" ":::" "####" ".?" "?=" "=!=" "<|>"
+ "<:" ":<" ":>" ">:" "<>" "***" ";;" "/==" ".=" ".-" "__"
+ "=/=" "<-<" "<<<" ">>>" "<=<" "<<=" "<==" "<==>" "==>" "=>>"
+ ">=>" ">>=" ">>-" ">-" "<~>" "-<" "-<<" "=<<" "---" "<-|"
+ "<=|" "/\\" "\\/" "|=>" "|~>" "<~~" "<~" "~~" "~~>" "~>"
+ "<$>" "<$" "$>" "<+>" "<+" "+>" "<*>" "<*" "*>" "</>" "</" "/>"
+ "<->" "..<" "~=" "~-" "-~" "~@" "^=" "-|" "_|_" "|-" "||-"
+ "|=" "||=" "#{" "#[" "]#" "#(" "#?" "#_" "#_(" "#:" "#!" "#="
+ "&="))
+
+(sort jetbrains-ligature-mode--ligatures (lambda (x y) (> (length x) (length y))))
+
+(dolist (pat jetbrains-ligature-mode--ligatures)
+ (set-char-table-range composition-function-table
+ (aref pat 0)
+ (nconc (char-table-range composition-function-table (aref pat 0))
+ (list (vector (regexp-quote pat)
+ 0
+ 'compose-gstring-for-graphic)))))
+
;; Don't ask to kill when we have an open line number
(setq-default confirm-kill-processes nil)
@@ -86,6 +113,22 @@
(setq-default left-fringe-width 20)
(setq-default right-fringe-width 20)
+;; Margins: https://stackoverflow.com/a/22320638/7980887
+(defun my-set-text-margins ()
+ "Set margins in current buffer."
+ (setq left-margin-width 50)
+ (setq right-margin-width 50))
+
+(add-hook 'text-mode-hook 'my-set-text-margins)
+
+(defun my-set-prog-margins ()
+ "Set margins in current buffer."
+ (setq left-margin-width 25)
+ (setq right-margin-width 25))
+
+(add-hook 'prog-mode-hook 'my-set-prog-margins)
+
+
;; Highlight todos
(use-package hl-todo
:ensure t
@@ -248,7 +291,8 @@
:bind ("<f2>" . #'eglot-rename)
:config
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd"))
- (add-hook 'c-mode-common-hook 'eglot-ensure))
+ (add-hook 'c-mode-common-hook 'eglot-ensure)
+ (add-hook 'dart-mode-hook 'eglot-ensure))
(set-face-underline 'eglot-highlight-symbol-face t)
diff --git a/lisp/mk.el b/lisp/mk.el
index 28de3ed..748f7b0 100644
--- a/lisp/mk.el
+++ b/lisp/mk.el
@@ -69,5 +69,9 @@
(other-window -1))))))
(bind-key* (kbd "C-c f r") 'mk/rename-file)
+(defun mk/meow ()
+ (interactive)
+ (print "Meow!"))
+
(provide 'mk)
;;; mk.el ends here
diff --git a/lisp/org-custom.el b/lisp/org-custom.el
index 3353171..96bf819 100644
--- a/lisp/org-custom.el
+++ b/lisp/org-custom.el
@@ -66,7 +66,7 @@
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
("C-c n g" . org-roam-graph)
- ("C-c n j" . org-roam-dailies-capture-today)
+ ("C-c n j" . org-roam-dailies-goto-today)
("C-c n t" . org-roam-tag-add)
("C-c n a" . org-roam-alias-add)
("C-c n c" . org-capture)