summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.org109
-rw-r--r--init.el2
2 files changed, 62 insertions, 49 deletions
diff --git a/config.org b/config.org
index d64561a..68591e6 100644
--- a/config.org
+++ b/config.org
@@ -82,7 +82,13 @@ Also using relative line numbers.
*** Enable whitespace-mode
#+begin_src emacs-lisp
+ (setq whitespace-line-column 72)
+ (setq whitespace-style
+ '(face trailing tabs newline missing-newline-at-eof empty
+ indentation space-after-tab space-before-tab tab-mark
+ newline-mark))
(global-whitespace-mode 1)
+
#+end_src
*** Enable prettify symbols
@@ -347,7 +353,7 @@ My preferred org-mode defaults
* Custom functions
-** Toggle Transparency
+** toggle-transparency
Function to toggle transparency
@@ -355,6 +361,7 @@ Function to toggle transparency
(defconst frame-transparency 85)
(defun toggle-transparency ()
+ "Toggle transparency. Requires a compositor, e.g picom."
(interactive)
(let ((frame-alpha (frame-parameter nil 'alpha)))
(if (or (not frame-alpha)
@@ -363,68 +370,74 @@ Function to toggle transparency
`(,frame-transparency
,frame-transparency))
(set-frame-parameter nil 'alpha '(100 100)))))
- (global-set-key (kbd "C-c t") 'toggle-transparency)
+ (global-set-key (kbd "C-c C-SPC t") 'toggle-transparency)
#+end_src
-** Config edit/reload
+** config-edit/-reload
*** edit
#+begin_src emacs-lisp
(defun config-visit ()
+ "Visit config.org file."
(interactive)
(find-file "~/.emacs.d/config.org"))
- (global-set-key (kbd "C-c e") 'config-visit)
+ (global-set-key (kbd "C-c C-SPC e") 'config-visit)
#+end_src
*** reload
#+begin_src emacs-lisp
(defun config-reload ()
+ "Reload the emacs configuration file."
(interactive)
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
- (global-set-key (kbd "C-c l") 'config-reload)
+ (global-set-key (kbd "C-c C-SPC r") 'config-reload)
#+end_src
-** Kill all buffers
+** kill all buffers
#+begin_src emacs-lisp
(defun kill-all-buffers ()
+ "Kill all currently open buffers."
(interactive)
(mapc 'kill-buffer (buffer-list)))
(global-set-key (kbd "C-M-s-k") 'kill-all-buffers)
#+end_src
-** Always kill current buffer
-
-#+begin_src emacs-lisp
- (defun kill-curr-buffer ()
- (interactive)
- (kill-buffer (current-buffer)))
- (global-set-key (kbd "C-x C-k") 'kill-curr-buffer)
-#+end_src
-
-** Find-next-file
+** find-next-file and find-prev-file
#+begin_src emacs-lisp
- (defun find-next-file (&optional backward)
- "Find the next file (by name) in the current directory.
-
- With prefix arg, find the previous file."
+ (defun find-next-file ()
+ "Find the next file (by name) in the current directory."
(interactive "P")
(when buffer-file-name
(let* ((file (expand-file-name buffer-file-name))
(files (cl-remove-if (lambda (file) (cl-first (file-attributes file)))
(sort (directory-files (file-name-directory file) t nil t) 'string<)))
- (pos (mod (+ (cl-position file files :test 'equal) (if backward -1 1))
+ (pos (mod (+ (cl-position file files :test 'equal) 1)
(length files))))
(find-file (nth pos files)))))
- (global-set-key (kbd "C-c C-n") 'find-next-file)
- (global-set-key (kbd "C-c C-p") (lambda () (interactive) (find-next-file :backward)))
-#+end_src
+ (defun find-prev-file ()
+ "Find the prev file (by name) in the current directory."
+ (interactive)
+ (when buffer-file-name
+ (let* ((file (expand-file-name buffer-file-name))
+ (files (cl-remove-if (lambda (file) (cl-first (file-attributes file)))
+ (sort (directory-files (file-name-directory file) t nil t) 'string<)))
+ (pos (mod (+ (cl-position file files :test 'equal) -1)
+ (length files))))
+ (find-file (nth pos files)))))
-** Moving around brackets
+
+ (global-set-key (kbd "C-c C-SPC n") 'find-next-file)
+ (global-set-key (kbd "C-c C-SPC p") 'find-prev-file)
+
+
+ #+end_src
+
+** moving around brackets
Taken from [[http://xahlee.info][Xah Lee]].
@@ -464,9 +477,11 @@ Taken from [[http://xahlee.info][Xah Lee]].
Version: 2015-10-01"
(interactive)
(re-search-forward (regexp-opt xah-right-brackets) nil t))
+ (global-set-key (kbd "C-9") 'xah-backward-left-bracket)
+ (global-set-key (kbd "C-0") 'xah-forward-right-bracket)
#+end_src
-** Insert newline above/below
+** insert newline above/below
Inserts a newline above or below, like O and o in vim
@@ -487,26 +502,26 @@ Inserts a newline above or below, like O and o in vim
(global-set-key (kbd "M-o") 'newline-below-and-move)
#+end_src
-** Compilation mode
+** compilation mode
#+begin_src emacs-lisp
(setq-default compilation-scroll-output t)
(defun colorize-compilation-buffer ()
+ "Colorize the compilation buffer"
(read-only-mode nil)
(ansi-color-apply-on-region compilation-filter-start (point))
(read-only-mode 1))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
#+end_src
-** Create TAGS
+** create TAGS
#+begin_src emacs-lisp
(defun create-tags (dir-name)
"Create TAGS file."
(interactive "DDirectory")
(cd dir-name)
- (shell-command "ctags -e -R *")
- )
+ (shell-command "ctags -e -R *"))
#+end_src
* Use-Package section
@@ -780,23 +795,23 @@ Autocompletion backend for C and C++
# (c-mode . c-ts-mode)
# (c++-mode . c++-ts-mode)))
# #+end_src
-* Custom keybinds
+* Custom keybinds and re-binds
Some keybinds to make life easier
-** Make <menu> do M-x
+** make <menu> do M-x
#+begin_src emacs-lisp
(global-set-key (kbd "<menu>") 'smex)
#+end_src
-** Open URL in browser
+** open URL in browser
#+begin_src emacs-lisp
- (global-set-key (kbd "C-c o") 'browse-url-at-point)
+ (global-set-key (kbd "C-c C-SPC o") 'browse-url-at-point)
#+end_src
-** More comfortable resize bindings
+** more comfortable resize bindings
#+begin_src emacs-lisp
(global-set-key (kbd "s-C-<left>") 'shrink-window-horizontally)
@@ -805,29 +820,22 @@ Some keybinds to make life easier
(global-set-key (kbd "s-C-<up>") 'enlarge-window)
#+end_src
-** Xah Lee bracket movement
+** comment / uncomment line rebind
#+begin_src emacs-lisp
- (global-set-key (kbd "C-9") 'xah-backward-left-bracket)
- (global-set-key (kbd "C-0") 'xah-forward-right-bracket)
+ (global-set-key (kbd "C-c C-SPC c") 'comment-line)
#+end_src
-** Comment / uncomment line rebind
+** bind compile command to C-c m
#+begin_src emacs-lisp
- (global-set-key (kbd "C-c c") 'comment-line)
-#+end_src
-
-** Bind compile command to C-c m
-
-#+begin_src emacs-lisp
- (global-set-key (kbd "C-c m") 'compile)
+ (global-set-key (kbd "C-c C-SPC m") 'compile)
#+end_src
** inf-ruby command to C-c s
#+begin_src emacs-lisp
- (global-set-key (kbd "C-c s") 'inf-ruby)
+ (global-set-key (kbd "C-c C-SPC s") 'inf-ruby)
#+end_src
** duplicate-line to C-.
@@ -842,6 +850,9 @@ Some keybinds to make life easier
#+begin_src emacs-lisp
(global-set-key (kbd "C-s-.") 'copy-from-above-command)
#+end_src
-
-
+** kill current buffer
+
+#+begin_src emacs-lisp
+ (global-set-key (kbd "C-x C-k") 'kill-current-buffer)
+#+end_src
diff --git a/init.el b/init.el
index ad75e8d..cfae837 100644
--- a/init.el
+++ b/init.el
@@ -36,6 +36,7 @@
(require 'simpc-mode)
(set-default-file-modes #o700)
+(setq-default fill-column 72)
;;(load-theme 'dracula-custom t)
(load-theme 'modus-operandi t)
@@ -46,3 +47,4 @@
(load custom-file 'noerror 'nomessage)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
+