Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Action start
- (setq tab-width 4)
- ;; We start by doing some helm config
- (require 'helm)
- (require 'helm-config)
- (require 'helm-command)
- ;; Allow helm to fuzzy match
- (setq helm-M-x-fuzzy-match t)
- (setq helm-buffers-fuzzy-matching t
- helm-recentf-fuzzy-match t)
- (setq helm-semantic-fuzzy-match t
- helm-imenu-fuzzy-match t)
- ;; When downloading files, allow helm to use google to suggest the file to download
- (when (executable-find "curl")
- (setq helm-google-suggest-use-curl-p t))
- ;; Let helm auto-resize
- (helm-autoresize-mode t)
- (setq helm-split-window-in-side-p t ; open helm buffer inside current window, not occupy whole other window
- helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source.
- helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp.
- helm-scroll-amount 8 ; scroll 8 lines other window using M-<next>/M-<prior>
- helm-ff-file-name-history-use-recentf t)
- (helm-mode t) ;; Turn on helm
- ;; Other things to set
- (setq default-directory (concat (getenv "HOME") "/")) ;; This sets the default file loader to be at home (this is an issue when using windows)
- (custom-set-variables '(markdown-command "C:\\Users\\Tom Almeida\\AppData\\Local\\Pandoc\\pandoc.exe"))
- ;; (sml/setup) ;; Allow Smart-mode-line to load
- (setq sml/theme 'powerline)
- (sml/setup)
- ;; (set-frame-parameter nil 'fullscreen 'fullboth) ;; Turn on full-screen
- ;; Org-mode settings
- (setq org-log-done t) ;; Tell me when I complete things
- (setq org-agenda-files (list "~/Dropbox/Orgs/starter.org"
- "~/Dropbox/Orgs/work.org"
- "~/Dropbox/Orgs/uni.org")) ;; The list of files that agenda uses
- ;; A couple of handy functions that save the state of the window config and reload them later
- (defun quicksave()
- (interactive)
- (window-configuration-to-register ?m))
- (defun quickload()
- (interactive)
- (jump-to-register ?m))
- ;; Key setting time
- (global-set-key (kbd "<f5>") 'quickload)
- (global-set-key (kbd "<f6>") 'quicksave)
- (global-set-key (kbd "C-c h") 'helm-command-prefix)
- (global-unset-key (kbd "C-x c"))
- (global-set-key (kbd "M-x") 'helm-M-x)
- (global-set-key (kbd "C-x b") 'helm-mini)
- (global-set-key (kbd "C-x C-x") 'helm-mini)
- (global-set-key (kbd "C-x C-f") 'helm-find-files)
- (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
- (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
- (define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z
- (global-set-key (kbd "\C-cl") 'org-store-link)
- (global-set-key (kbd "\C-ca") 'org-agenda)
- (require 'sr-speedbar)
- (global-set-key (kbd "C-t") 'sr-speedbar-toggle)
- ;; Eventually I want to make WARS (colemak wasd) my emacs movement keys.
- ;; Unfortunately, that will require a fair bit of redoing
- ;; Not implimented:
- ;; Clone-buffer
- ;;
- ;; Repeats:
- ;;
- (defun warsKeys()
- (interactive)
- ;; resetting the helm hotkeys
- (define-key helm-map (kbd "C-u") 'helm-previous-line)
- (define-key helm-map (kbd "C-e") 'helm-next-line)
- (define-key helm-map (kbd "C-n") nil)
- (define-key helm-map (kbd "C-p") nil)
- (define-key helm-map (kbd "C-l") 'helm-yank-text-at-point)
- (define-key helm-map (kbd "C-b") 'helm-recenter-top-bottom-other-window)
- ;; ensuring that universal-argument works correctly on C-p
- (define-key universal-argument-map (kbd "C-p") 'universal-argument-more)
- (define-key universal-argument-map (kbd "C-u") 'nil)
- ;; ensuring that search is correctly done
- (define-key isearch-mode-map (kbd "C-s") nil)
- (define-key isearch-mode-map (kbd "C-r") nil)
- (define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
- (define-key isearch-mode-map (kbd "M-f") 'isearch-repeat-backward)
- ;; doing some org-mode resetting so that org-mode navigation works correctly
- (add-hook 'org-mode-hook
- '(lambda ()
- (define-key org-mode-map (kbd "C-e") nil)
- (define-key org-mode-map (kbd "C-a") nil)
- (define-key org-mode-map (kbd "C-i") nil)
- (define-key org-mode-map (kbd "M-i") 'org-end-of-line)
- (define-key org-mode-map (kbd "M-n") 'org-beginning-of-line)))
- ;; resetting some things in markdown-mode so that navigation works correctly
- (add-hook 'markdown-mode-hook
- '(lambda()
- (define-key markdown-mode-map (kbd "C-i") nil)
- (define-key markdown-mode-map (kbd "TAB") nil)
- (define-key markdown-mode-map (kbd "<tab>") 'markdown-cycle)
- (define-key markdown-mode-map (kbd "M-n") nil)))
- ;; ensuring that it works properly for emacs-lisp-mode
- (add-hook 'emacs-lisp-mode
- '(lambda()
- (define-key emacs-lisp-mode-map (kbd "C-M-i") nil)))
- (define-key emacs-lisp-mode-map (kbd "C-M-i") nil)
- ;; Making sure that tab still works on ERC
- (add-hook 'erc-mode-hook
- '(lambda ()
- (define-key erc-mode-map (kbd "<tab>" ) 'erc-pcomplete)))
- ;; Making sure that C-i still works when editing C code
- (add-hook 'c-mode-hook '(lambda () (define-key c-mode-map (kbd "C-i") nil)))
- (add-hook 'c++-mode-hook '(lambda () (define-key c++-mode-map (kbd "C-i") nil)))
- (global-set-key (kbd "C-w") 'windmove-up) ;; removes kill-region
- (global-set-key (kbd "C-r") 'windmove-down) ;; removes isearch-backward
- (global-set-key (kbd "C-a") 'windmove-left) ;; removes move-beginning-of-line
- (global-set-key (kbd "C-s") 'windmove-right) ;; removes isearch-forward
- (global-set-key (kbd "C-u") 'previous-line) ;; removes universal-argument
- (global-set-key (kbd "C-e") 'next-line) ;; removes move-end-line
- (global-set-key (kbd "C-n") 'backward-char) ;; removes next-line
- (global-set-key (kbd "C-i") 'forward-char) ;;
- (global-set-key (kbd "M-n") 'move-beginning-of-line) ;; removes clone-buffer
- (global-set-key (kbd "M-i") 'move-end-of-line) ;; removes tab-to-tab-stop
- (global-set-key (kbd "M-u") 'backward-word) ;; removes upcase-word
- (global-set-key (kbd "M-e") 'forward-word) ;; removes forward-sentence
- (global-set-key (kbd "C-M-e") 'scroll-up-command) ;; removes end-of-defun
- (global-set-key (kbd "C-M-u") 'scroll-down-command) ;; removes backward-up-list
- (global-set-key (kbd "C-M-n") 'beginning-of-buffer) ;; removes forward-list
- (global-set-key (kbd "C-M-i") 'end-of-buffer) ;;
- (global-set-key (kbd "C-f") 'isearch-forward) ;; removes forward-char
- (global-set-key (kbd "M-f") 'isearch-backward) ;; removes forward-word
- (global-set-key (kbd "C-l") 'kill-region) ;; removes recenter-top-bottom
- (global-set-key (kbd "M-l") 'kill-ring-save) ;; removes downcase-word
- (global-set-key [tab] 'tab-to-tab-stop) ;; removes tab binding to C-i
- (global-set-key (kbd "C-b") 'recenter-top-bottom) ;; removes backward-char
- (global-set-key (kbd "C-p") 'universal-argument) ;; removes previous-line
- (define-key helm-M-x-map (kbd "C-u") nil)
- (define-key helm-M-x-map (kbd "C-p") 'helm-M-x-universal-argument)
- )
- (defun defaultKeys()
- (interactive)
- (global-set-key (kbd "C-u") 'universal-argument)
- (global-set-key (kbd "C-M-e") 'end-of-defun)
- (global-set-key (kbd "C-M-u") 'backward-up-list)
- (global-set-key (kbd "C-M-n") 'forward-list)
- (global-set-key (kbd "M-i") 'tab-to-tab-stop)
- (global-set-key (kbd "M-e") 'forward-sentence)
- (define-key helm-map (kbd "C-n") 'helm-next-line)
- (define-key helm-map (kbd "C-p") 'helm-previous-line)
- (define-key helm-map (kbd "<right>") 'helm-next-source)
- (define-key helm-map (kbd "<left>") 'helm-previous-source)
- (define-key helm-map (kbd "<next>") 'helm-next-page)
- (define-key helm-map (kbd "<prior>") 'helm-previous-page)
- (global-set-key (kbd "C-<right>") 'windmove-right)
- (global-set-key (kbd "C-<left>") 'windmove-left)
- (global-set-key (kbd "C-<up>") 'windmove-up)
- (global-set-key (kbd "C-<down>") 'windmove-down)
- (global-set-key (kbd "<right>") 'forward-char)
- (global-set-key (kbd "<left>") 'backward-char)
- (global-set-key (kbd "<up>") 'previous-line)
- (global-set-key (kbd "<down>") 'next-line)
- (global-set-key (kbd "C-p") 'previous-line)
- (global-set-key (kbd "C-n") 'next-line)
- (global-set-key (kbd "C-b") 'backward-char)
- (global-set-key (kbd "C-f") 'forward-char)
- (global-set-key (kbd "C-a") 'move-beginning-of-line)
- (global-set-key (kbd "C-e") 'move-end-of-line)
- (global-set-key (kbd "M-b") 'backward-word)
- (global-set-key (kbd "M-f") 'forward-word)
- (global-set-key (kbd "C-v") 'scroll-up-command)
- (global-set-key (kbd "M-v") 'scroll-down-command)
- (global-set-key (kbd "M-<") 'beginning-of-buffer)
- (global-set-key (kbd "M->") 'end-of-buffer)
- (global-set-key (kbd "C-s") 'isearch-forward)
- (global-set-key (kbd "C-r") 'isearch-backward)
- (global-set-key (kbd "C-M-s") 'isearch-forward-regexp)
- (global-set-key (kbd "C-M-r") 'isearch-backward-regexp)
- (global-set-key (kbd "C-w") 'kill-region)
- (global-set-key (kbd "M-w") 'kill-ring-save)
- (global-set-key (kbd "M-n") 'clone-buffer)
- (global-set-key (kbd "C-q") 'quoted-insert)
- (global-set-key (kbd "C-M-a") 'beginning-of-defun)
- )
- (global-set-key (kbd "<f8>") 'defaultKeys)
- (global-set-key (kbd "<f7>") 'warsKeys)
- (warsKeys)
- ;; Make it so that the major mode defines the title
- (setq frame-title-format "(%m) %b")
- ;; Start the server
- (load "server")
- (unless (server-running-p) (server-start))
- ;; Tab width things
- (setq-default indent-tabs-mode nil)
- (setq tab-width 4)
- ;; Dev env things
- (c-add-style "my-style"
- '("stroustrup"
- (indent-tabs-mode . nil) ; use spaces rather than tabs
- (c-basic-offset . 4) ; indent by four spaces
- (c-offsets-alist . ((inline-open . 0) ; custom indentation rules
- (brace-list-open . 0)
- (statement-case-open . +)))))
- (defun c-hook ()
- (c-set-style "my-style")
- (define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
- ('electric-pair-mode))
- (add-hook 'c++-mode-hook 'c-hook)
- (add-hook 'c-mode-hook 'c-hook)
- ;; Flycheck things
- (add-hook 'c++-mode-hook (lambda () (setq flycheck-gcc-language-standard "c++11")))
- (add-hook 'c-mode-hook (lambda () (flycheck-mode)))
- (add-hook 'c++-mode-hook (lambda () (flycheck-mode)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement