multi line support for go imenu index
This commit is contained in:
parent
893794b519
commit
d2c32426d3
@ -631,7 +631,8 @@ The current directory is assumed to be the project's root otherwise."
|
|||||||
(when (not (string-equal
|
(when (not (string-equal
|
||||||
(im-get imalison:buffer-index (current-buffer))
|
(im-get imalison:buffer-index (current-buffer))
|
||||||
default-directory))
|
default-directory))
|
||||||
(im-put imalison:buffer-index (current-buffer) (imalison:term-sym default-directory)))
|
(im-put imalison:buffer-index (current-buffer)
|
||||||
|
(imalison:term-sym default-directory)))
|
||||||
(rename-buffer (format "term - %s" default-directory) t)))))
|
(rename-buffer (format "term - %s" default-directory) t)))))
|
||||||
|
|
||||||
;; Set path from shell.
|
;; Set path from shell.
|
||||||
@ -734,7 +735,7 @@ The current directory is assumed to be the project's root otherwise."
|
|||||||
:config
|
:config
|
||||||
(progn (global-diff-hl-mode)))
|
(progn (global-diff-hl-mode)))
|
||||||
|
|
||||||
(use-package gitolite-clone :ensure t)
|
(use-package gitolite-clone)
|
||||||
|
|
||||||
(use-package magit
|
(use-package magit
|
||||||
:commands magit-status
|
:commands magit-status
|
||||||
@ -2170,6 +2171,28 @@ window is active in the perspective."
|
|||||||
|
|
||||||
(use-package go-mode
|
(use-package go-mode
|
||||||
:mode (("\\.go\\'" . go-mode))
|
:mode (("\\.go\\'" . go-mode))
|
||||||
|
:preface
|
||||||
|
(progn
|
||||||
|
(defun go-mode-create-imenu-index ()
|
||||||
|
"Create and return an imenu index alist. Unlike the default
|
||||||
|
alist created by go-mode, this method creates an alist where
|
||||||
|
items follow a style that is consistent with other prog-modes."
|
||||||
|
(let* ((patterns '(("type" "^type *\\([^ \t\n\r\f]*\\)" 1)))
|
||||||
|
(type-index (imenu--generic-function patterns))
|
||||||
|
(func-index))
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(while (re-search-forward go-func-meth-regexp (point-max) t)
|
||||||
|
(let* ((var (match-string-no-properties 1))
|
||||||
|
(func (match-string-no-properties 2))
|
||||||
|
(name (if var
|
||||||
|
(concat (substring var 0 -1) "." func)
|
||||||
|
func))
|
||||||
|
(beg (match-beginning 0))
|
||||||
|
(marker (copy-marker beg))
|
||||||
|
(item (cons name marker)))
|
||||||
|
(setq func-index (cons item func-index)))))
|
||||||
|
(nconc type-index (list (cons "func" func-index))))))
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(use-package company-go
|
(use-package company-go
|
||||||
@ -2187,7 +2210,7 @@ window is active in the perspective."
|
|||||||
(setq imenu-create-index-function
|
(setq imenu-create-index-function
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(imalison:flatten-imenu-index
|
(imalison:flatten-imenu-index
|
||||||
(imenu-default-create-index-function))))
|
(go-mode-create-imenu-index))))
|
||||||
(set (make-local-variable 'company-backends) '(company-go)))
|
(set (make-local-variable 'company-backends) '(company-go)))
|
||||||
(add-hook 'go-mode-hook 'imalison:go-mode-hook)
|
(add-hook 'go-mode-hook 'imalison:go-mode-hook)
|
||||||
(setq gofmt-command "goimports")
|
(setq gofmt-command "goimports")
|
||||||
@ -2246,6 +2269,7 @@ window is active in the perspective."
|
|||||||
(bind-key "M-|" 'imalison:shell-command-on-region)
|
(bind-key "M-|" 'imalison:shell-command-on-region)
|
||||||
(bind-key "C--" 'undo)
|
(bind-key "C--" 'undo)
|
||||||
(bind-key "C-c 8" 'imalison:term)
|
(bind-key "C-c 8" 'imalison:term)
|
||||||
|
(bind-key "C-c 7" 'imalison:force-new-term)
|
||||||
(bind-key "C-x 9" 'previous-buffer)
|
(bind-key "C-x 9" 'previous-buffer)
|
||||||
|
|
||||||
(fset 'global-set-key-to-use-package
|
(fset 'global-set-key-to-use-package
|
||||||
@ -2315,7 +2339,6 @@ window is active in the perspective."
|
|||||||
;; These can be overriden in custom-before.el
|
;; These can be overriden in custom-before.el
|
||||||
(defvar imalison:light-theme 'solarized-light)
|
(defvar imalison:light-theme 'solarized-light)
|
||||||
(defvar imalison:dark-theme 'material)
|
(defvar imalison:dark-theme 'material)
|
||||||
|
|
||||||
(use-package theme-changer
|
(use-package theme-changer
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
|
Loading…
Reference in New Issue
Block a user