├── .gitignore ├── README.org ├── img ├── avatar.png └── screen.png ├── init.el └── config.org /.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | config.org -------------------------------------------------------------------------------- /img/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bugswriter/BugsWritersEmacs/HEAD/img/avatar.png -------------------------------------------------------------------------------- /img/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bugswriter/BugsWritersEmacs/HEAD/img/screen.png -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | (require 'package) 2 | (setq package-enable-at-startup nil) 3 | 4 | (add-to-list 'package-archives 5 | '("melpa" . "https://melpa.org/packages/")) 6 | 7 | (package-initialize) 8 | 9 | (unless (package-installed-p 'use-package) 10 | (package-refresh-contents) 11 | (package-install 'use-package)) 12 | 13 | (org-babel-load-file (expand-file-name "~/.emacs.d/config.org")) 14 | (set-fontset-font "fontset-default" 'unicode "Noto Color Emoji") 15 | -------------------------------------------------------------------------------- /config.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+TITLE: Archmacs Config 3 | #+CREATOR: suraj 4 | #+LANGUAGE: en 5 | [[./img/screen.png]] 6 | 7 | * Installation 8 | =git clone https://github.com/bugswriter/ArchMacs.git ~/.emacs.d= 9 | Don't forget to remove your own =~/.emacs= and your =~/.emacs.d= prior 10 | to cloning this configuration. After cloning next time when you launch 11 | emacs you it's will take some time to collect all packages, you may also 12 | encounter some warnings and errors which are safe to ignore as long as 13 | you relaunch emacs and see none. 14 | 15 | The configuration is written in org mode, which means it's self documented. 16 | So you should try reading, understanding and tweaking according to your liking. 17 | 18 | * Dependencies 19 | Many /melpa/ packages in this configurationn depends on Arch Linux packages too. 20 | Some of these packages exist in main repo and for some packages you have 21 | to use AUR. If you are not on Arch or any Arch based distro. 22 | I am pretty sure you will find these packages for your distro too. 23 | 24 | Here is a nice table to display all required packages. 25 | |---------------+----------------------| 26 | | Package | Purpose? | 27 | |---------------+----------------------| 28 | | xorg-server | obvious reasons | 29 | | amixer | control sound volume | 30 | | brightnessctl | change brightness | 31 | | scrot | taking screenshots | 32 | | TLP | wifi and bluetooth | 33 | | slock | screenlock | 34 | | upower | keyboard backlight | 35 | | mpd | listening songs | 36 | |---------------+----------------------| 37 | * Appearance 38 | My Archmacs have killer looks. The code of this section is responsible for it. 39 | ** Theme 40 | When my crush rejected me by saying you are ugly. I learned that looks matter alot. 41 | My emacs will not be ugly like me and no one will dump my config for this. 42 | So I decided to use =doom-themes=. You can change =doom-themes= to any other theme. 43 | #+BEGIN_SRC emacs-lisp 44 | (use-package doom-themes 45 | :if window-system 46 | :ensure t 47 | :config 48 | (load-theme 'doom-molokai t) 49 | (doom-themes-org-config) 50 | (doom-themes-visual-bell-config) 51 | (menu-bar-mode -1) 52 | (tool-bar-mode -1) 53 | (fringe-mode -1) 54 | (scroll-bar-mode -1)) 55 | #+END_SRC 56 | ** Font 57 | Just like with power comes great responsibility, with great theme comes great font. 58 | Here I use =JetBrains Mono= Which is similar to =fira=. Feel free to change if you 59 | have shitty taste. 60 | #+BEGIN_SRC emacs-lisp 61 | (add-to-list 'default-frame-alist 62 | '(font . "JetBrains Mono-14")) 63 | #+END_SRC 64 | 65 | * Basic Interface Settings 66 | These are settings that do not depend on packages and built-in enchancements to the UI. 67 | ** Looks 68 | *** Remove lame startup screen 69 | We use an actual replacement for it, keep reading or head directly to dashboard 70 | #+BEGIN_SRC emacs-lisp 71 | (setq inhibit-startup-message t) 72 | #+END_SRC 73 | 74 | *** Disable menus and scrollbars 75 | If you like using any of those, change =-1= to =1=. 76 | #+BEGIN_SRC emacs-lisp 77 | (tool-bar-mode -1) 78 | (menu-bar-mode -1) 79 | (scroll-bar-mode -1) 80 | #+END_SRC 81 | 82 | *** Disable bell 83 | This is annoying, remove this line if you like being visually reminded of events. 84 | #+BEGIN_SRC emacs-lisp 85 | (setq ring-bell-function 'ignore) 86 | #+END_SRC 87 | 88 | *** Set UTF-8 encoding 89 | #+BEGIN_SRC emacs-lisp 90 | (setq locale-coding-system 'utf-8) 91 | (set-terminal-coding-system 'utf-8) 92 | (set-keyboard-coding-system 'utf-8) 93 | (set-selection-coding-system 'utf-8) 94 | (prefer-coding-system 'utf-8) 95 | #+END_SRC 96 | 97 | ** Functionality 98 | *** Disable backups and auto-saves 99 | I don't use either, you might want to turn those from =nil= to =t= if you do. 100 | 101 | #+BEGIN_SRC emacs-lisp 102 | (setq make-backup-files nil) 103 | (setq auto-save-default nil) 104 | #+END_SRC 105 | 106 | *** Change yes-or-no questions into y-or-n questions 107 | 108 | #+BEGIN_SRC emacs-lisp 109 | (defalias 'yes-or-no-p 'y-or-n-p) 110 | #+END_SRC 111 | 112 | *** Async 113 | Lets us use asynchronous processes whereever possible, pretty useful. 114 | #+BEGIN_SRC emacs-lisp 115 | (use-package async 116 | :ensure t 117 | :init (dired-async-mode 1)) 118 | #+END_SRC 119 | 120 | ** Cool Icons 121 | #+BEGIN_SRC emacs-lisp 122 | (use-package all-the-icons 123 | :ensure t 124 | :init) 125 | 126 | (use-package all-the-icons-dired 127 | :ensure t 128 | :init (add-hook 'dired-mode-hook 'all-the-icons-dired-mode)) 129 | 130 | (use-package all-the-icons-ibuffer 131 | :ensure t 132 | :init (all-the-icons-ibuffer-mode 1)) 133 | #+END_SRC 134 | 135 | ** Async 136 | #+BEGIN_SRC emacs-lisp 137 | (use-package async 138 | :ensure t 139 | :init (dired-async-mode 1)) 140 | #+END_SRC 141 | 142 | * Window Manager 143 | Yes, emacs can work as a window manager. You can run browsers, media players, games, vim... 144 | everything inside emacs. Because emacs can work as window manager. 145 | This made my life 10x easier. Archmacs don't need any desktop environment, you can just use 146 | emacs to operate your computer. 147 | ** EXWM 148 | *EXWM* is one of the most popular emacs package. EXWM is a window manager. With the help of 149 | this package we can easily run any program inside emacs as a emacs buffer. Which is very cool. 150 | #+BEGIN_SRC emacs-lisp 151 | (use-package exwm 152 | :ensure t 153 | :config 154 | (require 'exwm-config) 155 | (fringe-mode 3) 156 | (server-start) 157 | (exwm-config-ido) 158 | (setq exwm-workspace-number 1) 159 | (exwm-input-set-key (kbd "s-r") #'exwm-reset) 160 | (exwm-input-set-key (kbd "s-k") #'exwm-workspace-delete) 161 | (exwm-input-set-key (kbd "s-w") #'exwm-workspace-swap) 162 | (dotimes (i 10) 163 | (exwm-input-set-key (kbd (format "s-%d" i)) 164 | `(lambda () 165 | (interactive) 166 | (exwm-workspace-switch-create ,i) 167 | (message "Workspace %d", i)))) 168 | (exwm-input-set-key (kbd "s-&") 169 | (lambda (command) 170 | (interactive (list (read-shell-command "$ "))) 171 | (start-process-shell-command command nil command))) 172 | (exwm-enable)) 173 | #+END_SRC 174 | ** Desktop Environment 175 | This little package single handedly handle lot of small functionality which we need to 176 | use emacs as a deskto environment. 177 | Here is the list of things this package will take care of - 178 | - Controling sound volume with volume key (inc,dec,mute) 179 | - Controling brightness with brightness key (inc/dec) 180 | - Taking Screenshot with print screen key 181 | - Handles wifi and bluetooth. 182 | - Handle lockscreen. 183 | I recommend you to read more about this package functionality on - [[https://github.com/DanmienCassou/desktop-environe][It's Github]] 184 | #+BEGIN_SRC emacs-lisp 185 | (use-package desktop-environment 186 | :ensure t 187 | :init 188 | (desktop-environment-mode 1)) 189 | #+END_SRC 190 | ** Dmenu 191 | Now since we can open any program inside emacs, we also need a menu to search and start 192 | any application. For this we can use =dmenu=. Dmenu is suckless utility. But here we 193 | using a melpa package of dmenu which allow dmenu inside emacs. Inside emacs using dmenu 194 | for finding programs is pretty quick. I have bind =s-SPC= to open dmenu which make 195 | it more quicker. 196 | #+BEGIN_SRC emacs-lisp 197 | (use-package dmenu 198 | :ensure t 199 | :bind 200 | ("s-SPC" . 'dmenu)) 201 | #+END_SRC 202 | 203 | * Terminal 204 | Not having a cool terminal inside your text editor is a crime, exactly like saying 205 | Archmacs text editor which I just did. 206 | ** Vterm 207 | Many emacs users including me like vterm. It's more solid and polished. I bind =s-return= 208 | to open terminal because I know you always want terminal ASAP. 209 | #+BEGIN_SRC emacs-lisp 210 | (use-package vterm 211 | :ensure t 212 | :init 213 | (global-set-key (kbd "") 'vterm)) 214 | #+END_SRC 215 | 216 | * Dashboard 217 | This is your new startup screen, together with projectile it works in unison and provides 218 | you with a quick look into you latest projects and files. Change the welcome message to whatever string 219 | you want and change the numbers to suit you liking, I find 5 to be enough. 220 | I also added my image and a cool line from show one punch man, you may want to change that. 221 | #+BEGIN_SRC emacs-lisp 222 | (use-package dashboard 223 | :ensure t 224 | :config 225 | (dashboard-setup-startup-hook) 226 | (setq dashboard-startup-banner "~/.emacs.d/img/avatar.png") 227 | (setq dashboard-items '((recents . 5) 228 | (projects . 5))) 229 | (setq dashboard-banner-logo-title "I am just a coder for fun")) 230 | #+END_SRC 231 | 232 | * Modeline 233 | The modeline is the heart of emacs, it displays information about modes and states 234 | you are in. 235 | ** Spaceline 236 | =Spaceline= is a mode-line theme for spacemacs. It's is simple and looks good. 237 | #+BEGIN_SRC emacs-lisp 238 | (use-package spaceline 239 | :ensure t 240 | :config 241 | (require 'spaceline-config) 242 | (setq powerline-default-separator (quote arrow)) 243 | (spaceline-spacemacs-theme)) 244 | #+END_SRC 245 | ** Diminish Modes 246 | By default there is alot of garbage information about many minor modes in modeline which we 247 | don't want to display. =Diminish= is a package which allow us to remove those. 248 | #+BEGIN_SRC emacs-lisp 249 | (use-package diminish 250 | :ensure t 251 | :init 252 | (diminish 'which-key-mode) 253 | (diminish 'linum-relative-mode) 254 | (diminish 'hungry-delete-mode) 255 | (diminish 'visual-line-mode) 256 | (diminish 'subword-mode) 257 | (diminish 'beacon-mode) 258 | (diminish 'irony-mode) 259 | (diminish 'page-break-lines-mode) 260 | (diminish 'auto-revert-mode) 261 | (diminish 'rainbow-delimiters-mode) 262 | (diminish 'rainbow-mode) 263 | (diminish 'yas-minor-mode) 264 | (diminish 'flycheck-mode) 265 | (diminish 'helm-mode)) 266 | #+END_SRC 267 | 268 | ** System load 269 | By default emacs show system load information which is completely useless to me. 270 | So It's better to remove it. 271 | #+BEGIN_SRC emacs-lisp 272 | (setq display-time-default-load-average nil) 273 | #+END_SRC 274 | ** Fancy Battery 275 | =fancy-battery= is a /melpa/ package to display battery information at modeline. So yeah in 276 | Archmacs you can see battery status inside emacs easily. It's also have lot of fancy way to 277 | warn about low battery and all the other stuff. 278 | #+BEGIN_SRC emacs-lisp 279 | (use-package fancy-battery 280 | :ensure t 281 | :init 282 | (fancy-battery-mode 1) 283 | (setq fancy-battery-show-percentage t)) 284 | #+END_SRC 285 | 286 | * Minor Conveiniences 287 | Emacs is at it's best when it just does things for you, shows you the way, guides you so to 288 | speak. This can be best achieved using a number of small extensions. While on their own they 289 | might not be particularly impressive. 290 | ** Visiting the configuration 291 | Since this config is like a complete doc, it's better to bind a key to open it. 292 | I bind =C-c e= to quickly open =~/.emacs.d/config.org=. 293 | #+BEGIN_SRC emacs-lisp 294 | (defun config-visit () 295 | (interactive) 296 | (find-file "~/.emacs.d/config.org")) 297 | (global-set-key (kbd "C-c e") 'config-visit) 298 | #+END_SRC 299 | ** Reloading the configuration 300 | Closing and opening emacs again after some quick changes in config is pain, especially when 301 | you are using emacs as a window manager. So here I bind a key =C-c r= to do it quickly without 302 | closing emacs. 303 | #+BEGIN_SRC emacs-lisp 304 | (defun config-reload () 305 | (interactive) 306 | (org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))) 307 | (global-set-key (kbd "C-c r") 'config-reload) 308 | #+END_SRC 309 | ** Subwords 310 | Subword will remaps word-based editing commands to subword-based commands that 311 | handle symbols with mixed uppercase and lowercase letters. 312 | #+BEGIN_SRC emacs-lisp 313 | (global-subword-mode 1) 314 | #+END_SRC 315 | ** Electric pair mode 316 | Electric Pair mode, a global minor mode, provides a way to easily insert matching delimiters: 317 | parentheses, braces, brackets, etc. 318 | #+BEGIN_SRC emacs-lisp 319 | (setq electric-pair-pairs '( 320 | (?\{ . ?\}) 321 | (?\( . ?\)) 322 | (?\[ . ?\]) 323 | (?\" . ?\") 324 | )) 325 | (electric-pair-mode t) 326 | #+END_SRC 327 | ** Kill whole word 328 | This is a function which allow you to delete a complete word with one keybind. My keybind 329 | for deleting a word is =C-c w w=. I wish emacs have this feature by default. 330 | #+BEGIN_SRC emacs-lisp 331 | (defun kill-whole-word () 332 | (interactive) 333 | (backward-word) 334 | (kill-word 1)) 335 | (global-set-key (kbd "C-c w w") 'kill-whole-word) 336 | #+END_SRC 337 | ** Hungry delete 338 | I hate pressing backspace and waiting for deleting whitespaces. This package =hungry-delete= 339 | delete all whitespaces with just one click on backspace. 340 | #+BEGIN_SRC emacs-lisp 341 | (use-package hungry-delete 342 | :ensure t 343 | :config (global-hungry-delete-mode)) 344 | #+END_SRC 345 | ** Copy whole line 346 | Emacs by default don't have any function which copy the whole line. But gladly emacs gave us 347 | power to write our own functions. So I write my own and bind it to =C-c w l=. 348 | #+BEGIN_SRC emacs-lisp 349 | (defun copy-whole-line () 350 | (interactive) 351 | (save-excursion 352 | (kill-new 353 | (buffer-substring 354 | (point-at-bol) 355 | (point-at-eol))))) 356 | (global-set-key (kbd "C-c w l") 'copy-whole-line) 357 | #+END_SRC 358 | ** Beacon 359 | While changing buffers or workspaces, the first thing you do is look for you cursor. Unless 360 | you know its position, you can not move it efficiently. Every time you change buffers, the 361 | current position of your cursor will be briefly highlighted now. 362 | #+BEGIN_SRC emacs-lisp 363 | (use-package beacon 364 | :ensure t 365 | :config 366 | (beacon-mode 1)) 367 | #+END_SRC 368 | ** Rainbow 369 | Mostly useful if you are into web development or game development. Every time emacs encounters 370 | a hexadeimal code that resembles a color, it will automatically highlight it in the appropriate 371 | color. This is a lot cooler than you may think. 372 | #+BEGIN_SRC emacs-lisp 373 | (use-package rainbow-mode 374 | :ensure t 375 | :init (add-hook 'prog-mode-hook 'rainbow-mode)) 376 | #+END_SRC 377 | ** Rainbow Delimiter 378 | Colors parentheses and other delimiters depending on their depth, useful for any language 379 | using them, especially lisp. 380 | #+BEGIN_SRC emacs-lisp 381 | (use-package rainbow-delimiters 382 | :ensure t 383 | :init 384 | (rainbow-delimiters-mode 1)) 385 | #+END_SRC 386 | ** Expand region 387 | A pretty simple package, takes your cursor and sementically expands the region, so words, 388 | sentencies, maybe the contents of some parentheses, it's awesome, try it out. 389 | #+BEGIN_SRC emacs-lisp 390 | (use-package expand-region 391 | :ensure t 392 | :bind ("C-q" . er/expand-region)) 393 | #+END_SRC 394 | ** Zapping to char 395 | A nifty little package that kills all text between your cursor and a selected character. A lot 396 | more useful than you might think. If you with to include the selected character in the killed 397 | region, change =zzz-up-to-char= into =zzz-to-char=. 398 | #+BEGIN_SRC emacs-lisp 399 | (use-package zzz-to-char 400 | :ensure t 401 | :bind ("M-z" . zzz-up-to-char)) 402 | #+END_SRC 403 | 404 | * Kill ring 405 | There is lot of cutomization to the kill ring, and while I have not used it much before, I 406 | decided that it was time to change that. 407 | ** Maximum entried on the ring 408 | The default is 60, I personally need more sometimes. 409 | #+BEGIN_SRC emacs-lisp 410 | (setq kill-ring-max 100) 411 | #+END_SRC 412 | ** popup-kill-ring 413 | Out of all the packages I tried out, this one being the simplest, appealed to me most. With a 414 | simple M-y you can now browse your kill-ring like browsing autocompletion items. C-n and C-p 415 | totally work for this. 416 | #+BEGIN_SRC emacs-lisp 417 | (use-package popup-kill-ring 418 | :ensure t 419 | :bind ("M-y" . popup-kill-ring)) 420 | #+END_SRC 421 | * Git integration 422 | Countless are the times where I opened vterm and use =git= on something. These times are also 423 | something that I'd prefer stay in the past, since =magit= is great. It's easy and intuitive to 424 | use, shows its options at a keypress and much more. 425 | ** Magit 426 | =magit= is a amazing /melpa/ package which allow me to use git within emacs more better way. 427 | #+BEGIN_SRC emacs-lisp 428 | (use-package magit 429 | :ensure t 430 | :config 431 | (setq magit-push-always-verify nil) 432 | (setq git-commit-summary-max-length 50) 433 | :bind 434 | ("M-g" . magit-status)) 435 | #+END_SRC 436 | * Sudo edit 437 | Opening nano to edit files which require root permission is pain in the butt. This package 438 | =sudo-edit= allow us to edit files which require root permission with emacs. 439 | #+BEGIN_SRC emacs-lisp 440 | (use-package sudo-edit 441 | :ensure t 442 | :bind ("s-e" . sudo-edit)) 443 | #+END_SRC 444 | 445 | * Org 446 | One of the absolute greatest features of emacs is called “org-mode”. This very file has been 447 | written in org-mode, a lot of other configurations are written in org-mode, same goes for 448 | academic papers, presentations, schedules, blogposts and guides. Org-mode is one of the most 449 | complex things ever, lets make it a bit more usable with some basic configuration. 450 | 451 | Those are all rather self-explanatory. 452 | ** Common Settings 453 | These are just some common settings which makes working in org mode more better. 454 | #+BEGIN_SRC emacs-lisp 455 | (setq org-ellipsis " ") 456 | (setq org-src-fontify-natively t) 457 | (setq org-src-tab-acts-natively t) 458 | (setq org-confirm-babel-evaluate nil) 459 | (setq org-export-with-smart-quotes t) 460 | (setq org-src-window-setup 'current-window) 461 | (add-hook 'org-mode-hook 'org-indent-mode) 462 | #+END_SRC 463 | ** Org Bullets 464 | Pretty bullets to make your org file more pretty and managed. 465 | #+BEGIN_SRC emacs-lisp 466 | (use-package org-bullets 467 | :ensure t 468 | :config 469 | (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) 470 | #+END_SRC 471 | * Buffers 472 | Workflow with emacs depends alot on Buffers. If you know how to quickly change and manage 473 | buffers, you are not a novice in emacs. Sadly by default emacs have some bad way to manage 474 | buffers. Here I tried to encounter those issues. 475 | *** Always murder current buffer 476 | Doing =C-x k= should kill the current buffer at all times. 477 | #+BEGIN_SRC emacs-lisp 478 | (defun kill-curr-buffer () 479 | (interactive) 480 | (kill-buffer (current-buffer))) 481 | (global-set-key (kbd "C-x k") 'kill-curr-buffer) 482 | #+END_SRC 483 | *** Toggle maximize buffer 484 | An Emacs function to temporarily make one buffer fullscreen. You can quickly restore the old window setup. 485 | #+BEGIN_SRC emacs-lisp 486 | (defun toggle-maximize-buffer () "Maximize buffer" 487 | (interactive) 488 | (if (= 1 (length (window-list))) 489 | (jump-to-register '_) 490 | (progn 491 | (set-register '_ (list (current-window-configuration))) 492 | (delete-other-windows)))) 493 | (global-set-key [(super shift return)] 'toggle-maximize-buffer) 494 | #+END_SRC 495 | 496 | * Projectile 497 | Projectile is an awesome project manager, mostly because it recognized directories with =.git= 498 | directory as projects and helps you manage them accordingly. 499 | ** Enable projectile globally 500 | This makes sure that everything can be a project. 501 | #+BEGIN_SRC emacs-lisp 502 | (use-package projectile 503 | :ensure t 504 | :init 505 | (projectile-mode 1)) 506 | #+END_SRC 507 | ** Let projectile call make 508 | #+BEGIN_SRC emacs-lisp 509 | (global-set-key (kbd "") 'projectile-compile-project) 510 | #+END_SRC 511 | 512 | * Which Key 513 | #+BEGIN_SRC emacs-lisp 514 | (use-package which-key 515 | :ensure t 516 | :init 517 | (which-key-mode)) 518 | #+END_SRC 519 | * Text Manipulation 520 | * Telega 521 | Telega is an amazing telegram client inside emacs. I use this very often it contain nearly 522 | all tdesktop features, even it's better and obviously more faster to use because .. emacs. 523 | #+BEGIN_SRC emacs-lisp 524 | (use-package telega 525 | :load-path "~/telega.el" 526 | :commands (telega) 527 | :defer t 528 | :config 529 | (setq telega-symbol-folder "📂") 530 | :init 531 | (telega-notifications-mode 1)) 532 | (add-hook 'telega-load-hook 'global-telega-squash-message-mode) 533 | #+END_SRC 534 | 535 | * IDO 536 | ** Enable IDO mode 537 | #+BEGIN_SRC emacs-lisp 538 | (setq ido-enable-flex-matching t) 539 | (setq ido-everywhere t) 540 | (ido-mode 1) 541 | #+END_SRC 542 | 543 | ** IDO vertical 544 | #+BEGIN_SRC emacs-lisp 545 | (use-package ido-vertical-mode 546 | :ensure t 547 | :init 548 | (ido-vertical-mode 1)) 549 | (setq ido-vertical-define-keys 'C-n-and-C-p-only) 550 | #+END_SRC 551 | 552 | ** Smex 553 | #+BEGIN_SRC emacs-lisp 554 | (use-package smex 555 | :ensure t 556 | :init (smex-initialize) 557 | :bind 558 | ("M-x" . smex)) 559 | #+END_SRC 560 | 561 | * Buffers 562 | ** Enable ibuffer 563 | #+BEGIN_SRC emacs-lisp 564 | (global-set-key (kbd "C-x C-b") 'ibuffer) 565 | #+END_SRC 566 | 567 | ** Expert mode 568 | #+BEGIN_SRC emacs-lisp 569 | (setq ibuffer-expert t) 570 | #+END_SRC 571 | 572 | ** Kill all buffers 573 | #+BEGIN_SRC emacs-lisp 574 | (defun kill-all-buffers () 575 | (interactive) 576 | (mapc 'kill-buffer (buffer-list))) 577 | (global-set-key (kbd "C-M-s-k") 'kill-all-buffers) 578 | #+END_SRC 579 | 580 | * Avy 581 | #+BEGIN_SRC emacs-lisp 582 | (use-package avy 583 | :ensure t 584 | :bind 585 | ("C-." . avy-goto-char)) 586 | #+END_SRC 587 | 588 | 589 | 590 | * Config edit/reload 591 | 592 | 593 | 594 | * Moving Around Emacs 595 | ** Switch Window 596 | #+BEGIN_SRC emacs-lisp 597 | (use-package switch-window 598 | :ensure t 599 | :config 600 | (setq switch-window-input-style 'minibuffer) 601 | (setq switch-window-increase 4) 602 | (setq switch-window-threshold 2) 603 | (setq switch-window-shortcut-style 'qwerty) 604 | (setq switch-window-qwerty-shortcuts 605 | '("a" "s" "d" "f" "h" "j" "k" "l")) 606 | :bind 607 | ([remap other-window] . switch-window)) 608 | #+END_SRC 609 | 610 | ** Following window splits 611 | #+BEGIN_SRC emacs-lisp 612 | (defun split-and-follow-horizontally () 613 | (interactive) 614 | (split-window-below) 615 | (balance-windows) 616 | (other-window 1)) 617 | (global-set-key (kbd "C-x 2") 'split-and-follow-horizontally) 618 | 619 | (defun split-and-follow-vertically () 620 | (interactive) 621 | (split-window-right) 622 | (balance-windows) 623 | (other-window 1)) 624 | (global-set-key (kbd "C-x 3") 'split-and-follow-vertically) 625 | #+END_SRC 626 | 627 | 628 | * Auto Completion 629 | ** Company 630 | #+BEGIN_SRC emacs-lisp 631 | (use-package company 632 | :ensure t 633 | :config 634 | (setq company-idle-delay 1) 635 | (setq company-minimum-prefix-length 3) 636 | :init 637 | (company-mode 1)) 638 | 639 | (with-eval-after-load 'company 640 | (define-key company-active-map (kbd "M-n") nil) 641 | (define-key company-active-map (kbd "M-p") nil) 642 | (define-key company-active-map (kbd "C-n") #'company-select-next) 643 | (define-key company-active-map (kbd "C-p") #'company-select-previous) 644 | (define-key company-active-map (kbd "SPC") #'company-abort)) 645 | #+END_SRC 646 | 647 | * Swiper 648 | #+BEGIN_SRC emacs-lisp 649 | (use-package swiper 650 | :ensure t 651 | :bind ("C-s" . swiper)) 652 | #+END_SRC 653 | 654 | * Clock 655 | A clock to see time. Because time is important. 656 | ** Time Format 657 | #+BEGIN_SRC emacs-lisp 658 | (setq display-time-24hr-format t) 659 | (setq display-time-format "%H:%M") 660 | #+END_SRC 661 | 662 | ** Enabling the mode 663 | #+BEGIN_SRC emacs-lisp 664 | (display-time-mode 1) 665 | #+END_SRC 666 | 667 | * Music 668 | Music in emacs 669 | ** EMMS 670 | #+BEGIN_SRC emacs-lisp 671 | (use-package emms 672 | :ensure t 673 | :config 674 | (require 'emms-setup) 675 | (require 'emms-player-mpd) 676 | (emms-all) ; don't change this to values you see on stackoverflow questions if you expect emms to work 677 | (setq emms-seek-seconds 5) 678 | (setq emms-player-list '(emms-player-mpd)) 679 | (setq emms-info-functions '(emms-info-mpd)) 680 | (setq emms-player-mpd-server-name "localhost") 681 | (setq emms-player-mpd-server-port "6602") 682 | :bind 683 | ("s-m p" . emms) 684 | ("s-m b" . emms-smart-browse) 685 | ("s-m r" . emms-player-mpd-update-all-reset-cache) 686 | ("" . emms-previous) 687 | ("" . emms-next) 688 | ("" . emms-pause) 689 | ("" . emms-stop)) 690 | #+END_SRC 691 | ** MPC 692 | #+BEGIN_SRC emacs-lisp 693 | (setq mpc-host "localhost:6602") 694 | 695 | (defun mpd/start-music-daemon () 696 | "Start MPD, connects to it and syncs the metadata cache." 697 | (interactive) 698 | (shell-command "mpd") 699 | (mpd/update-database) 700 | (emms-player-mpd-connect) 701 | (emms-cache-set-from-mpd-all) 702 | (message "MPD Started!")) 703 | (global-set-key (kbd "s-m c") 'mpd/start-music-daemon) 704 | 705 | 706 | (defun mpd/kill-music-daemon () 707 | "Stops playback and kill the music daemon." 708 | (interactive) 709 | (emms-stop) 710 | (call-process "killall" nil nil nil "mpd") 711 | (message "MPD Killed!")) 712 | (global-set-key (kbd "s-m k") 'mpd/kill-music-daemon) 713 | 714 | (defun mpd/update-database () 715 | "Updates the MPD database synchronously." 716 | (interactive) 717 | (call-process "mpc" nil nil nil "update") 718 | (message "MPD Database Updated!")) 719 | (global-set-key (kbd "s-m u") 'mpd/update-database) 720 | #+END_SRC 721 | * Symon 722 | * EMMS 723 | Music player 724 | #+BEGIN_SRC emacs-lisp 725 | (use-package emms 726 | :ensure t 727 | :config 728 | (require 'emms-setup) 729 | (require 'emms-player-mpd) 730 | (emms-all) ; don't change this to values you see on stackoverflow questions if you expect emms to work 731 | (setq emms-seek-seconds 5) 732 | (setq emms-player-list '(emms-player-mpd)) 733 | (setq emms-info-functions '(emms-info-mpd)) 734 | (setq emms-player-mpd-server-name "localhost") 735 | (setq emms-player-mpd-server-port "6602") 736 | :bind 737 | ("s-m p" . emms) 738 | ("s-m b" . emms-smart-browse) 739 | ("s-m r" . emms-player-mpd-update-all-reset-cache) 740 | ("" . emms-previous) 741 | ("" . emms-next) 742 | ("" . emms-pause) 743 | ("" . emms-stop)) 744 | #+END_SRC 745 | MPC 746 | #+BEGIN_SRC emacs-lisp 747 | (setq mpc-host "localhost:6602") 748 | (defun mpd/start-music-daemon () 749 | "Start MPD, connects to it and syncs the metadata cache." 750 | (interactive) 751 | (shell-command "mpd") 752 | (mpd/update-database) 753 | (emms-player-mpd-connect) 754 | (emms-cache-set-from-mpd-all) 755 | (message "MPD Started!")) 756 | (global-set-key (kbd "s-m c") 'mpd/start-music-daemon) 757 | 758 | (defun mpd/kill-music-daemon () 759 | "Stops playback and kill the music daemon." 760 | (interactive) 761 | (emms-stop) 762 | (call-process "killall" nil nil nil "mpd") 763 | (message "MPD Killed!")) 764 | (global-set-key (kbd "s-m k") 'mpd/kill-music-daemon) 765 | 766 | (defun mpd/update-database () 767 | "Updates the MPD database synchronously." 768 | (interactive) 769 | (call-process "mpc" nil nil nil "update") 770 | (message "MPD Database Updated!")) 771 | (global-set-key (kbd "s-m u") 'mpd/update-database) 772 | 773 | #+END_SRC 774 | 775 | #+BEGIN_SRC emacs-lisp 776 | (use-package fancy-battery 777 | :ensure t) 778 | 779 | #+END_SRC 780 | 781 | 782 | * Dired Launch 783 | #+BEGIN_SRC emacs-lisp 784 | (use-package dired-launch 785 | :ensure t 786 | :init 787 | (dired-launch-enable)) 788 | #+END_SRC 789 | 790 | 791 | --------------------------------------------------------------------------------