Skip to content

Instantly share code, notes, and snippets.

@rohitvvv
Created January 3, 2017 15:24
Show Gist options
  • Save rohitvvv/47ea1ebeacee147424376ab74ef9d859 to your computer and use it in GitHub Desktop.
Save rohitvvv/47ea1ebeacee147424376ab74ef9d859 to your computer and use it in GitHub Desktop.
Emacs configuration
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar myPackages
'(better-defaults
ein
elpy
flycheck
material-theme
py-autopep8))
(mapc #'(lambda (package)
(unless (package-installed-p package)
(package-install package)))
myPackages)
;(setq inhibit-startup-message t) ;; hide the startup message
(load-theme 'material t) ;; load material theme
(global-linum-mode t) ;; enable line numbers globally
;; PYTHON CONFIGURATION
;; --------------------------------------
(elpy-enable)
(elpy-use-ipython)
;; use flycheck not flymake with elpy
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
;; enable autopep8 formatting on save
(require 'py-autopep8)
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
(setq python-shell-interpreter "ipython"
python-shell-interpreter-args "--simple-prompt -i")
(defun linebreak-newline()
"1. Go to end of line\n 2. Create a new line"
(interactive)
(end-of-line)
(newline))
(global-set-key (kbd "C-o") 'linebreak-newline)
(defun initFile()
"Load initFile Emacs"
(interactive)
(find-file "~/.emacs.d/init.el"))
;;open ycombinator in an external browser
(defun yc()
(interactive)
(browse-url "http://news.ycombinator.com"))
(defun w3m-open-site (site)
"Opens site in new w3m session with 'http://' appended"
(interactive
(list (read-string "Your next adventure:" nil nil w3m-home-page nil)))
(w3m-goto-url-new-session
(concat "http://" site)))
(global-set-key (kbd "C-g") 'w3m-open-site)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment