New package insert-shebang
This commit is contained in:
parent
cbb195141c
commit
fd07fd47ef
|
@ -35,5 +35,7 @@ In order to enable =sh= scripts linting, install [[https://www.shellcheck.net/][
|
|||
|
||||
| Key Binding | Description |
|
||||
|-------------+-----------------------------------------------------------|
|
||||
| ~SPC i !~ | insert shebang in a script file |
|
||||
| ~SPC m \~ | insert end-of-line backslashes to the lines in the region |
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
;;; funcs.el --- Shell Scripts Layer functions File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||
;; URL: https://github.com/syl20bnr/spacemacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
|
||||
;; shebang
|
||||
|
||||
(defun spacemacs/insert-shebang ()
|
||||
"Insert shebang line at the top of the file."
|
||||
(interactive)
|
||||
(require 'insert-shebang)
|
||||
(insert-shebang-get-extension-and-insert
|
||||
(file-name-nondirectory (buffer-file-name))))
|
|
@ -17,6 +17,7 @@
|
|||
flycheck
|
||||
ggtags
|
||||
helm-gtags
|
||||
insert-shebang
|
||||
(sh-script :location built-in)
|
||||
))
|
||||
|
||||
|
@ -68,3 +69,13 @@
|
|||
|
||||
(defun shell-scripts/post-init-helm-gtags ()
|
||||
(spacemacs/helm-gtags-define-keys-for-mode 'sh-mode))
|
||||
|
||||
(defun shell-scripts/init-insert-shebang ()
|
||||
(use-package insert-shebang
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(spacemacs/set-leader-keys "i!" 'spacemacs/insert-shebang)
|
||||
;; we don't want to insert shebang lines automatically
|
||||
(remove-hook 'find-file-hook 'insert-shebang))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue