~formatting of code and org items

This commit is contained in:
oreodave
2019-11-25 16:49:59 +00:00
parent 4b06654f13
commit 7f154120fc

View File

@@ -44,7 +44,7 @@ Some quality of life things and others that I couldn't really put in one categor
This hook was given to me by our lord and saviour Henrik. Fixes a single font This hook was given to me by our lord and saviour Henrik. Fixes a single font
issue I had with font ligatures. issue I had with font ligatures.
* Personal functions * Personal functions
These functions help me with adding functionality to Emacs. Personal functionality that aid my workflow or are just cool.
** Reload ** Reload
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(defun oreodave/reload () (defun oreodave/reload ()
@@ -81,6 +81,9 @@ Open a Dired session to the books directory in the org-directory.
(powerline-reset))) (powerline-reset)))
(error "Problem loading theme %s" x))))) (error "Problem loading theme %s" x)))))
#+END_SRC #+END_SRC
Allow user to set a theme from a limited set of candidates, based on
"oreodave/theme-list".
- Themes sanctioned by me: - Themes sanctioned by me:
- doom-solarized-dark: just the right everything. best for day. - doom-solarized-dark: just the right everything. best for day.
- doom-gruvbox: good contrast, better for night. - doom-gruvbox: good contrast, better for night.
@@ -103,6 +106,7 @@ Open a Dired session to the books directory in the org-directory.
(interactive) (interactive)
(dired (expand-file-name "~/School"))) (dired (expand-file-name "~/School")))
#+END_SRC #+END_SRC
Going to the school directory, quick access to school work.
** Oreomode ** Oreomode
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(defun oreodave/oreomode() (defun oreodave/oreomode()
@@ -112,8 +116,8 @@ Open a Dired session to the books directory in the org-directory.
(+treemacs/toggle) (+treemacs/toggle)
(message "Oreomode complete!")) (message "Oreomode complete!"))
#+END_SRC #+END_SRC
A little function to turn on most of my helper things that I use on a daily A little routine to turn on most of my helper things that I use on a daily basis
basis but put into its own routine because I don't want it active all the time. but put into its own procedure because I don't want it active all the time.
* Packages Config * Packages Config
** Projectile ** Projectile
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -134,8 +138,7 @@ loaded, and easily add new ignores if necessary. Add a new ignore to the tags-al
(map! (map!
:map dired-mode-map :map dired-mode-map
:n "RET" nil :n "RET" nil
:ng "^" nil) :ng "^" nil))
)
#+END_SRC #+END_SRC
** DAP ** DAP
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -147,9 +150,13 @@ loaded, and easily add new ignores if necessary. Add a new ignore to the tags-al
(dap-ui-sessions)) (dap-ui-sessions))
(map! (map!
:leader :leader
:desc "Start debugging setup" "cD" 'oreodave/debug) :desc "Start debugging setup" "cD" 'oreodave/debug))
)
#+END_SRC #+END_SRC
A keybind and a routine
- Routine sets up the panes that I like to use, instead of having to M-x'ing it
- *<SPC>cD* starts up the routine
** Wakatime ** Wakatime
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(setq wakatime-api-key (shell-command-to-string "pass Keys/Wakatime")) (setq wakatime-api-key (shell-command-to-string "pass Keys/Wakatime"))
@@ -167,8 +174,7 @@ Using new password holder (pass) to help with secure transactions.
(interactive) (interactive)
(elfeed-org-export-opml) (elfeed-org-export-opml)
(write-file (concat org-directory "/elfeed.opml")) (write-file (concat org-directory "/elfeed.opml"))
(kill-current-buffer) (kill-current-buffer))
)
(map! (map!
(:map elfeed-search-mode-map (:map elfeed-search-mode-map
@@ -176,12 +182,9 @@ Using new password holder (pass) to help with secure transactions.
:desc "Update feeds" "u" #'elfeed-update) :desc "Update feeds" "u" #'elfeed-update)
(:leader (:leader
:prefix "o" :prefix "o"
:desc "Open RSS" "f" #'=rss) :desc "Open RSS" "f" #'=rss))
)
(add-hook 'elfeed-org-new-entry-hook 'oreodave/elfeed/on-new-feed) (add-hook 'elfeed-org-new-entry-hook 'oreodave/elfeed/on-new-feed))
;; (oreodave/elfeed/load-feeds)
)
#+END_SRC #+END_SRC
** Dash ** Dash
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -195,17 +198,17 @@ My docsets are stored in .docsets for ease of use
(interactive) (interactive)
(wttrin (shell-command-to-string "pass location"))) (wttrin (shell-command-to-string "pass location")))
#+END_SRC #+END_SRC
Function to quickly check weather, which is what I wanted wttrin for.
** Dashboard ** Dashboard
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
; Setup dashboard to do some stuff for me (setq fancy-splash-image "~/Pictures/emacs-backgrounds/killerqueen.png") ; splash image
(setq fancy-splash-image "~/Pictures/emacs-backgrounds/killerqueen.png")
(setq +doom-dashboard-functions (setq +doom-dashboard-functions ; limit the dashboard items
'(doom-dashboard-widget-banner '(doom-dashboard-widget-banner
doom-dashboard-widget-shortmenu doom-dashboard-widget-shortmenu
doom-dashboard-widget-loaded)) doom-dashboard-widget-loaded))
(setq +doom-dashboard-menu-sections (setq +doom-dashboard-menu-sections ; Set a specific amount of items
'(("Open org-agenda" '(("Open org-agenda"
:icon (all-the-icons-octicon "calendar" :face 'font-lock-keyword-face) :icon (all-the-icons-octicon "calendar" :face 'font-lock-keyword-face)
:when (fboundp 'org-agenda) :when (fboundp 'org-agenda)
@@ -233,29 +236,28 @@ My docsets are stored in .docsets for ease of use
(after! csharp-mode (after! csharp-mode
(setq omnisharp-server-executable-path "~/bin/omnisharp/run") (setq omnisharp-server-executable-path "~/bin/omnisharp/run")
(defun oreodave/csharp/get-unit-test-in-project () (defun oreodave/csharp/get-unit-test-in-project ()
"Unit test anywhere using CTags or ETags and C#"
(interactive) (interactive)
(let* ((tags-file (counsel-etags-locate-tags-file)) (let* ((tags-file (counsel-etags-locate-tags-file))
(cands (counsel-etags-collect-cands "void.*Test" t buffer-file-name))) ; void.*Test assumes your tests are using something like XUnit and end with Test (cands (counsel-etags-collect-cands "void.*Test" t buffer-file-name))) ; void.*Test assumes your tests are using something like XUnit and end with Test
(ivy-read "Choose test: " (ivy-read
cands "Choose test: "
:action cands
(lambda (item) :action
;; From the counsel-etags file-open-api function (lambda (item)
(when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" item) ;; From the counsel-etags file-open-api function
(let* ((file (match-string-no-properties 1 item)) (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" item)
(linenum (match-string-no-properties 2 item)) (let*
;; always calculate path relative to TAGS ((file (match-string-no-properties 1 item))
(default-directory (counsel-etags-tags-file-directory))) (linenum (match-string-no-properties 2 item))
;; always calculate path relative to TAGS
(default-directory (counsel-etags-tags-file-directory)))
(when counsel-etags-debug (counsel-etags-push-marker-stack (point-marker))
(message "counsel-etags-open-file-api called => dir=%s, linenum=%s, file=%s" dir linenum file)) (find-file file)
(counsel-etags-forward-line linenum)
(counsel-etags-push-marker-stack (point-marker)) (omnisharp-unit-test-at-point))))
(find-file file) :caller 'oreodave/csharp/get-unit-tests-in-project)))
(counsel-etags-forward-line linenum)
(omnisharp-unit-test-at-point))
))
:caller 'oreodave/csharp/get-unit-tests-in-project)))
(add-hook! 'csharp-mode-hook '(lambda() (add-hook! 'csharp-mode-hook '(lambda()
(omnisharp-mode) (omnisharp-mode)
@@ -277,8 +279,8 @@ My docsets are stored in .docsets for ease of use
tags for test specific context, then goes to it and uses an omnisharp test tags for test specific context, then goes to it and uses an omnisharp test
command to unit test it. Basically global test search in C# projects. To use command to unit test it. Basically global test search in C# projects. To use
this, just make sure you have tags compiled and that all your tests are this, just make sure you have tags compiled and that all your tests are
written as some public void *name*\_Test (i.e. they are appended with _Test so written as some public void *name* _Test (i.e. they are appended with _Test so
that the pattern can be matched_) that the pattern can be matched)
** Python ** Python
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(after! python (after! python
@@ -295,8 +297,7 @@ My docsets are stored in .docsets for ease of use
(:prefix "s" (:prefix "s"
:desc "Send region REPL" "r" 'python-shell-send-region :desc "Send region REPL" "r" 'python-shell-send-region
:desc "Send buffer" "b" 'python-shell-send-buffer :desc "Send buffer" "b" 'python-shell-send-buffer
:desc "Send function" "f" 'python-shell-send-defun)) :desc "Send function" "f" 'python-shell-send-defun)))
)
#+END_SRC #+END_SRC
- I do python development for Python3, so I need to set the flycheck python checker, as well as the interpreter, to be Python3 - I do python development for Python3, so I need to set the flycheck python checker, as well as the interpreter, to be Python3
- Most of my python work is in scripts or ideas, so I don't need extensive testing utilities or anything like that - Most of my python work is in scripts or ideas, so I don't need extensive testing utilities or anything like that
@@ -313,14 +314,9 @@ My docsets are stored in .docsets for ease of use
:new-connection (lsp-stdio-connection "typescript-language-server --stdio") :new-connection (lsp-stdio-connection "typescript-language-server --stdio")
:major-modes '(typescript-mode) :major-modes '(typescript-mode)
:server-id 'typescript))) :server-id 'typescript)))
(map!
:localleader
:map typescript-mode-map
:desc "Format code" "=" 'tide-format)
)
#+END_SRC #+END_SRC
- Typescript (in my opinion) should be indented by 2 - Typescript (in my opinion) should be indented by 2
- I like having one keybind to format a file, thus need to rebind - Setup the LSP server on the lsp-language-id-config in case it hasn't already
** Org ** Org
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(after! org (after! org