Skip to content

Instantly share code, notes, and snippets.

@amirrajan
Last active January 20, 2024 00:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirrajan/b6952aa9671c397cdf8931288487a5c3 to your computer and use it in GitHub Desktop.
Save amirrajan/b6952aa9671c397cdf8931288487a5c3 to your computer and use it in GitHub Desktop.
Emacs step by step
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
;; This is a import that ships with emacs.
;; package is Emacs's package manager.
(require 'package)
;; Emacs has an official repository of packages and a more current
;; unofficial one. Melpa is the 'unoffical one' (which in this
;; case translates to more up to date, newer, and by extension,
;; a bit more volatile). The official repo is called org. This
;; repo is slow changing and extremely stable (but doesn't have
;; all the cool/cutting edge packages that are being used).
(push '("melpa" . "http://melpa.org/packages/") package-archives)
(push '("org" . "http://orgmode.org/elpa/") package-archives)
(push '("melpa-stable" . "https://stable.melpa.org/packages/") package-archives)
;; After the repositories have been set, initialize the package
;; manager.
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(unless (package-installed-p 'use-package) (package-install 'use-package))
(use-package evil
:ensure t
:init
(setq evil-want-C-i-jump nil)
:config
(evil-mode 1))
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
;; This is a import that ships with emacs.
;; package is Emacs's package manager.
(require 'package)
;; Emacs has an official repository of packages and a more current
;; unofficial one. Melpa is the 'unoffical one' (which in this
;; case translates to more up to date, newer, and by extension,
;; a bit more volatile). The official repo is called org. This
;; repo is slow changing and extremely stable (but doesn't have
;; all the cool/cutting edge packages that are being used).
(push '("melpa" . "http://melpa.org/packages/") package-archives)
(push '("org" . "http://orgmode.org/elpa/") package-archives)
(push '("melpa-stable" . "https://stable.melpa.org/packages/") package-archives)
;; After the repositories have been set, initialize the package
;; manager.
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(unless (package-installed-p 'use-package) (package-install 'use-package))
(use-package evil
:ensure t
:init
(setq evil-want-C-i-jump nil)
:config
(evil-mode 1))
(defun say-hello-world ()
(interactive)
(insert "hello world"))
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
;; This is a import that ships with emacs.
;; package is Emacs's package manager.
(require 'package)
;; Emacs has an official repository of packages and a more current
;; unofficial one. Melpa is the 'unoffical one' (which in this
;; case translates to more up to date, newer, and by extension,
;; a bit more volatile). The official repo is called org. This
;; repo is slow changing and extremely stable (but doesn't have
;; all the cool/cutting edge packages that are being used).
(push '("melpa" . "http://melpa.org/packages/") package-archives)
(push '("org" . "http://orgmode.org/elpa/") package-archives)
(push '("melpa-stable" . "https://stable.melpa.org/packages/") package-archives)
;; After the repositories have been set, initialize the package
;; manager.
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(unless (package-installed-p 'use-package) (package-install 'use-package))
(use-package evil
:ensure t
:init
(setq evil-want-C-i-jump nil)
:config
(evil-mode 1))
(use-package osx-clipboard
:ensure t
:config
(osx-clipboard-mode 1))
(use-package evil-leader
:ensure t
:config
(defun say-hello-world ()
(interactive)
(evil-normal-state)
(evil-goto-line)
(evil-open-below 1)
(evil-normal-state)
(insert "hello world"))
(global-evil-leader-mode)
(evil-leader/set-leader ",")
(evil-leader/set-key
"h" 'say-hello-world))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment