A custom init.el, full of highly optimised package and cool theme. Packages like magit for git, counsel for navigation and lsp mode
- Package Source
- Setting Custom Font
- Doom Theme
- Doom Modeline
- Line Number
- Ivy
- Counsel
- Rainbow Delimiters
- Which Key
- Helpful
- Magit
- Forge
- Lsp Mode
- Flycheck
- Little Tweaks
Here I have used multiple package sources like melpa, elpa and org.
- Elpa is the default package archive of emacs.
- Melpa gives us wide range of useful as well as notorious packages which we can use to customise emacs.
(set-face-attribute 'default nil
:family "FantasqueSansMono Nerd Font Mono"
:height 110
:weight 'normal
:width 'normal)
You can use any font of your choice using above source code in your init.el. Here I have used FantasqueSansMono Nerd Font Mono, it’s pretty cool, give it a go. Install it from here
Here I have used doom-theme as it is one the best and also it gives wide variety of inbuilt themes that one can use.I have used doom-gruvbox as my current theme, but there are various themes available in doom-theme which you can use just by editing 57th line.
(load-theme 'your-choice-of-theme t)
Replace your-choice-of-theme by any of themes from here.
Also, I have used doom-theme based visible-bell which highlights the
modeline for any kind of warning instead of higlighting the entire boundary
of screen which is the default behaviour of visible-bell provided by GNU Emacs.
If your reading this, then I can assume that you know what modeline is,
it is the bottom line in emacs where one can see various things
(like directory, language, mode, git branch, line number etc.. ) depending
what modeline they are using, here I’m using doom-modeline which is
pretty good.
Put this into your init.el
(use-package doom-modeline
:ensure
:init(doom-modeline-mode 1))
You can find more about doom-modeline here
Line number is pretty important as by default line numbers are not visible in emacs. So to enable this, put this piece of code into your init.el
(column-number-mode)
(global-display-line-numbers-mode t)
This will enable line number as well as column number(you can see column number
in modeline.)
If you want to go to a specific line then just press M-g M-g
and type the line
number.
Ivy is an interactive interface for completion in Emacs. It gives you suggestion in the minibuffer which you can select. There is Swiper which is pretty good. It replaces the in-built emacs I-search. You can find more about ivy here
Counsel enhances the ivy-mode
and give a different and fast way for movement in
the directories, providing versions of common Emacs commands that are
customised to make the best use of Ivy. For example, counsel-find-file
has some
additional keybindings. Pressing DEL
will move you to the parent directory.
Put the below code into your init.el.
(use-package counsel
:bind (("M-x" . counsel-M-x)
("C-x b" . counsel-ibuffer)
("C-x C-f" . counsel-find-file)
("C-M-l" . counsel-imenu)
:map minibuffer-local-map
("C-r" . 'counsel-minibuffer-history))
:config
(setq ivy-initial-inputs-alist nil))
It highlights delimiters such as parentheses, brackets or braces according to their depth. Each successive level is highlighted in a different color.
which-key
displays the possible keybindings follwing your currently entered
incompelete command in a minibuffer. For example, let say you entered C-x
, then
it wait for 0.5 seconds and then will show all the commands in the minibuffer that follows C-x
.
You can find more about it from here. You can decide the time delay after which
popup will appear.
helpful
gives a brief description about the command of the function that appears
in the minibuffer.
magit
is one of the best package present in emacs. It helps you a lot in maintaining
your repositories. Just press C-x g
in your repository and it will activate the
magit mode. There you will be able to see all the commits, unstaged files, untracked
files and all other stuffs.
Put this into your init.el
(use-package magit
:bind ("C-M-;" . magit-status)
:commands (magit-status magit-get-current-branch)
:custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
You should go to this website in order to know more about magit. Watch this video, this will give you proper insight on how to use magit.
forge
is a beast of a package. It helps us to create pull request, create issue,
commenting on PRs or issues, and many more just from emacs, you don’t have to go
github to do all this, you can do all this from emacs itself. How amazing is that.
Just press C-x g
and then press ’ , it will give commands to create issue, PRs and
many more.
For example you can press c i
to create issue, you can add labels, assignees from
emacs itself.
Now comes the hard part, how to make it work. For that follow the below steps:
- First create
.authinfo.gpg
file with following content.
machine api.github.com login username^forge password ghub_token
In this, replace
username
with your github username and ghub_token with your personal access token. You can create your personal access token by going intoSettings->Developer Settings->Personal access token->Generate new token
Now in this select the following fieldsrepo, user, read:org(under admin:org tab)
. Copy the token and replaceghub_token
with that. - Now add this code into your init.el
(setq auth-sources '("~/.authinfo.gpg"))
Make sure path of
.authinfo.gpg
is correct. - Now add
forge
into your init.el(use-package forge :after magit)