armacs/customsrc/dev.org
Abraham Raji 545488a086 update
2020-01-11 18:19:34 +05:30

3 KiB
Raw Blame History

Brackets using electric

If you write any code, you may enjoy this. Typing the first character in a set of 2, completes the second one after your cursor. Opening a bracket? Its closed for you already. Quoting something? Its closed for you already. You can easily add and remove pairs yourself, have a look.

(setq electric-pair-pairs '(
                           (?\{ . ?\})
                           (?\( . ?\))
                           (?\[ . ?\])
                           (?\" . ?\")
                           ))
(electric-pair-mode t)

Semantic Selection

So what this package does is it select text in way that's sensibe towards the syntax. So for example if I'm in a html tag that is the child of another tag, invoking the keybinding for this package will first select the child then the parent and hierarchichally move upwards. No need to drag the mouse around, this is selection done sensibly.

(use-package expand-region
  :bind ("C-=" . er/expand-region))

Multiple Cursors

Multiple cursors for Emacs. Multiple cursors is a very nice package that lets you create several cursors that all do the same thing as you type (see the example below). You can add it to emacs using the steps described here Once you have installed it, it is useful to set up a keybinding (a keyboard short- cut) for it. You can do this by adding the following to your emacs config file to set C-c m c as the binding for multiple cursors.

(use-package multiple-cursors
:ensure t)
(require 'multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)

Project Management

Projectile is a project interaction library for Emacs. Its goal is to provide a nice set of features operating on a project level without introducing external dependencies (when feasible). For instance - finding project files has a portable implementation written in pure Emacs Lisp without the use of GNU find (but for performance sake an indexing mechanism backed by external commands exists as well).

Projectile tries to be practical - portability is great, but if some external tools could speed up some task substantially and the tools are available, Projectile will leverage them

(use-package projectile
:ensure t
  :init
  (projectile-mode 1))

Parentheses

  • When programming I like my editor to try to help me with keeping parentheses balanced.
  (use-package smartparens
    :diminish smartparens-mode
    :config
    (add-hook 'prog-mode-hook 'smartparens-mode))
  • Highlight parens etc. for improved readability.
  (use-package rainbow-delimiters
    :config
    (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))

Version Control

(org-babel-load-file (expand-file-name "~/.emacs.d/customsrc/versionctrl.org"))