Change keys for window control
This commit is contained in:
113
README.org
113
README.org
@@ -119,38 +119,49 @@ Unbind useless keys.
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Useful Functions
|
* Useful Functions
|
||||||
** Edit the config file
|
** Edit This File
|
||||||
A simple funtion to open this file for quick editing.
|
A simple funtion to open this file for quick editing.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun edit-config ()
|
(defun edit-config ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(find-file "~/.emacs.d/README.org"))
|
(find-file "~/.emacs.d/README.org"))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Reformat a whole buffer
|
|
||||||
|
** Reformating
|
||||||
Reindet the whole buffer with ~F12~
|
Reindet the whole buffer with ~F12~
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun indent-buffer ()
|
(defun lux/indent-buffer ()
|
||||||
(interactive)
|
"Reindents the whole buffer"
|
||||||
(save-excursion
|
(interactive)
|
||||||
(indent-region (point-min) (point-max) nil)))
|
(save-excursion
|
||||||
(global-set-key [f12] 'indent-buffer)
|
(indent-region (point-min) (point-max) nil)))
|
||||||
|
(global-set-key [f12] 'lux/indent-buffer)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Split windows and immediately switch to it
|
|
||||||
|
** Window Splitting
|
||||||
|
These are functions for splitting windows and move the cursor over immediately.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun split-right-and-enter ()
|
(defun lux/split-right-and-enter ()
|
||||||
"Split the window to the right and enter it."
|
"Split the window to the right and enter it."
|
||||||
(interactive)
|
(interactive)
|
||||||
(split-window-right)
|
(split-window-right)
|
||||||
(other-window 1))
|
(other-window 1))
|
||||||
(bind-key "C-c 3" 'split-right-and-enter)
|
(bind-key "M-3" 'lux/split-right-and-enter)
|
||||||
|
|
||||||
(defun split-below-and-enter ()
|
(defun lux/split-below-and-enter ()
|
||||||
"Split the window down and enter it."
|
"Split the window down and enter it."
|
||||||
(interactive)
|
(interactive)
|
||||||
(split-window-below)
|
(split-window-below)
|
||||||
(other-window 1))
|
(other-window 1))
|
||||||
(bind-key "C-c 2" 'split-below-and-enter)
|
(bind-key "M-2" 'lux/split-below-and-enter)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
Rebind the default window controls to use "M-*" keys for ease-of-use
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(bind-key "M-1" 'delete-other-windows)
|
||||||
|
(bind-key "M-0" 'delete-window)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Quick buffer switching
|
** Quick buffer switching
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun switch-to-previous-buffer ()
|
(defun switch-to-previous-buffer ()
|
||||||
@@ -158,11 +169,13 @@ Reindet the whole buffer with ~F12~
|
|||||||
(interactive)
|
(interactive)
|
||||||
(switch-to-buffer (other-buffer (current-buffer) 1)))
|
(switch-to-buffer (other-buffer (current-buffer) 1)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Quickly open the links file
|
|
||||||
The link dump is the file to throw all links for later reading in.
|
** The Links File
|
||||||
|
The link dump is the file to throw all links for later reading in.Where the file is located should be set in either =personal.el= or =custom.el=.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defvar lux/link-dump "")
|
(defvar lux/link-dump "")
|
||||||
(defun lux/open-link-dump ()
|
(defun lux/open-link-dump ()
|
||||||
|
"Open the file with the links"
|
||||||
(interactive)
|
(interactive)
|
||||||
(find-file lux/link-dump))
|
(find-file lux/link-dump))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
@@ -226,7 +239,7 @@ This is a minor mode for keeping the cursor at the center of the screen while sc
|
|||||||
(olivetti-mode -1)
|
(olivetti-mode -1)
|
||||||
(lux/center-scroll-mode -1))))
|
(lux/center-scroll-mode -1))))
|
||||||
|
|
||||||
(bind-key "C-c o" 'lux/focus-mode)
|
(bind-key "C-c f" 'lux/focus-mode)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Fonts
|
* Fonts
|
||||||
@@ -302,7 +315,7 @@ Set up the fonts to use. I like the [[https://typeof.net/Iosevka/][Iosevka]] fon
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Dired
|
* Dired
|
||||||
Use the imporved =dired+= package instead of the buildin one.
|
Use the imporoved =dired+= package to extend of the buildin =dired=.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(require 'dired+)
|
(require 'dired+)
|
||||||
|
|
||||||
@@ -400,6 +413,13 @@ Sort commands by recency in ivy windows
|
|||||||
:bind (("C-x f" . ido-find-file)))
|
:bind (("C-x f" . ido-find-file)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** Autocompletion
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package auto-complete
|
||||||
|
:config
|
||||||
|
(ac-config-default))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* Magit
|
* Magit
|
||||||
Magit is THE go to package for using git in emacs.
|
Magit is THE go to package for using git in emacs.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
@@ -537,7 +557,7 @@ This will make sure a self contained single HTML file is created.
|
|||||||
(add-hook 'org-export-before-processing-hook 'my-org-inline-css-hook)
|
(add-hook 'org-export-before-processing-hook 'my-org-inline-css-hook)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Org Mode Bling
|
** Org Mode Bling<
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package org-bullets
|
(use-package org-bullets
|
||||||
:init (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
|
:init (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
|
||||||
@@ -625,26 +645,27 @@ Here we define templates we want to use to quickly capture stuff and automatical
|
|||||||
* Treemacs
|
* Treemacs
|
||||||
Treemacs makes navigating folders and files much easier. This is the default config from [[https://github.com/Alexander-Miller/treemacs][the offical repository]] as a base, with slight modifications to suite my config.
|
Treemacs makes navigating folders and files much easier. This is the default config from [[https://github.com/Alexander-Miller/treemacs][the offical repository]] as a base, with slight modifications to suite my config.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package treemacs
|
(use-package treemacs
|
||||||
:defer t
|
:defer t
|
||||||
:init
|
:init
|
||||||
(with-eval-after-load 'winum
|
(with-eval-after-load 'winum
|
||||||
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
|
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(setq treemacs-show-hidden-files t
|
(setq treemacs-show-hidden-files t
|
||||||
treemacs-sorting 'alphabetic-desc
|
treemacs-sorting 'alphabetic-desc
|
||||||
treemacs-width 35)
|
treemacs-width 35)
|
||||||
|
|
||||||
(treemacs-filewatch-mode t)
|
(treemacs-filewatch-mode t)
|
||||||
(treemacs-toggle-show-dotfiles))
|
(treemacs-toggle-show-dotfiles))
|
||||||
:bind
|
:bind
|
||||||
(:map global-map
|
(:map global-map
|
||||||
("C-x t t" . treemacs)))
|
("C-x t t" . treemacs)
|
||||||
|
("M-9" . treemacs-select-window)))
|
||||||
|
|
||||||
(use-package treemacs-magit
|
(use-package treemacs-magit
|
||||||
:after treemacs magit
|
:after treemacs magit
|
||||||
:ensure t)
|
:ensure t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Elfeed
|
* Elfeed
|
||||||
@@ -714,17 +735,13 @@ Use ~M-o~ to quickly switch.
|
|||||||
((t (:inherit ace-jump-face-foreground :height 3.0))))
|
((t (:inherit ace-jump-face-foreground :height 3.0))))
|
||||||
))
|
))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** htmlize
|
** htmlize
|
||||||
HTML Exporter for org-mode
|
HTML Exporter for org-mode
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package htmlize)
|
(use-package htmlize)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Autocompletion
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(use-package company
|
|
||||||
:config
|
|
||||||
(global-company-mode))
|
|
||||||
#+END_SRC
|
|
||||||
** vterm
|
** vterm
|
||||||
[[https://github.com/akermu/emacs-libvterm][vterm]] is a superiour alternative to the integrated eshell, shell or term modes.
|
[[https://github.com/akermu/emacs-libvterm][vterm]] is a superiour alternative to the integrated eshell, shell or term modes.
|
||||||
The packages only works on linux and reuqires that emacs is compiled with module support (the ~module-file-suffix~ variable will be filled).
|
The packages only works on linux and reuqires that emacs is compiled with module support (the ~module-file-suffix~ variable will be filled).
|
||||||
@@ -761,14 +778,15 @@ Ag.el allows you to search using ~ag~ from inside Emacs. You can filter by file
|
|||||||
** Elisp
|
** Elisp
|
||||||
Some customization for writing elisp
|
Some customization for writing elisp
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun my-elisp-mode-hook ()
|
(defun my-elisp-mode-hook ()
|
||||||
"My elisp customizations."
|
"My elisp customizations."
|
||||||
(electric-pair-mode 1)
|
(electric-pair-local-mode 1)
|
||||||
(add-hook 'before-save-hook 'check-parens nil t)
|
(add-hook 'before-save-hook 'check-parens nil t)
|
||||||
(auto-composition-mode nil))
|
(auto-composition-mode nil))
|
||||||
|
|
||||||
(add-hook 'emacs-lisp-mode-hook 'my-elisp-mode-hook)
|
(add-hook 'emacs-lisp-mode-hook 'my-elisp-mode-hook)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Load additional files
|
* Load additional files
|
||||||
All information about the current user should reside in the ~personal.el~ file.
|
All information about the current user should reside in the ~personal.el~ file.
|
||||||
This file contains personal information like name, email or other identifying information.
|
This file contains personal information like name, email or other identifying information.
|
||||||
@@ -785,3 +803,4 @@ It conatins customizations and file locations that are machine dependend.
|
|||||||
(setq custom-file "~/.emacs.d/custom.el")
|
(setq custom-file "~/.emacs.d/custom.el")
|
||||||
(load custom-file 'noerror)
|
(load custom-file 'noerror)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user