Clean up
This commit is contained in:
parent
a4fd3f3be5
commit
b78d210ace
11 changed files with 71 additions and 82 deletions
|
@ -15,6 +15,8 @@
|
||||||
truncate-lines t
|
truncate-lines t
|
||||||
truncate-partial-width-windows 50
|
truncate-partial-width-windows 50
|
||||||
|
|
||||||
|
visual-fill-column-center-text nil
|
||||||
|
|
||||||
;; Sane scroll settings
|
;; Sane scroll settings
|
||||||
scroll-margin 0
|
scroll-margin 0
|
||||||
scroll-conservatively 1001
|
scroll-conservatively 1001
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
split-width-threshold nil ; favor horizontal splits
|
split-width-threshold nil ; favor horizontal splits
|
||||||
show-help-function nil ; hide :help-echo text
|
show-help-function nil ; hide :help-echo text
|
||||||
|
|
||||||
visual-fill-column-center-text nil
|
|
||||||
|
|
||||||
bidi-display-reordering nil
|
bidi-display-reordering nil
|
||||||
|
|
||||||
;; Minibuffer resizing
|
;; Minibuffer resizing
|
||||||
|
@ -60,11 +58,13 @@
|
||||||
(menu-bar-mode -1))
|
(menu-bar-mode -1))
|
||||||
|
|
||||||
;; Fix display of certain unicode characters
|
;; 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)
|
||||||
(mapc (lambda (x) (set-fontset-font "fontset-default" `(,x . ,x) (font-spec :name "DejaVu Sans") nil 'prepend))
|
(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" :size 10) nil))
|
||||||
'(?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓ ?λ))
|
'(?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓ ?λ))
|
||||||
|
|
||||||
(blink-cursor-mode 1) ; do blink cursor
|
(blink-cursor-mode 1) ; do blink cursor
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
(global-eldoc-mode -1))
|
(global-eldoc-mode -1))
|
||||||
|
|
||||||
;; Highlight line
|
;; 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
|
;; Disable line highlight in visual mode
|
||||||
(defvar narf--hl-line-mode nil)
|
(defvar narf--hl-line-mode nil)
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
;; Fade out when unfocused ;;;;;;;;;;;;;
|
;; Fade out when unfocused ;;;;;;;;;;;;;
|
||||||
(add-hook! focus-in (set-frame-parameter nil 'alpha 100))
|
(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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; Plugins ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(use-package visual-fill-column :defer t)
|
(use-package visual-fill-column :defer t)
|
||||||
|
|
|
@ -39,5 +39,10 @@
|
||||||
(beginning-of-line))
|
(beginning-of-line))
|
||||||
(setq *linum-mdown-line* nil))))
|
(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)
|
(provide 'defuns-editor)
|
||||||
;;; defuns-editor.el ends here
|
;;; defuns-editor.el ends here
|
||||||
|
|
|
@ -4,24 +4,8 @@
|
||||||
(defun narf/project-root (&optional strict-p)
|
(defun narf/project-root (&optional strict-p)
|
||||||
"Get the path to the root of your project. Uses `narf-project-root-files' to
|
"Get the path to the root of your project. Uses `narf-project-root-files' to
|
||||||
determine if a directory is a project."
|
determine if a directory is a project."
|
||||||
(let (projectile-require-project-root strict-p) (projectile-project-root))
|
(let (projectile-require-project-root strict-p)
|
||||||
;; (let ((home (file-truename "~"))
|
(projectile-project-root)))
|
||||||
;; (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))
|
|
||||||
)
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf/project-has-files (files &optional root)
|
(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)))
|
(let ((root (or root (narf/project-root)))
|
||||||
(files (if (listp files) files (list files)))
|
(files (if (listp files) files (list files)))
|
||||||
(found-p (if files t)))
|
(found-p (if files t)))
|
||||||
(while found-p
|
(while (and found-p files)
|
||||||
(setq found-p (file-exists-p (narf/project-path-to (pop files) root))))
|
(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))
|
found-p))
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun narf/project-path-to (file &optional root)
|
|
||||||
(let ((root (or root (narf/project-root))))
|
|
||||||
(expand-file-name file root)))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf/project-name (&optional root)
|
(defun narf/project-name (&optional root)
|
||||||
(file-name-nondirectory (directory-file-name (or root (narf/project-root)))))
|
(file-name-nondirectory (directory-file-name (or root (narf/project-root)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf/project-p ()
|
(defalias 'narf/project-p 'projectile-project-p)
|
||||||
(not (null (narf/project-root t))))
|
|
||||||
|
|
||||||
(provide 'defuns-project)
|
(provide 'defuns-project)
|
||||||
;;; defuns-project.el ends here
|
;;; defuns-project.el ends here
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
(if quoted
|
(if quoted
|
||||||
backend
|
backend
|
||||||
(intern (format "company-%s" backend))))
|
(intern (format "company-%s" backend))))
|
||||||
(if quoted (cadr backends) backends))
|
(if quoted (cadr backends) backends))))
|
||||||
company-semantic company-yasnippet))
|
|
||||||
company-backends)))
|
company-backends)))
|
||||||
(add-hook ',(intern (format "%s-hook" hook)) ',def-name))))
|
(add-hook ',(intern (format "%s-hook" hook)) ',def-name))))
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,14 @@
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defmacro define-env-command! (mode command)
|
(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! (focus-in find-file) 'narf|spaceline-env-update)
|
||||||
`(add-hook ',(intern (format "%s-hook" (symbol-name mode)))
|
`(add-hook ',(intern (format "%s-hook" (symbol-name mode)))
|
||||||
(lambda () (setq narf--env-command ,command))))
|
(lambda () (setq narf--env-command ,command))))
|
||||||
|
|
|
@ -16,16 +16,8 @@
|
||||||
:defer t
|
:defer t
|
||||||
:commands httpd-start)
|
: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--line-spacing line-spacing)
|
||||||
(defvar big-mode--powerline-height powerline-height)
|
(defvar big-mode--powerline-height powerline-height)
|
||||||
|
|
||||||
(define-minor-mode big-mode
|
(define-minor-mode big-mode
|
||||||
:init-value nil
|
:init-value nil
|
||||||
:lighter " BIG"
|
:lighter " BIG"
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
:init
|
:init
|
||||||
(define-repl! lua-mode narf-inf-lua)
|
(define-repl! lua-mode narf-inf-lua)
|
||||||
(add-hook! lua-mode 'flycheck-mode)
|
(add-hook! lua-mode 'flycheck-mode)
|
||||||
;; (after! company-dict
|
(after! company-dict
|
||||||
;; (add-to-list 'company-dict-minor-mode-alist 'love-mode))
|
(add-to-list 'company-dict-minor-mode-alist 'love-mode))
|
||||||
|
|
||||||
(defun narf-inf-lua ()
|
(defun narf-inf-lua ()
|
||||||
(lua-start-process "lua" "lua")
|
(lua-start-process "lua" "lua")
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
(require 'php-extras)
|
(require 'php-extras)
|
||||||
(defun php-extras-company-setup ()) ;; company will set up itself
|
(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"))
|
(unless (file-exists-p (concat php-extras-eldoc-functions-file ".el"))
|
||||||
(async-start `(lambda ()
|
(async-start `(lambda ()
|
||||||
,(async-inject-variables "\\`\\(load-path\\|php-extras-eldoc-functions-file\\)$")
|
,(async-inject-variables "\\`\\(load-path\\|php-extras-eldoc-functions-file\\)$")
|
||||||
|
@ -26,13 +27,14 @@
|
||||||
(require 'php-refactor-mode)
|
(require 'php-refactor-mode)
|
||||||
(add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode)))
|
(add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode)))
|
||||||
|
|
||||||
|
;; PHP Repl
|
||||||
(use-package php-boris :defer t
|
(use-package php-boris :defer t
|
||||||
:init
|
:init
|
||||||
(define-repl! php-mode php-boris)
|
(define-repl! php-mode php-boris)
|
||||||
:config
|
:config
|
||||||
(evil-set-initial-state 'php-boris-mode 'emacs)
|
(evil-set-initial-state 'php-boris-mode 'emacs))
|
||||||
(setq php-boris-command "~/.dotfiles/scripts/run-boris"))
|
|
||||||
|
|
||||||
|
;; Support for Facebook's version of PHP
|
||||||
(use-package hack-mode :mode "\\.hh$")
|
(use-package hack-mode :mode "\\.hh$")
|
||||||
|
|
||||||
(define-minor-mode php-laravel-mode
|
(define-minor-mode php-laravel-mode
|
||||||
|
|
|
@ -14,8 +14,7 @@
|
||||||
(define-env-command! ruby-mode "ruby --version | cut -d' ' -f2")
|
(define-env-command! ruby-mode "ruby --version | cut -d' ' -f2")
|
||||||
:config
|
:config
|
||||||
;; Formatting
|
;; Formatting
|
||||||
(setq ruby-indent-level 2
|
(setq ruby-deep-indent-paren t)
|
||||||
ruby-deep-indent-paren t)
|
|
||||||
|
|
||||||
;; Don't interfere with my custom RET behavior
|
;; Don't interfere with my custom RET behavior
|
||||||
(define-key ruby-mode-map [?\n] nil)
|
(define-key ruby-mode-map [?\n] nil)
|
||||||
|
|
|
@ -1,56 +1,57 @@
|
||||||
;;; my-commands.el
|
;;; my-commands.el
|
||||||
|
|
||||||
;; Emacs utilities
|
;; Emacs utilities
|
||||||
(exmap "acomp[ile]" 'narf:compile-autoloads)
|
(exmap "acomp[ile]" 'narf:compile-autoloads) ; compile autoloads
|
||||||
(exmap "bcomp[ile]" 'narf:compile-el)
|
(exmap "bcomp[ile]" 'narf:compile-el)
|
||||||
(exmap "echo" 'narf:echo)
|
(exmap "echo" 'narf:echo)
|
||||||
(exmap "minor" 'helm-describe-modes)
|
(exmap "minor" 'helm-describe-modes) ; list minor modes
|
||||||
|
|
||||||
;; Editing
|
;; Editing
|
||||||
(exmap "@" 'narf/evil-macro-on-all-lines)
|
(exmap "@" 'narf/evil-macro-on-all-lines) ; run macro on each line
|
||||||
(exmap "al[ign]" 'narf:align)
|
(exmap "al[ign]" 'narf:align) ; align by regexp
|
||||||
(exmap "en[ew]" 'narf:file-create)
|
(exmap "en[ew]" 'narf:file-create) ; open a blank buffer
|
||||||
(exmap "na[rrow]" 'narf:narrow) ; Narrow buffer to selection
|
(exmap "na[rrow]" 'narf:narrow) ; narrow buffer to selection
|
||||||
(exmap "ref[actor]" 'emr-show-refactor-menu)
|
(exmap "ref[actor]" 'emr-show-refactor-menu) ; open emr menu
|
||||||
(exmap "retab" 'narf:whitespace-retab)
|
(exmap "retab" 'narf:whitespace-retab)
|
||||||
(exmap "settr[im]" 'narf:toggle-delete-trailing-whitespace)
|
(exmap "settr[im]" 'narf:toggle-delete-trailing-whitespace)
|
||||||
(exmap "snip[pets]" 'narf:yas-snippets) ; snip[!]
|
(exmap "snip[pets]" 'narf:yas-snippets) ; visit a snippet
|
||||||
(exmap "tsnip[pets]" 'narf:yas-file-templates) ; tsnip[!]
|
(exmap "tsnip[pets]" 'narf:yas-file-templates) ; visit a file template
|
||||||
(exmap "wal[ign]" 'narf:whitespace-align)
|
(exmap "wal[ign]" 'narf:whitespace-align) ; align spaces
|
||||||
(exmap "rec[ent]" 'narf:helm-recentf)
|
(exmap "rec[ent]" 'narf:helm-recentf) ; show recent files in helm
|
||||||
(exmap "reo[rient]" 'narf/window-reorient)
|
(exmap "reo[rient]" 'narf/window-reorient) ; scroll all windows to left
|
||||||
|
|
||||||
;; External resources
|
;; External resources
|
||||||
(exmap "dash" 'narf:dash)
|
(exmap "dash" 'narf:dash) ; look up in Dash.app
|
||||||
(exmap "http" 'httpd-start)
|
(exmap "http" 'httpd-start) ; start http server
|
||||||
(exmap "re[gex]" 'narf:regex)
|
(exmap "re[gex]" 'narf:regex) ; open re-builder
|
||||||
(exmap "repl" 'narf:repl)
|
(exmap "repl" 'narf:repl) ; invoke or send to repl
|
||||||
(exmap "t[mux]" 'narf:tmux)
|
(exmap "t[mux]" 'narf:tmux) ; send to tmux
|
||||||
(exmap "t[mux]w" 'narf/tmux-new-window)
|
(exmap "t[mux]w" 'narf/tmux-new-window) ; open new window in tmux
|
||||||
(exmap "tcd" 'narf:tmux-cd)
|
(exmap "tcd" 'narf:tmux-cd) ; cd to default-directory in tmux
|
||||||
(exmap "x" 'narf:send-to-scratch-or-org)
|
(exmap "x" 'narf:send-to-scratch-or-org)
|
||||||
;; GIT
|
;; GIT
|
||||||
(exmap "br[owse]" 'narf:git-remote-browse)
|
(exmap "br[owse]" 'narf:git-remote-browse) ; show file in github/gitlab
|
||||||
|
|
||||||
;; Dealing with buffers
|
;; Dealing with buffers
|
||||||
(exmap "k[ill]" 'narf/kill-real-buffer) ; Kill current buffer
|
(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]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]buried" 'narf:kill-buried-buffers) ; Kill all buried buffers (bang = in project)
|
||||||
(exmap "k[ill]o" 'narf:kill-unreal-buffers)
|
(exmap "k[ill]o" 'narf:kill-unreal-buffers) ; kill unreal buffers
|
||||||
(exmap "k[ill]match" 'narf:kill-matching-buffers)
|
(exmap "k[ill]match" 'narf:kill-matching-buffers) ; kill buffers that match regexp
|
||||||
(exmap "l[ast]" 'narf/popup-last-buffer)
|
(exmap "l[ast]" 'narf/popup-last-buffer) ; pop up last popup
|
||||||
(exmap "m[sg]" 'narf/popup-messages)
|
(exmap "m[sg]" 'narf/popup-messages) ; open *messages* in popup
|
||||||
|
|
||||||
;; Project navigation
|
;; Project navigation
|
||||||
(exmap "a" 'helm-projectile-find-other-file)
|
(exmap "a" 'helm-projectile-find-other-file) ; open alternate file
|
||||||
(exmap "ag" 'narf:helm-ag-search)
|
(exmap "ag" 'narf:helm-ag-search) ; project text search
|
||||||
(exmap "ag[cw]d" 'narf:helm-ag-search-cwd)
|
(exmap "ag[cw]d" 'narf:helm-ag-search-cwd) ; current directory search
|
||||||
(exmap "agr" 'narf:helm-ag-regex-search)
|
(exmap "agr" 'narf:helm-ag-regex-search) ; project regex search
|
||||||
(exmap "agr[cw]d" 'narf:helm-ag-regex-search-cwd)
|
(exmap "agr[cw]d" 'narf:helm-ag-regex-search-cwd) ; current directory regexp search
|
||||||
(exmap "cd" 'narf:cd)
|
(exmap "cd" 'narf:cd)
|
||||||
(exmap "f[ind]" 'narf:helm-swoop)
|
(exmap "f[ind]" 'narf:helm-swoop) ; in-file search
|
||||||
;; Project tools
|
;; Project tools
|
||||||
(exmap "ma[ke]" 'narf:build)
|
(exmap "ma[ke]" 'narf:build)
|
||||||
|
(exmap "build" 'narf:build)
|
||||||
;; File operations
|
;; File operations
|
||||||
(exmap "mv" 'narf:file-move)
|
(exmap "mv" 'narf:file-move)
|
||||||
(exmap "rm" 'narf:file-delete) ; rm[!]
|
(exmap "rm" 'narf:file-delete) ; rm[!]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue