Skip to content

Commit

Permalink
Company mode, nlinum mode and more
Browse files Browse the repository at this point in the history
  • Loading branch information
Brady Love committed Mar 21, 2015
1 parent 626ff8c commit 71b7c37
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 65 deletions.
10 changes: 7 additions & 3 deletions init.d/10_packages.el
Expand Up @@ -36,6 +36,7 @@
autopair
smart-mode-line
restclient
nlinum

;; Helm
helm
Expand All @@ -46,11 +47,14 @@
yasnippet

;; Auto-completion
auto-complete
go-autocomplete
;; auto-complete
;; go-autocomplete
company


;; Themes
flatui-theme
smyx-theme
; flatui-theme
;; ample-theme
;; darcula-theme
;; tangotango-theme
Expand Down
57 changes: 36 additions & 21 deletions init.d/ZZ_complete_setup.el
Expand Up @@ -12,7 +12,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(diminish 'anzu-mode)
(diminish 'projectile-mode)
(diminish 'auto-complete-mode)
;; (diminish 'auto-complete-mode)
(diminish 'autopair-mode)
(diminish 'yas-minor-mode)
(diminish 'ruby-end-mode)
Expand All @@ -32,32 +32,47 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; auto-complete
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq exec-path
(append exec-path
'("/home/brady/gocode/bin" "/Users/brady/gocode/bin" "/usr/local/Cellar/go/1.3/bin/" "/usr/local/bin/")))
(require 'go-autocomplete)
(require 'auto-complete-config)
(ac-config-default)
;; (setq exec-path
;; (append exec-path
;; '("/home/brady/gocode/bin" "/Users/brady/gocode/bin" "/usr/local/Cellar/go/1.3/bin/" "/usr/local/bin/")))
;; (require 'go-autocomplete)
;; (require 'auto-complete-config)
;; (ac-config-default)

(setq ac-auto-start t)
(setq ac-auto-show-menu 0.0)
(ac-set-trigger-key "TAB")
(define-key ac-menu-map "\C-n" 'ac-next)
(define-key ac-menu-map "\C-p" 'ac-previous)
;; (setq ac-auto-start t)
;; (setq ac-auto-show-menu 0.0)
;; (ac-set-trigger-key "TAB")
;; (define-key ac-menu-map "\C-n" 'ac-next)
;; (define-key ac-menu-map "\C-p" 'ac-previous)

(add-to-list 'ac-modes 'enh-ruby-mode)
(add-to-list 'ac-modes 'js2-mode)
(add-to-list 'ac-modes 'css-mode)
;; (add-to-list 'ac-modes 'enh-ruby-mode)
;; (add-to-list 'ac-modes 'js2-mode)
;; (add-to-list 'ac-modes 'css-mode)

(global-auto-complete-mode +1)
;; (global-auto-complete-mode +1)

;; Add Go source to auto-complete
(add-hook 'go-mode-hook
(lambda ()
(add-to-list 'ac-source ac-go-candidates)))
;; ;; Add Go source to auto-complete
;; (add-hook 'go-mode-hook
;; (lambda ()
;; (add-to-list 'ac-source ac-go-candidates)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; helm ()
;; nlinum-mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-nlinum-mode)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; company-mode (http://company-mode.github.io/)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq company-idle-delay 0)
(add-hook 'after-init-hook 'global-company-mode)

;; (add-hook 'ruby-mode
;; (lambda ()
;; (set (make-local-variable 'company-backends) '(company-ruby))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; helm (https://github.com/emacs-helm/helm)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'helm-config)

Expand Down
82 changes: 41 additions & 41 deletions init.d/relative_linums.el
@@ -1,47 +1,47 @@
(global-linum-mode t)
(setq linum-last-pos 0)
;; (global-linum-mode t)
;; (setq linum-last-pos 0)

(eval-after-load "linum"
'(defun linum-update (buffer)
"Update line numbers for all windows displaying BUFFER."
;; this is only change but couldn't find better way to do it, tried
;; linum-before-update-hook but it runs in an excursion so I couldn't get
;; current line number
(setq linum-last-pos (line-number-at-pos))
(with-current-buffer buffer
(when linum-mode
(setq linum-available linum-overlays)
(setq linum-overlays nil)
(save-excursion
(mapc #'linum-update-window
(get-buffer-window-list buffer nil 'visible)))
(mapc #'delete-overlay linum-available)
(setq linum-available nil)))))
;; (eval-after-load "linum"
;; '(defun linum-update (buffer)
;; "Update line numbers for all windows displaying BUFFER."
;; ;; this is only change but couldn't find better way to do it, tried
;; ;; linum-before-update-hook but it runs in an excursion so I couldn't get
;; ;; current line number
;; (setq linum-last-pos (line-number-at-pos))
;; (with-current-buffer buffer
;; (when linum-mode
;; (setq linum-available linum-overlays)
;; (setq linum-overlays nil)
;; (save-excursion
;; (mapc #'linum-update-window
;; (get-buffer-window-list buffer nil 'visible)))
;; (mapc #'delete-overlay linum-available)
;; (setq linum-available nil)))))

(defface linum-zero
'((t :inherit linum :foreground "white" :background "#FF0000" :weight bold))
"Face for displaying line number 0"
:group 'linum)
;; (defface linum-zero
;; '((t :inherit linum :foreground "white" :background "#FF0000" :weight bold))
;; "Face for displaying line number 0"
;; :group 'linum)

(defface linum-top
'((t :inherit linum :foreground "grey80" :background "grey40" :weight bold))
"Face for displaying top line number"
:group 'linum)
;; (defface linum-top
;; '((t :inherit linum :foreground "grey80" :background "grey40" :weight bold))
;; "Face for displaying top line number"
;; :group 'linum)

(defface linum-line
'((t :inherit linum :foreground "grey60" :background "grey30" :weight normal))
"Face for displaying absolute line number"
:group 'linum)
;; (defface linum-line
;; '((t :inherit linum :foreground "grey60" :background "grey30" :weight normal))
;; "Face for displaying absolute line number"
;; :group 'linum)

(defun linum-relativenumber-format (line-number)
(let ((diff (abs (- line-number linum-last-pos))))
(concat (propertize (format "%3d" line-number)
'face 'linum-line)
(propertize (format "%3d" diff)
'face (cond ((zerop diff) 'linum-zero)
((eq 1 line-number) 'linum-top)
(t 'linum))))))
;; (defun linum-relativenumber-format (line-number)
;; (let ((diff (abs (- line-number linum-last-pos))))
;; (concat (propertize (format "%3d" line-number)
;; 'face 'linum-line)
;; (propertize (format "%3d" diff)
;; 'face (cond ((zerop diff) 'linum-zero)
;; ((eq 1 line-number) 'linum-top)
;; (t 'linum))))))

;; (setq linum-format 'dynamic)
(setq linum-format 'linum-relativenumber-format)
(setq linum-mode t)
;; ;; (setq linum-format 'dynamic)
;; (setq linum-format 'linum-relativenumber-format)
;; (setq linum-mode t)

0 comments on commit 71b7c37

Please sign in to comment.