~lucasemmoreira/first-emacs

6782e153ed9d8e62a12978a0c320c76ef2ef50e2 — Lucas Moreira 8 months ago
initial commit
3 files changed, 232 insertions(+), 0 deletions(-)

A LICENSE
A README.md
A configuration.org
A  => LICENSE +13 -0
@@ 1,13 @@
Copyright (c) 2020 Lucas Esperancini Moreira e Moreira <me@lucasemmoreira.xyz>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

A  => README.md +114 -0
@@ 1,114 @@
Note: this is the same file as configuration.org! 

# What is this?

I created this config to make emacs a more smooth first experience for my girlfriend. I do not think this setup is meant to be used always, but it does break a few first annoying barriers. Mainly the `C-c` and the `C-x` hotkeys.


# How to use it?

Well, you can use it as an org file. To do so, create the `\~/.emacs` file like this:

    
    (org-babel-load-file "~/path/to/this/file/name-of-this-file.org")

A note of caution: in my config, my emacs only converts to the configuration what is with `emacs-lisp`. If you fell the need, just erase the `elisp` to be extra safe.


# Make it simpler please!

Ok, so this is the main dish. [This](https://github.com/darkstego/wakib-keys) repository contains the configuration that breaks those first barriers I mentioned earlier. I was not able to download it through `use-package`. So you will have to do it yourself. But it is very simple. All you have to do is put the main file `wakib-keys.el` inside the emacs configuration folder `\~/.emacs.d/`. Done! Good to go!

    ;; https://github.com/darkstego/wakib-keys
    (require 'wakib-keys "~/.emacs.d/wakib-keys.el")
    (wakib-keys 1)

I will not elongate on what the lib does (you can read it the original repo =]) but the idea is that `Ctrl + c` and `Ctrl + x` (or in emacs notation `C-c` and `C-x`) are used as expected in most guis applications, i.e., for copying and cutting.


# Some basic stuff (in my opinion!)

Well here we can divide in a few parts.


## Packages please!

This setup is for you to be able to install packages more easily.

    ;; Configure package.el to include MELPA.
    (require 'package)
    (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
    (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
    (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
    (package-initialize)
    
    ;; Ensure that use-package is installed.
    ;;
    ;; If use-package isn't already installed, it's extremely likely that this is a
    ;; fresh installation! So we'll want to update the package repository and
    ;; install use-package before loading the literate configuration.
    (when (not (package-installed-p 'use-package))
      (package-refresh-contents)
      (package-install 'use-package))


## Some keybindings (shortcuts)

These are some keybindings that I find very useful. They are very similar to web browsers (except for the last three).

    (global-set-key (kbd "<C-tab>") 'other-window)
    (global-set-key (kbd "<C-f4>") 'delete-window)
    (global-set-key (kbd "C-t") 'split-window-right)
    (global-set-key (kbd "C-<") 'previous-buffer)
    (global-set-key (kbd "C->") 'next-buffer)


## A more friendly interface for the next step =]

This part I put because it not so trivial to create a first version, and it is useful if you want to be a more "emacs user".

    (use-package ivy
      :diminish
      :bind (("C-s" . swiper)
    	 :map ivy-minibuffer-map
    	 ("TAB" . ivy-alt-done)
    	 ("C-f" . ivy-alt-done)
    	 ("C-l" . ivy-alt-done)
    	 ("C-j" . ivy-next-line)
    	 ("C-k" . ivy-previous-line)
    	 :map ivy-switch-buffer-map
    	 ("C-k" . ivy-previous-line)
    	 ("C-l" . ivy-done)
    	 ("C-d" . ivy-switch-buffer-kill)
    	 :map ivy-reverse-i-search-map
    	 ("C-k" . ivy-previous-line)
    	 ("C-d" . ivy-reverse-i-search-kill))
      :config
      (ivy-mode 1))
    
    (use-package counsel
      :demand t
      :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))
      :custom
      (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
      :config
      (setq ivy-initial-inputs-alist nil)) ;; Don't start searches with ^
    
    (use-package which-key
      :config (which-key-mode))


# Add more!

Well, here it is important for me to say that, the `wakib-keys` package may have some impact but fell free to add more stuff! The nice thing of emacs is to that is very modular and you can try a bunch of [packages](https://www.emacswiki.org/emacs/InstallingPackages)! For example the very nice [elpy](https://elpy.readthedocs.io/en/latest/) package for python development:

    (use-package elpy
      :ensure t
      :init
      (elpy-enable))


A  => configuration.org +105 -0
@@ 1,105 @@
#+Title: FirstEmacs
#+Author: Lucas E M Moreira
#+mail: me@lucasemmoreira.xyz

* What is this?
  I created this config to make emacs a more smooth first experience for my girlfriend. I do not think this setup is meant to be used always, but it does break a few first annoying barriers. Mainly the ~C-c~ and the ~C-x~ hotkeys.

* How to use it?
  Well, you can use it as an org file. To do so, create the ~\~/.emacs~ file like this:
  #+begin_src elisp
   
    (org-babel-load-file "~/path/to/this/file/name-of-this-file.org")
  #+end_src
  A note of caution: in my config, my emacs only converts to the configuration what is with ~emacs-lisp~. If you fell the need, just erase the ~elisp~ to be extra safe.

* Make it simpler please!
  Ok, so this is the main dish. [[https://github.com/darkstego/wakib-keys][This]] repository contains the configuration that breaks those first barriers I mentioned earlier. I was not able to download it through ~use-package~. So you will have to do it yourself. But it is very simple. All you have to do is put the main file ~wakib-keys.el~ inside the emacs configuration folder ~\~/.emacs.d/~. Done! Good to go!
  #+begin_src emacs-lisp
    ;; https://github.com/darkstego/wakib-keys
    (require 'wakib-keys "~/.emacs.d/wakib-keys.el")
    (wakib-keys 1)
  #+end_src
  I will not elongate on what the lib does (you can read it the original repo =]) but the idea is that ~Ctrl + c~ and ~Ctrl + x~ (or in emacs notation ~C-c~ and ~C-x~) are used as expected in most guis applications, i.e., for copying and cutting.

* Some basic stuff (in my opinion!)
  Well here we can divide in a few parts.

** Packages please!
   This setup is for you to be able to install packages more easily.
   #+begin_src emacs-lisp
    ;; Configure package.el to include MELPA.
    (require 'package)
    (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
    (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
    (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
    (package-initialize)
    
    ;; Ensure that use-package is installed.
    ;;
    ;; If use-package isn't already installed, it's extremely likely that this is a
    ;; fresh installation! So we'll want to update the package repository and
    ;; install use-package before loading the literate configuration.
    (when (not (package-installed-p 'use-package))
      (package-refresh-contents)
      (package-install 'use-package))
   #+end_src

** Some keybindings (shortcuts)
   These are some keybindings that I find very useful. They are very similar to web browsers (except for the last three).
   #+begin_src emacs-lisp
     (global-set-key (kbd "<C-tab>") 'other-window)
     (global-set-key (kbd "<C-f4>") 'delete-window)
     (global-set-key (kbd "C-t") 'split-window-right)
     (global-set-key (kbd "C-<") 'previous-buffer)
     (global-set-key (kbd "C->") 'next-buffer)
   #+end_src
   
** A more friendly interface for the next step =]
   This part I put because it not so trivial to create a first version, and it is useful if you want to be a more "emacs user".
   #+begin_src emacs-lisp
     (use-package ivy
       :diminish
       :bind (("C-s" . swiper)
	      :map ivy-minibuffer-map
	      ("TAB" . ivy-alt-done)
	      ("C-f" . ivy-alt-done)
	      ("C-l" . ivy-alt-done)
	      ("C-j" . ivy-next-line)
	      ("C-k" . ivy-previous-line)
	      :map ivy-switch-buffer-map
	      ("C-k" . ivy-previous-line)
	      ("C-l" . ivy-done)
	      ("C-d" . ivy-switch-buffer-kill)
	      :map ivy-reverse-i-search-map
	      ("C-k" . ivy-previous-line)
	      ("C-d" . ivy-reverse-i-search-kill))
       :config
       (ivy-mode 1))
    
     (use-package counsel
       :demand t
       :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))
       :custom
       (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
       :config
       (setq ivy-initial-inputs-alist nil)) ;; Don't start searches with ^
    
     (use-package which-key
       :config (which-key-mode))
    
   #+end_src
  
* Add more!
  Well, here it is important for me to say that, the ~wakib-keys~ package may have some impact but fell free to add more stuff! The nice thing of emacs is to that is very modular and you can try a bunch of [[https://www.emacswiki.org/emacs/InstallingPackages][packages]]! For example the very nice [[https://elpy.readthedocs.io/en/latest/][elpy]] package for python development:
  #+begin_src emacs-lisp
    (use-package elpy
      :ensure t
      :init
      (elpy-enable))
  #+end_src