Skip to content

Latest commit

 

History

History
481 lines (352 loc) · 9.8 KB

myinit.org

File metadata and controls

481 lines (352 loc) · 9.8 KB

Generell stuff

Use - Package configuration

(use-package auto-package-update
:ensure t
:config
(setq auto-package-update-delete-old-versions t)
(setq auto-package-update-hide-results t)
(auto-package-update-maybe))

Functions

Generell Stuff

(defun go-previous-number-lines(number)
"Go n numbers up"
(interactive "nLines up:")
(previous-line number))

(defun go-next-number-lines(number)
"Go n numbers down"
(interactive "nLines down:")
(next-line number))

(defun window-half-height ()
(max 1 (/ (1- (window-height (selected-window))) 2)))

(defun scroll-up-half ()
(interactive)
(scroll-up (window-half-height)))

(defun scroll-down-half ()         
(interactive)                    
(scroll-down (window-half-height)))

Dashboard Functions

(defun dashboard-render-notes ()  
(insert "Notes:\n")
(dashboard-get-notes
(lambda (x) (insert (concat "    " x)))
))

(defun dashboard-get-notes (func)
  (setq todos ())
  (org-map-entries
    (lambda () 
      (setq todos 
        (cons (thing-at-point 'line t) todos)))
    nil
    'agenda  
  )
  (setq todos (reverse todos))
  (loop for todo in todos do (funcall func todo))
)
    
(defun dashboard-insert-notes (list-size)
(dashboard-render-notes)
(dashboard-insert-shortcut "n" "Notes:"))

Org Mode

(use-package org
 :ensure t)

(setq org-agenda-files (list "~/agenda/work.org"))

Interface

Hide Gui things

(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
     
(use-package request
    :ensure t)

(defvar quote-url "http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1")
(defvar session-qoute)

(defun get-session-quote() 
   (interactive)
   (insert session-quote)
   
)

(request
 "http://httpbin.org/get"
 :parser 'json-read
 :success (function
           (lambda (&key data &allow-other-keys)
             (setq session-qoute data)
             (insert "I sent: %S" (assoc-default 'args data)))))
    

Theme

(use-package gruvbox-theme
  :ensure t)
(load-theme 'gruvbox-dark-soft t)

Basic Settings

(fset 'yes-or-no-p 'y-or-n-p)
(setq-default indent-tabs-mode nil)
(put 'scroll-left 'disabled nil)
(set-default 'truncate-lines t)

(windmove-default-keybindings 'meta)

(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
      `((".*" ,temporary-file-directory t)))


(add-hook 'prog-mode-hook #'hs-minor-mode)
    
(setq tramp-default-method "ssh")

(load "server")
(unless (server-running-p) (server-start))

Keybindings

(use-package evil
:ensure t)
  

(global-set-key (kbd "<f1>") 'describe-mode) 

(global-set-key (kbd "M-S-<down>") 'enlarge-window)
(global-set-key (kbd "M-S-<left>") 'enlarge-window-horizontally)
(global-set-key (kbd "M-S-<right>") 'shrink-window-horizontally)
(global-set-key (kbd "M-S-<up>") 'shrink-window)

(global-set-key (kbd "M-n") 'go-next-number-lines)
(global-set-key (kbd "M-p") 'go-previous-number-lines)

(global-set-key [next] (lambda () (interactive) (scroll-up 5)))
(global-set-key [prior] (lambda () (interactive) (scroll-down 5)))
(global-set-key (kbd "<M-next>") 'scroll-up-half)
(global-set-key (kbd "<M-prior>") 'scroll-down-half)

(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "<f4>") 'helm-buffers-list)
(global-set-key (kbd "<M-f1>") 'helm-dash)
(global-set-key (kbd "<f6>") 'compile)
(global-set-key (kbd "<f5>") 'quickrun)
(global-set-key (kbd "<f2>") 'rename-file)
(global-set-key (kbd "C-c C-o") 'hs-toggle-hiding)
(global-set-key (kbd "M-;") 'comment-or-uncomment-region)

(global-set-key (kbd "<f12>") 'undo)
(global-set-key (kbd "C-S-f") 'rgrep)
(global-set-key (kbd "C-R") 'query-replace)

(global-set-key (kbd "M-.") 'jedi:goto-definition)
(global-set-key (kbd "M-,") 'jedi:goto-definition-pop-marker)

Autocomplete

(use-package auto-complete
  :ensure t)

(use-package popup
:ensure t)

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
(global-auto-complete-mode t)

Add Ons

Powerline

(use-package powerline
:ensure t)

(use-package moe-theme
:ensure t)

(moe-theme-set-color 'orange)
(powerline-moe-theme)

Dashboard

(use-package dashboard
  :ensure t
  :config
  (dashboard-setup-startup-hook))

(setq dashboard-banner-logo-title "¯\\_( ._. )_/¯")
(setq dashboard-startup-banner 'logo)
(setq dashboard-center-content t)

(add-to-list 'dashboard-item-generators  '(notes . dashboard-insert-notes))
(setq dashboard-items '((recents . 10)(notes . 10)(bookmarks)(agenda . 10)))                            

(setq show-week-agenda-p t)

(dashboard-insert-shortcut "b" "Bookmarks:")

Neotree

(use-package neotree
  :ensure t)

(global-set-key (kbd "<f8>") 'neotree-toggle)

(defun my-neotree-hook () 
  (local-set-key (kbd "<f3>") 'neotree-rename-node)
)

(add-hook 'neotree-mode 'my-neotree-hook)

Tree View Disabled

;(use-package treemacs  
; :ensure t)

; (global-set-key (kbd "<f8>") 'treemacs)
; (treemacs-tag-follow-mode t)
; (treemacs-fringe-indicator-mode t)
; (treemacs-filewatch-mode t)
; (treemacs-resize-icons 11)

;(use-package treemacs-magit  
; :ensure t)

REST Client

(use-package restclient  
 :ensure t)

(setq auto-mode-alist
  (append
    '(("\\.rest\\'" . restclient-mode))
    auto-mode-alist))

Magit

(use-package magit
 :ensure t)

Helm

(use-package helm
  :ensure t)

nlinum

(use-package nlinum
 :ensure t)

nlinum-relative

(use-package nlinum-relative
 :ensure t)

 (setq nlinum-relative-redisplay-delay 0) 
 (setq nlinum-relative-current-symbol "->")   
 (add-hook 'prog-mode-hook 'nlinum-relative-mode)

Programming

Groovy

(use-package groovy-mode
:ensure t)

Jenkins

(add-to-list 'auto-mode-alist
          '("Jenkinsfile" . groovy-mode))

Golang

General

(use-package go-mode
  :ensure t)

(use-package go-autocomplete
  :ensure t)

(defun my-go-mode-hook ()
  (interactive)
  ; Call Gofmt before saving
  (add-hook 'before-save-hook 'gofmt-before-save)

  ; Customize compile command to run go build
  (if (not (string-match "go" compile-command))
      (set (make-local-variable 'compile-command)
           "go build -v -gcflags '-N -l' && go test -v && go vet"))
  
  ; Godef jump key binding
  (local-set-key (kbd "M-.") 'godef-jump)
  (require 'go-autocomplete)

  (setq-local helm-dash-docsets '("Go"))
  (message "Go Hook loaded"))
 
(add-hook 'go-mode-hook 'my-go-mode-hook)

Goto Project snipped

;mama(load "~/.emacs.d/local/goprojectfinder.el")       

Golang

General

(use-package puppet-mode
  :ensure t)

Python

Virtual Env

(use-package pyvenv
:ensure t)

Autocomplete

; M-x jedi:install-server
(use-package jedi
:ensure t)

(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)

Spell Checker

(use-package flycheck
:ensure t
:init (global-flycheck-mode))

PEP8

; Make sure you have autopep8 installed
(use-package py-autopep8
:ensure t)

(add-hook 'python-mode-hook 'py-autopep8-enable-on-save)

TypeScrip

(use-package tide
  :ensure t)

(use-package typescript-mode
  :ensure t)

(defun setup-tide-mode ()
  (interactive)
  (tide-setup)
  (flycheck-mode +1)
  (setq flycheck-check-syntax-automatically '(save mode-enabled))
  (eldoc-mode +1)
  (tide-hl-identifier-mode +1))
 
(add-hook 'before-save-hook 'tide-format-before-save)
(add-hook 'typescript-mode-hook #'setup-tide-mode)

Lua

(use-package lua-mode
  :ensure t)

Dataformats

(use-package json-mode
:ensure t)

(use-package yaml-mode
:ensure t)
 
(use-package sqlite
:ensure t)

Quickrun

(use-package quickrun
:ensure t)

Latex

(use-package auctex
:defer t
:ensure t)

Random Stuff

Nyan Cat

(use-package nyan-mode
:ensure t)

;(nyan-mode)
;(nyan-start-animation)

Markdown

(use-package markdown-mode
:ensure t)

(use-package markdown-preview-mode
:ensure t)

(setq markdown-command "/usr/bin/marked")