Skip to content

Instantly share code, notes, and snippets.

@kaunteya
Last active August 29, 2015 14:16
Show Gist options
  • Save kaunteya/2ce292e369c1a2b5476d to your computer and use it in GitHub Desktop.
Save kaunteya/2ce292e369c1a2b5476d to your computer and use it in GitHub Desktop.
This is my emacs configuration file
;gist -u 2ce292e369c1a2b5476d .emacs
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;C-xrje
(set-register ?e '(file . "~/.emacs")) ;kkk
(set-register ?z '(file . "~/.zshrc")) ;kkk
(define-key global-map (kbd "RET") 'newline-and-indent)
(setq c-default-style "linux")
(setq indent-tabs-mode t)
(setq c-basic-offset 4)
(global-set-key (kbd "<C-s-up>") 'move-text-up) ;kkk
(global-set-key (kbd "<C-s-down>") 'move-text-down) ;kkk
(global-set-key (kbd "M-x") 'smex)
(defun comment-or-uncomment-region-or-line ()
"Comments or uncomments the region or the current line if there's no active region."
(interactive)
(let (beg end)
(if (region-active-p)
(setq beg (region-beginning) end (region-end))
(setq beg (line-beginning-position) end (line-end-position)))
(comment-or-uncomment-region beg end)))
;Toggle Control-a and Alt-m
(global-set-key (kbd "M-m") 'move-beginning-of-line)
(global-set-key (kbd "C-a") 'back-to-indentation)
;; (require 'zop-to-char)
(global-set-key (kbd "M-z") 'zop-up-to-char) ;kkk
;(require 'projectile)
(require 'dired )
(define-key dired-mode-map (kbd "<s-down>") 'dired-find-alternate-file) ; was dired-advertised-find-fil ;kkk
(define-key dired-mode-map (kbd "<s-up>") 'dired-up-directory) ;kkk
(put 'dired-find-alternate-file 'disabled nil)
(put 'downcase-region 'disabled nil)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ahs-idle-interval 0.5)
'(ansi-color-names-vector
["#073642" "#dc322f" "#859900" "#b58900" "#268bd2" "#d33682" "#2aa198" "#657b83"])
'(compilation-message-face (quote default))
'(cua-global-mark-cursor-color "#2aa198")
'(cua-normal-cursor-color "#839496")
'(cua-overwrite-cursor-color "#b58900")
'(cua-read-only-cursor-color "#859900")
'(custom-enabled-themes (quote (tsdh-dark)))
'(custom-safe-themes
(quote
("90d329edc17c6f4e43dbc67709067ccd6c0a3caa355f305de2041755986548f2" "8db4b03b9ae654d4a57804286eb3e332725c84d7cdab38463cb6b97d5762ad26" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "e16a771a13a202ee6e276d06098bc77f008b73bbac4d526f160faa2d76c1dd0e" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default)))
'(delete-selection-mode t)
'(electric-pair-mode t)
'(fci-rule-color "#073642")
'(global-linum-mode t)
'(highlight-changes-colors (quote ("#d33682" "#6c71c4")))
'(highlight-symbol-colors
(--map
(solarized-color-blend it "#002b36" 0.25)
(quote
("#b58900" "#2aa198" "#dc322f" "#6c71c4" "#859900" "#cb4b16" "#268bd2"))))
'(highlight-symbol-foreground-color "#93a1a1")
'(highlight-tail-colors
(quote
(("#073642" . 0)
("#546E00" . 20)
("#00736F" . 30)
("#00629D" . 50)
("#7B6000" . 60)
("#8B2C02" . 70)
("#93115C" . 85)
("#073642" . 100))))
'(hl-bg-colors
(quote
("#7B6000" "#8B2C02" "#990A1B" "#93115C" "#3F4D91" "#00629D" "#00736F" "#546E00")))
'(hl-fg-colors
(quote
("#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36")))
'(inhibit-startup-buffer-menu t)
'(inhibit-startup-screen t)
'(js3-enter-indents-newline t)
'(js3-indent-level 4)
'(js3-indent-on-enter-key t)
'(magit-diff-use-overlays nil)
'(make-backup-files nil)
'(pos-tip-background-color "#073642")
'(pos-tip-foreground-color "#93a1a1")
'(projectile-completion-system (quote grizzl))
'(projectile-globally-ignored-files (quote ("TAGS")))
'(show-paren-mode t)
'(smartrep-mode-line-active-bg (solarized-color-blend "#859900" "#073642" 0.2))
'(term-default-bg-color "#002b36")
'(term-default-fg-color "#839496")
'(tool-bar-mode nil)
'(vc-annotate-background nil)
'(vc-annotate-color-map
(quote
((20 . "#dc322f")
(40 . "#c85d17")
(60 . "#be730b")
(80 . "#b58900")
(100 . "#a58e00")
(120 . "#9d9100")
(140 . "#959300")
(160 . "#8d9600")
(180 . "#859900")
(200 . "#669b32")
(220 . "#579d4c")
(240 . "#489e65")
(260 . "#399f7e")
(280 . "#2aa198")
(300 . "#2898af")
(320 . "#2793ba")
(340 . "#268fc6")
(360 . "#268bd2"))))
'(vc-annotate-very-old-color nil)
'(weechat-color-list
(quote
(unspecified "#002b36" "#073642" "#990A1B" "#dc322f" "#546E00" "#859900" "#7B6000" "#b58900" "#00629D" "#268bd2" "#93115C" "#d33682" "#00736F" "#2aa198" "#839496" "#657b83"))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(cd "~/work/")
(setq-default cursor-type 'bar)
(set-cursor-color "#ff7f24");chcolate
(set-background-color "#202225")
(menu-bar-mode t)
(global-hl-line-mode t)
(auto-save-mode nil)
(ido-mode t)
;-------------Tips Tips Tips-----------------------
;Delete whole line Cntrl-Shift-BackSpace
;C-x z # repeat last command
;z # repeat last command again. Press z as many times as you wish.
;To get back to where you started the search, just use ‘C-x C-x’
;M-\ deletes all spaces and tabs around the point.
;M-SPC just one space
;-----------Command key bindings---------------
;⌘ A - Select all
;⌘ B --------------
(global-set-key (kbd "s-b") 'ibuffer) ;kkk
;⌘ C Copy
;⌘ D iserach-backward Opposite of ⌘ G
(global-set-key (kbd "s-d") 'duplicate-thing) ;kkk
;⌘ E Expand region
(global-set-key (kbd "s-e") 'er/expand-region) ;kkk
;⌘ F search #Replace--------------------------------
(global-set-key (kbd "s-f") 'ido-find-file) ;kkk
(global-set-key (kbd "M-s-f") 'ido-find-file-other-frame) ;kkk
;⌘ G isearch-repeat-forward #Replace #Checkfirst
(global-set-key (kbd "s-g") 'magit-status) ;kkk
;⌘ H Hide emacs #Replace
;⌘ I -------------------
(global-set-key (kbd "s-i") 'nav-toggle) ;kkk
;⌘ J Exchange mark (C-x C-x) #Replace-------------
(global-set-key (kbd "C-;") 'ace-jump-mode) ;kkk
;⌘ K Kill this buffer
;⌘ L Goto line
;⌘ M Minimize #Replace---------------
;⌘ N Open new frame
;⌘ O Open dialogue
;⌘ P Print #Replace-------------
;⌘ Q Quit
;⌘ R
(global-set-key (kbd "s-r") 'mc/mark-next-like-this) ;kkk
;⌘ S Save
(global-set-key (kbd "M-s-s") 'save-some-buffers) ;kkk
;⌘ T Font #Replace------------
;⌘ U Undo
;⌘ V Paste
;⌘ W -------------------
;⌘ X Cut
;⌘ Y (ns-paste-secondary) #Replace
;⌘ Z Undo
;⌘ / Comment uncomment
(global-set-key (kbd "s-/") 'comment-or-uncomment-region-or-line) ;kkk
;⌘ ↑ Beginning of buffer
(global-set-key (kbd "s-<up>") 'beginning-of-buffer) ;kkk
;⌘ ↓ End of buffer
(global-set-key (kbd "s-<down>") 'end-of-buffer) ;kkk
;Next buffer previous buffer
(global-set-key (kbd "s-<left>") 'previous-buffer) ;kkk
(global-set-key (kbd "s-<right>") 'next-buffer) ;kkk
(global-set-key (kbd "s-<backspace>") '(lambda () (interactive) (kill-line 0))) ;kkk
(global-set-key (kbd "s-=") 'text-scale-increase) ;kkk
(global-set-key (kbd "s--") 'text-scale-decrease) ;kkk
(global-set-key (kbd "M-s-<right>") 'enlarge-window-horizontally) ;kkk
(global-set-key (kbd "M-s-<left>") 'shrink-window-horizontally) ;kkk
(global-set-key (kbd "C-`") 'switch-window) ;kkk
(global-set-key (kbd "C-SPC") 'dabbrev-expand) ;kkk
(global-set-key (kbd "C-c l") 'list-matching-lines) ;kkk
(defun open-next-line (arg)
"Move to the next line and then opens a line.
See also `newline-and-indent'."
(interactive "p")
(end-of-line)
(open-line arg)
(next-line 1)
(when newline-and-indent
(indent-according-to-mode)))
(global-set-key (kbd "s-<return>") 'open-next-line) ;kkk
(defun open-previous-line (arg)
"Open a new line before the current one.
See also `newline-and-indent'."
(interactive "p")
(beginning-of-line)
(open-line arg)
(when newline-and-indent
(indent-according-to-mode)))
(global-set-key (kbd "S-s-<return>") 'open-previous-line) ;kkk
(defun beginning-of-line-or-indentation ()
"move to beginning of line, or indentation"
(interactive)
(if (bolp)
(back-to-indentation)
(beginning-of-line)))
(global-set-key (kbd "C-a") 'beginning-of-line-or-indentation) ;kkk
(put 'erase-buffer 'disabled nil)
(defun eshell-clear-buffer ()
"Clear terminal"
(interactive)
(let ((inhibit-read-only t))
(erase-buffer)
(eshell-send-input)))
(add-hook 'eshell-mode-hook
'(lambda()
(local-set-key (kbd "C-l") 'eshell-clear-buffer)))
(defun python-clear ()
(interactive)
(let ((comint-buffer-maximum-size 0))
(comint-truncate-buffer)))
;; (require 'auto-highlight-symbol)
;; (global-auto-highlight-symbol-mode t)
;;----------------emacs-nav----------------------
(add-to-list 'load-path "~/.emacs.d/emacs-nav/")
(require 'nav)
(nav-disable-overeager-window-splitting)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment