Emacs tips and tricks
Forum rules
Share your brain ;)
Share your brain ;)
- franksinistra
- Ivana Fukalot
- Posts: 1093
- Joined: Mon Jan 27, 2014 2:03 am
- Location: 印尼国
Re: Emacs tips and tricks
Bozhidar Batsov's crux (collection of ridiculously useful extension): https://github.com/bbatsov/crux
more like collection of useful functions, but it's indeed useful.
more like collection of useful functions, but it's indeed useful.
rice no more.
- franksinistra
- Ivana Fukalot
- Posts: 1093
- Joined: Mon Jan 27, 2014 2:03 am
- Location: 印尼国
Re: Emacs tips and tricks
rice no more.
Re: Emacs tips and tricks
^ Impressive work, you already support tons of mode.
- franksinistra
- Ivana Fukalot
- Posts: 1093
- Joined: Mon Jan 27, 2014 2:03 am
- Location: 印尼国
Re: Emacs tips and tricks
^ courtesy of long weekend and CNY... LoL :)
Oh i almost forgot... GP do you know any cleaner way of defining colors in emacs theme? Mine is a bit cluttered ( two color-classes, the codes are too verbose and hard to debug)
Guess I'm not good at all in e-lisp... :(
Oh i almost forgot... GP do you know any cleaner way of defining colors in emacs theme? Mine is a bit cluttered ( two color-classes, the codes are too verbose and hard to debug)
Guess I'm not good at all in e-lisp... :(
rice no more.
Re: Emacs tips and tricks
^ I'd take a look at solarized-emacs, zenburn-emacs and darktooth. I'm no expert here, but they are great themes widely used.
Re: Emacs tips and tricks
As I much as I like Helm (and I do, really), after months I felt like it was really taking over my configuration. Not that is bad per se, but I found myself relying on Helm for the simplest things. Helm is quite a beast, and if I'm familiar with its bloated GUI now, I still don't like how it slows down my Emacs startup time.
Enter Ivy. Ivy comes with Swiper, which is a very fine replacement for Isearch (and helm-swoop), but it is also an entirely new completion system. It is similar to Ido, but lighter and, apparently, easier to extend. In fact, what really took over my Helm configuration is Counsel, a set of functions based upon Ivy.
Ok, enough with the talking, here's my setup:
As you can see, Counsel provides functions for find-files and your friend M-x. I've just setup this thingy (I made the setup above last night), and I plan to use it for a week before deciding if Helm is my saviour or not.
As reference, this answer by swiper/ivy/counsel's author got me into trying his packages out: https://www.reddit.com/r/emacs/comments ... oo/d05pdow
Enter Ivy. Ivy comes with Swiper, which is a very fine replacement for Isearch (and helm-swoop), but it is also an entirely new completion system. It is similar to Ido, but lighter and, apparently, easier to extend. In fact, what really took over my Helm configuration is Counsel, a set of functions based upon Ivy.
Ok, enough with the talking, here's my setup:
Code: Select all
(use-package swiper ; Isearch with an overview
:ensure t
:bind ("C-s" . swiper))
(use-package ivy ; Incremental Vertical completYon
:ensure swiper
:bind (("C-c C-r" . ivy-resume)
("C-x C-r" . ivy-switch-buffer))
:init (ivy-mode 1)
:config
(progn
;; Show recently killed buffers when calling `ivy-switch-buffer'
(setq ivy-use-virtual-buffers t
ivy-count-format "" ; Do not show counter
ivy-virtual-abbreviate 'full ; Show full file path
ivy-re-builders-alist '((t . ivy--regex-plus))))
:diminish ivy-mode)
(use-package counsel ; Completion functions with Ivy
:ensure t
:bind (("C-x C-f" . counsel-find-file)
("M-x" . counsel-M-x)
("C-h v" . counsel-describe-variable)
("C-h f" . counsel-describe-function)
("C-h S" . counsel-info-lookup-symbol)
("C-c u" . counsel-unicode-char)
("C-c g" . counsel-git)
("C-c G" . counsel-git-grep)
("C-c k" . counsel-ag)
("C-x l" . counsel-locate)
("C-x i" . counsel-imenu)
("M-y" . counsel-yank-pop))
:config
(progn
(setq counsel-find-file-at-point t
counsel-find-file-ignore-regexp
(concat
;; file names beginning with # or .
"\\(?:\\`[#.]\\)"
;; file names ending with # or ~
"\\|\\(?:\\`.+?[#~]\\'\\)"))
(ivy-set-actions
'counsel-find-file
`(("x"
(lambda (x) (delete-file (expand-file-name x ivy--directory)))
,(propertize "delete" 'face 'font-lock-warning-face))))))
As reference, this answer by swiper/ivy/counsel's author got me into trying his packages out: https://www.reddit.com/r/emacs/comments ... oo/d05pdow
- franksinistra
- Ivana Fukalot
- Posts: 1093
- Joined: Mon Jan 27, 2014 2:03 am
- Location: 印尼国
Re: Emacs tips and tricks
Been trying ivy, and still figuring out how to create the same environment helm-ag does. Thanks for the tip GP
rice no more.
Re: Emacs tips and tricks
^ What does helm-ag do more than plain ag.el? I'm asking because I used to have both of them installed but ag.el works so good for me I completely forgot about helm-ag.
- franksinistra
- Ivana Fukalot
- Posts: 1093
- Joined: Mon Jan 27, 2014 2:03 am
- Location: 印尼国
Re: Emacs tips and tricks
Support for other backends (i use pt in some of my faster machine), ah and i am pretty used to 'helm-do-yadda-yadda' that not having them feels kinda weird... But yeah, you're right. I can live without them anyway, for the sake of simpler thing. I had 22 helm-* packages installed (yeah i know), now i have 4 ivy related packages, so.... Cool
rice no more.
Re: Emacs tips and tricks
^ Exactly! I have removed all helm-* packages from my setup. I know Ivy/Counsel is still young and not as powerful as Helm, but for my daily workflow is enough. Plus, the GUI is really a winner for me.
Re: Emacs tips and tricks
I've been using this workflow lately when I need to refactor different files quickly: https://emacs.stackexchange.com/a/243/5514
It combines ag.el, wgrep-ag and multiple-cursors. It is really a blessing, saves me so much time.
It combines ag.el, wgrep-ag and multiple-cursors. It is really a blessing, saves me so much time.
Re: Emacs tips and tricks
Almost 2 weeks without Helm and I can honestly say I'm not missing it: Ivy and Counsel are just what I need.
It's also easy to use Ivy for your own needs. For instance, I love having Eshell history ready to browse. I used to do it with Helm, and now with Ivy:
It's also easy to use Ivy for your own needs. For instance, I love having Eshell history ready to browse. I used to do it with Helm, and now with Ivy:
Code: Select all
(defun mu-counsel-esh-history ()
"Browse Eshell history."
(interactive)
(setq ivy-completion-beg (point))
(setq ivy-completion-end (point))
(ivy-read "Symbol name: "
(delete-dups
(ring-elements eshell-history-ring))
:action #'ivy-completion-in-region-action))
Re: Emacs tips and tricks
Another neat feature of Swiper and Ivy.
When in Swiper, hit C-c C-o to run ivy-occur. Now, if you have wgrep install, you can use it to edit the multiple occurrences you were looking for in a dedicated buffer. Very nice.
To make it easier for my memory, I bound wgrep to the same bindings I use in Dired to turn a Dired buffer editable.
When in Swiper, hit C-c C-o to run ivy-occur. Now, if you have wgrep install, you can use it to edit the multiple occurrences you were looking for in a dedicated buffer. Very nice.
To make it easier for my memory, I bound wgrep to the same bindings I use in Dired to turn a Dired buffer editable.
Code: Select all
(use-package wgrep ; Editable grep buffer
:ensure t
:defer t
:config
(progn
(with-eval-after-load 'grep
(bind-key "C-x C-q" #'wgrep-change-to-wgrep-mode grep-mode-map))
(with-eval-after-load 'wgrep
(bind-key "C-c C-c" #'wgrep-finish-edit grep-mode-map))))
Re: Emacs tips and tricks
Looking for a replacement for Solarized Light, I found this: https://github.com/wasamasa/punpun-theme
I respect the author very much (he's the author of Emacs Horrors and Emacs Ninja), so I'm always eager to follow his new experiments. This minimal, simple theme might be a win for me.
I respect the author very much (he's the author of Emacs Horrors and Emacs Ninja), so I'm always eager to follow his new experiments. This minimal, simple theme might be a win for me.
- franksinistra
- Ivana Fukalot
- Posts: 1093
- Joined: Mon Jan 27, 2014 2:03 am
- Location: 印尼国
Re: Emacs tips and tricks
Pretty good for monochrome looks, but i still prefer his gotham theme, especially under dark environment.
rice no more.
Re: Emacs tips and tricks
^ Yes, definitely a fine dark theme. Thing is my eyes (which are not that good) struggle with dark themes, especially after long sessions of editing and writing. I find light themes more comfortable. :-)
- franksinistra
- Ivana Fukalot
- Posts: 1093
- Joined: Mon Jan 27, 2014 2:03 am
- Location: 印尼国
Re: Emacs tips and tricks
^ Yup, it was the same reason that i moved from dark, low contrast anything to something a bit less so. I mainly use light themes at work, farmhouse, silkworm, and leuven have been my recent favorite, or my own majapahit if i were to use emacs in no-X.
rice no more.
-
- Baconator
- Posts: 10253
- Joined: Thu Sep 16, 2010 11:03 am
- Location: Pfälzerwald
- Contact:
Re: Emacs tips and tricks
I know Leuven should work particularly well with Org, but I've never been happy with it.
One thing for sure: good light themes are hard to find.
One thing for sure: good light themes are hard to find.
Re: Emacs tips and tricks
Got an error today about my package.el setup. This now works:
Don't know whether it can be helpful, maybe it's me playing cool with the bleeding edge and getting hurt.
Note aside: punpun-theme is now on MELPA. So I'm happy.
Code: Select all
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives '())
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives
'("gnu" . "https://elpa.gnu.org/packages/"))
Note aside: punpun-theme is now on MELPA. So I'm happy.