replace my-indent-or-complete with company-indent-or-complete-common
This commit is contained in:
parent
baadc10f12
commit
1b60a544b4
46
init.el
46
init.el
@ -389,16 +389,13 @@ Argument FRAMES has the same meaning as for `set-frame-font'"
|
|||||||
(company-mode)
|
(company-mode)
|
||||||
(local-set-key (kbd "M-.") #'rtags-find-symbol-at-point)
|
(local-set-key (kbd "M-.") #'rtags-find-symbol-at-point)
|
||||||
(local-set-key (kbd "M-,") #'rtags-location-stack-back)
|
(local-set-key (kbd "M-,") #'rtags-location-stack-back)
|
||||||
(local-set-key "\C-i" #'my-indent-or-complete)
|
(local-set-key "\C-i" #'company-indent-or-complete-common)
|
||||||
(local-set-key (kbd "<tab>") #'my-indent-or-complete)
|
(local-set-key (kbd "<tab>") #'company-indent-or-complete-common)
|
||||||
(local-set-key "\C-\M-i" #'my-indent-or-complete))
|
(local-set-key "\C-\M-i" #'company-indent-or-complete-common))
|
||||||
|
|
||||||
(add-hook 'c-mode-hook #'my-c-c++-mode-hook-fn)
|
(add-hook 'c-mode-hook #'my-c-c++-mode-hook-fn)
|
||||||
(add-hook 'c++-mode-hook #'my-c-c++-mode-hook-fn)
|
(add-hook 'c++-mode-hook #'my-c-c++-mode-hook-fn)
|
||||||
|
|
||||||
;;; Function `my-indent-or-complete` is defined above in section
|
|
||||||
;;; [Using Go under Emacs](#using-go-under-emacs).
|
|
||||||
|
|
||||||
;;; Now:
|
;;; Now:
|
||||||
|
|
||||||
;;; 1. Install [clang](http://clang.llvm.org/) compiler or more accurately
|
;;; 1. Install [clang](http://clang.llvm.org/) compiler or more accurately
|
||||||
@ -512,17 +509,13 @@ Argument FRAMES has the same meaning as for `set-frame-font'"
|
|||||||
;;; functions, autocompletion and [eldoc] support, auto formatting of the
|
;;; functions, autocompletion and [eldoc] support, auto formatting of the
|
||||||
;;; code on save with adding of missing imports ([goimports]).
|
;;; code on save with adding of missing imports ([goimports]).
|
||||||
|
|
||||||
;;; It is quite long as I define three interactive functions:
|
;;; It is quite long as I define two interactive functions:
|
||||||
|
|
||||||
;;; 1. `my-indent-or-complete` which is bind to `TAB` key and
|
;;; 1. `my-go-electric-brace` which is bind to `{` key and inserts an
|
||||||
;;; (contextually) either completes the symbol at point or indents the
|
|
||||||
;;; line,
|
|
||||||
|
|
||||||
;;; 2. `my-go-electric-brace` which is bind to `{` key and inserts an
|
|
||||||
;;; indented pair of braces (if previous character is a space,
|
;;; indented pair of braces (if previous character is a space,
|
||||||
;;; otherwise it inserts single opening brace),
|
;;; otherwise it inserts single opening brace),
|
||||||
|
|
||||||
;;; 3. `my-godoc-package` which is bind to `C-c P` key and display
|
;;; 2. `my-godoc-package` which is bind to `C-c P` key and display
|
||||||
;;; documentation for a package choosen from a list of installed
|
;;; documentation for a package choosen from a list of installed
|
||||||
;;; packages.
|
;;; packages.
|
||||||
|
|
||||||
@ -530,14 +523,6 @@ Argument FRAMES has the same meaning as for `set-frame-font'"
|
|||||||
;;; [eldoc]: http://emacswiki.org/emacs/ElDoc
|
;;; [eldoc]: http://emacswiki.org/emacs/ElDoc
|
||||||
;;; [goimports]: https://godoc.org/golang.org/x/tools/cmd/goimports
|
;;; [goimports]: https://godoc.org/golang.org/x/tools/cmd/goimports
|
||||||
|
|
||||||
(defun my-indent-or-complete ()
|
|
||||||
"Complete or indent if nothing to complete."
|
|
||||||
(interactive)
|
|
||||||
(if (or (looking-at "\\w")
|
|
||||||
(looking-back "^\\|\s"))
|
|
||||||
(indent-for-tab-command)
|
|
||||||
(company-complete)))
|
|
||||||
|
|
||||||
(defun my-go-electric-brace ()
|
(defun my-go-electric-brace ()
|
||||||
"Insert an opening brace may be with the closing one.
|
"Insert an opening brace may be with the closing one.
|
||||||
If there is a space before the brace also adds new line with
|
If there is a space before the brace also adds new line with
|
||||||
@ -599,8 +584,8 @@ inserted between the braces between the braces."
|
|||||||
("C-c h" . go-guru-hl-identifier)
|
("C-c h" . go-guru-hl-identifier)
|
||||||
("C-c P" . my-godoc-package)
|
("C-c P" . my-godoc-package)
|
||||||
("{" . my-go-electric-brace)
|
("{" . my-go-electric-brace)
|
||||||
("C-i" . my-indent-or-complete)
|
("C-i" . company-indent-or-complete-common)
|
||||||
("C-M-i" . my-indent-or-complete))
|
("C-M-i" . company-indent-or-complete-common))
|
||||||
:config
|
:config
|
||||||
;; run gofmt/goimports when saving the file
|
;; run gofmt/goimports when saving the file
|
||||||
(add-hook 'before-save-hook #'gofmt-before-save)
|
(add-hook 'before-save-hook #'gofmt-before-save)
|
||||||
@ -697,13 +682,10 @@ inserted between the braces between the braces."
|
|||||||
(smartparens-mode 1)
|
(smartparens-mode 1)
|
||||||
(local-set-key (kbd "M-.") #'jedi:goto-definition)
|
(local-set-key (kbd "M-.") #'jedi:goto-definition)
|
||||||
(local-set-key (kbd "M-,") #'jedi:goto-definition-pop-marker)
|
(local-set-key (kbd "M-,") #'jedi:goto-definition-pop-marker)
|
||||||
(local-set-key "\C-i" #'my-indent-or-complete))
|
(local-set-key "\C-i" #'company-indent-or-complete-common))
|
||||||
|
|
||||||
(add-hook 'python-mode-hook #'my-python-mode-hook-fn)
|
(add-hook 'python-mode-hook #'my-python-mode-hook-fn)
|
||||||
|
|
||||||
;;; Function `my-indent-or-complete` is defined above in section
|
|
||||||
;;; [Using Go under Emacs](#using-go-under-emacs).
|
|
||||||
|
|
||||||
|
|
||||||
;;; Yasnippet and abbrev mode
|
;;; Yasnippet and abbrev mode
|
||||||
;;; -------------------------
|
;;; -------------------------
|
||||||
@ -763,8 +745,8 @@ inserted between the braces between the braces."
|
|||||||
(:map dart-mode-map
|
(:map dart-mode-map
|
||||||
("M-." . my-dart-goto)
|
("M-." . my-dart-goto)
|
||||||
("M-/" . dabbrev-expand)
|
("M-/" . dabbrev-expand)
|
||||||
("C-i" . my-indent-or-complete)
|
("C-i" . company-indent-or-complete-common)
|
||||||
("C-M-i" . my-indent-or-complete))
|
("C-M-i" . company-indent-or-complete-common))
|
||||||
:config
|
:config
|
||||||
|
|
||||||
(defun my-dart-mode-hook-fn ()
|
(defun my-dart-mode-hook-fn ()
|
||||||
@ -812,8 +794,8 @@ inserted between the braces between the braces."
|
|||||||
(setq typescript-indent-level 2)
|
(setq typescript-indent-level 2)
|
||||||
:bind
|
:bind
|
||||||
(:map typescript-mode-map
|
(:map typescript-mode-map
|
||||||
("C-i" . my-indent-or-complete)
|
("C-i" . company-indent-or-complete-common)
|
||||||
("C-M-i" . my-indent-or-complete)))
|
("C-M-i" . company-indent-or-complete-common)))
|
||||||
|
|
||||||
(use-package tide
|
(use-package tide
|
||||||
:ensure nil
|
:ensure nil
|
||||||
@ -841,7 +823,7 @@ inserted between the braces between the braces."
|
|||||||
(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
|
(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
|
||||||
:bind
|
:bind
|
||||||
(:map web-mode-map
|
(:map web-mode-map
|
||||||
("C-i" . my-indent-or-complete)))
|
("C-i" . company-indent-or-complete-common)))
|
||||||
|
|
||||||
|
|
||||||
;;; css-mode
|
;;; css-mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user