This commit is contained in:
Henrik Lissner 2016-02-26 00:08:41 -05:00
parent a4fd3f3be5
commit b78d210ace
11 changed files with 71 additions and 82 deletions

View file

@ -15,6 +15,8 @@
truncate-lines t
truncate-partial-width-windows 50
visual-fill-column-center-text nil
;; Sane scroll settings
scroll-margin 0
scroll-conservatively 1001

View file

@ -26,8 +26,6 @@
split-width-threshold nil ; favor horizontal splits
show-help-function nil ; hide :help-echo text
visual-fill-column-center-text nil
bidi-display-reordering nil
;; Minibuffer resizing
@ -60,11 +58,13 @@
(menu-bar-mode -1))
;; Fix display of certain unicode characters
(mapc (lambda (x) (set-fontset-font "fontset-default" `(,x . ,x) (font-spec :name "DejaVu Sans") nil 'prepend))
'(?☑ ?☐ ?✍ ?⚠))
(mapc (lambda (x) (set-fontset-font "fontset-default" `(,x . ,x) (font-spec :name "DejaVu Sans") nil 'prepend))
'(?✸ ?✿ ?★))
(mapc (lambda (x) (set-fontset-font "fontset-default" `(,x . ,x) (font-spec :name "DejaVu Sans" :size 10) nil))
(mapc (lambda (x)
(set-fontset-font "fontset-default" `(,x . ,x)
(font-spec :name "DejaVu Sans") nil 'prepend))
'(?☑ ?☐ ?✍ ?⚠ ?★))
(mapc (lambda (x)
(set-fontset-font "fontset-default" `(,x . ,x)
(font-spec :name "DejaVu Sans" :size 10) nil))
'(?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓ ))
(blink-cursor-mode 1) ; do blink cursor
@ -74,7 +74,7 @@
(global-eldoc-mode -1))
;; Highlight line
(add-hook! (prog-mode puml-mode markdown-mode) 'hl-line-mode)
(add-hook! (prog-mode markdown-mode) 'hl-line-mode)
;; Disable line highlight in visual mode
(defvar narf--hl-line-mode nil)
@ -101,7 +101,7 @@
;; Fade out when unfocused ;;;;;;;;;;;;;
(add-hook! focus-in (set-frame-parameter nil 'alpha 100))
(add-hook! focus-out (set-frame-parameter nil 'alpha 90))
(add-hook! focus-out (set-frame-parameter nil 'alpha 60))
;; Plugins ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package visual-fill-column :defer t)

View file

@ -39,5 +39,10 @@
(beginning-of-line))
(setq *linum-mdown-line* nil))))
;;;###autoload
(defun narf*load-hs-minor-mode ()
(hs-minor-mode 1)
(advice-remove 'evil-toggle-fold 'narf-load-hs-minor-mode))
(provide 'defuns-editor)
;;; defuns-editor.el ends here

View file

@ -4,24 +4,8 @@
(defun narf/project-root (&optional strict-p)
"Get the path to the root of your project. Uses `narf-project-root-files' to
determine if a directory is a project."
(let (projectile-require-project-root strict-p) (projectile-project-root))
;; (let ((home (file-truename "~"))
;; (path default-directory))
;; (unless (file-name-absolute-p path)
;; (setq path (expand-file-name path)))
;; (catch 'found
;; (ignore-errors
;; (f-traverse-upwards
;; (lambda (path)
;; (let ((path (file-truename path)))
;; (if (file-equal-p home path)
;; (throw 'found (if strict-p nil default-directory))
;; (dolist (file narf-project-root-files)
;; (when (file-exists-p (expand-file-name file path))
;; (throw 'found path))))))
;; path))
;; default-directory))
)
(let (projectile-require-project-root strict-p)
(projectile-project-root)))
;;;###autoload
(defun narf/project-has-files (files &optional root)
@ -29,22 +13,19 @@ determine if a directory is a project."
(let ((root (or root (narf/project-root)))
(files (if (listp files) files (list files)))
(found-p (if files t)))
(while found-p
(setq found-p (file-exists-p (narf/project-path-to (pop files) root))))
(while (and found-p files)
(let ((file (expand-file-name (pop files) root)))
(setq found-p (if (string-suffix-p "/" file)
(file-directory-p file)
(file-exists-p file)))))
found-p))
;;;###autoload
(defun narf/project-path-to (file &optional root)
(let ((root (or root (narf/project-root))))
(expand-file-name file root)))
;;;###autoload
(defun narf/project-name (&optional root)
(file-name-nondirectory (directory-file-name (or root (narf/project-root)))))
;;;###autoload
(defun narf/project-p ()
(not (null (narf/project-root t))))
(defalias 'narf/project-p 'projectile-project-p)
(provide 'defuns-project)
;;; defuns-project.el ends here

View file

@ -13,8 +13,7 @@
(if quoted
backend
(intern (format "company-%s" backend))))
(if quoted (cadr backends) backends))
company-semantic company-yasnippet))
(if quoted (cadr backends) backends))))
company-backends)))
(add-hook ',(intern (format "%s-hook" hook)) ',def-name))))

View file

@ -2,6 +2,14 @@
;;;###autoload
(defmacro define-env-command! (mode command)
"Define a COMMAND for MODE that will set `narf--env-command' when that mode is
activated, which should return the version number of the current environment. It is used
by `narf|spaceline-env-update' to display a version number in the modeline. For instance:
(define-env-command! ruby-mode \"ruby --version | cut -d' ' -f2\")
This will display the ruby version in the modeline in ruby-mode buffers. It is cached the
first time."
(add-hook! (focus-in find-file) 'narf|spaceline-env-update)
`(add-hook ',(intern (format "%s-hook" (symbol-name mode)))
(lambda () (setq narf--env-command ,command))))

View file

@ -16,16 +16,8 @@
:defer t
:commands httpd-start)
(add-hook! org-load
(use-package ox-reveal
:config
(setq org-reveal-root "https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.2.0/js/reveal.min.js")))
;;;
(defvar big-mode--line-spacing line-spacing)
(defvar big-mode--powerline-height powerline-height)
(define-minor-mode big-mode
:init-value nil
:lighter " BIG"

View file

@ -6,8 +6,8 @@
:init
(define-repl! lua-mode narf-inf-lua)
(add-hook! lua-mode 'flycheck-mode)
;; (after! company-dict
;; (add-to-list 'company-dict-minor-mode-alist 'love-mode))
(after! company-dict
(add-to-list 'company-dict-minor-mode-alist 'love-mode))
(defun narf-inf-lua ()
(lua-start-process "lua" "lua")

View file

@ -13,6 +13,7 @@
(require 'php-extras)
(defun php-extras-company-setup ()) ;; company will set up itself
;; Generate php-extras documentation and completion asynchronously
(unless (file-exists-p (concat php-extras-eldoc-functions-file ".el"))
(async-start `(lambda ()
,(async-inject-variables "\\`\\(load-path\\|php-extras-eldoc-functions-file\\)$")
@ -26,13 +27,14 @@
(require 'php-refactor-mode)
(add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode)))
;; PHP Repl
(use-package php-boris :defer t
:init
(define-repl! php-mode php-boris)
:config
(evil-set-initial-state 'php-boris-mode 'emacs)
(setq php-boris-command "~/.dotfiles/scripts/run-boris"))
(evil-set-initial-state 'php-boris-mode 'emacs))
;; Support for Facebook's version of PHP
(use-package hack-mode :mode "\\.hh$")
(define-minor-mode php-laravel-mode

View file

@ -14,8 +14,7 @@
(define-env-command! ruby-mode "ruby --version | cut -d' ' -f2")
:config
;; Formatting
(setq ruby-indent-level 2
ruby-deep-indent-paren t)
(setq ruby-deep-indent-paren t)
;; Don't interfere with my custom RET behavior
(define-key ruby-mode-map [?\n] nil)

View file

@ -1,56 +1,57 @@
;;; my-commands.el
;; Emacs utilities
(exmap "acomp[ile]" 'narf:compile-autoloads)
(exmap "acomp[ile]" 'narf:compile-autoloads) ; compile autoloads
(exmap "bcomp[ile]" 'narf:compile-el)
(exmap "echo" 'narf:echo)
(exmap "minor" 'helm-describe-modes)
(exmap "minor" 'helm-describe-modes) ; list minor modes
;; Editing
(exmap "@" 'narf/evil-macro-on-all-lines)
(exmap "al[ign]" 'narf:align)
(exmap "en[ew]" 'narf:file-create)
(exmap "na[rrow]" 'narf:narrow) ; Narrow buffer to selection
(exmap "ref[actor]" 'emr-show-refactor-menu)
(exmap "@" 'narf/evil-macro-on-all-lines) ; run macro on each line
(exmap "al[ign]" 'narf:align) ; align by regexp
(exmap "en[ew]" 'narf:file-create) ; open a blank buffer
(exmap "na[rrow]" 'narf:narrow) ; narrow buffer to selection
(exmap "ref[actor]" 'emr-show-refactor-menu) ; open emr menu
(exmap "retab" 'narf:whitespace-retab)
(exmap "settr[im]" 'narf:toggle-delete-trailing-whitespace)
(exmap "snip[pets]" 'narf:yas-snippets) ; snip[!]
(exmap "tsnip[pets]" 'narf:yas-file-templates) ; tsnip[!]
(exmap "wal[ign]" 'narf:whitespace-align)
(exmap "rec[ent]" 'narf:helm-recentf)
(exmap "reo[rient]" 'narf/window-reorient)
(exmap "snip[pets]" 'narf:yas-snippets) ; visit a snippet
(exmap "tsnip[pets]" 'narf:yas-file-templates) ; visit a file template
(exmap "wal[ign]" 'narf:whitespace-align) ; align spaces
(exmap "rec[ent]" 'narf:helm-recentf) ; show recent files in helm
(exmap "reo[rient]" 'narf/window-reorient) ; scroll all windows to left
;; External resources
(exmap "dash" 'narf:dash)
(exmap "http" 'httpd-start)
(exmap "re[gex]" 'narf:regex)
(exmap "repl" 'narf:repl)
(exmap "t[mux]" 'narf:tmux)
(exmap "t[mux]w" 'narf/tmux-new-window)
(exmap "tcd" 'narf:tmux-cd)
(exmap "dash" 'narf:dash) ; look up in Dash.app
(exmap "http" 'httpd-start) ; start http server
(exmap "re[gex]" 'narf:regex) ; open re-builder
(exmap "repl" 'narf:repl) ; invoke or send to repl
(exmap "t[mux]" 'narf:tmux) ; send to tmux
(exmap "t[mux]w" 'narf/tmux-new-window) ; open new window in tmux
(exmap "tcd" 'narf:tmux-cd) ; cd to default-directory in tmux
(exmap "x" 'narf:send-to-scratch-or-org)
;; GIT
(exmap "br[owse]" 'narf:git-remote-browse)
(exmap "br[owse]" 'narf:git-remote-browse) ; show file in github/gitlab
;; Dealing with buffers
(exmap "k[ill]" 'narf/kill-real-buffer) ; Kill current buffer
(exmap "k[ill]all" 'narf:kill-all-buffers) ; Kill all buffers (bang = in project)
(exmap "k[ill]buried" 'narf:kill-buried-buffers) ; Kill all buried buffers (bang = in project)
(exmap "k[ill]o" 'narf:kill-unreal-buffers)
(exmap "k[ill]match" 'narf:kill-matching-buffers)
(exmap "l[ast]" 'narf/popup-last-buffer)
(exmap "m[sg]" 'narf/popup-messages)
(exmap "k[ill]o" 'narf:kill-unreal-buffers) ; kill unreal buffers
(exmap "k[ill]match" 'narf:kill-matching-buffers) ; kill buffers that match regexp
(exmap "l[ast]" 'narf/popup-last-buffer) ; pop up last popup
(exmap "m[sg]" 'narf/popup-messages) ; open *messages* in popup
;; Project navigation
(exmap "a" 'helm-projectile-find-other-file)
(exmap "ag" 'narf:helm-ag-search)
(exmap "ag[cw]d" 'narf:helm-ag-search-cwd)
(exmap "agr" 'narf:helm-ag-regex-search)
(exmap "agr[cw]d" 'narf:helm-ag-regex-search-cwd)
(exmap "a" 'helm-projectile-find-other-file) ; open alternate file
(exmap "ag" 'narf:helm-ag-search) ; project text search
(exmap "ag[cw]d" 'narf:helm-ag-search-cwd) ; current directory search
(exmap "agr" 'narf:helm-ag-regex-search) ; project regex search
(exmap "agr[cw]d" 'narf:helm-ag-regex-search-cwd) ; current directory regexp search
(exmap "cd" 'narf:cd)
(exmap "f[ind]" 'narf:helm-swoop)
(exmap "f[ind]" 'narf:helm-swoop) ; in-file search
;; Project tools
(exmap "ma[ke]" 'narf:build)
(exmap "build" 'narf:build)
;; File operations
(exmap "mv" 'narf:file-move)
(exmap "rm" 'narf:file-delete) ; rm[!]