When I enter a new line and with the cursor auto indented due to electric-indent-mode, I see indent-cycles (x) in the modeline, so I hit TAB to cycle the indentation to where I want the cursor to be for my next code. However, the indentation isn't cycled instead completion list pops up instead.

And even with that when I RET, it just jumps onto a new empty line.

(use-package company
  :after lsp-mode
  (setq company-selection-wrap-around t
        company-minimum-prefix-length 1
        company-idle-delay 0.0)
  ;;:hook (after-init . global-company-mode)
  :hook ((prog-mode latex-mode ess-r-mode lsp-mode) . company-mode)
  :bind ((:map company-active-map
          ("<tab>" . company-indent-or-complete-common)
            ("C-n" . company-select-next-or-abort)
            ("C-p" . company-select-previous-or-abort))
         (:map lsp-mode-map
          ("<tab>" . company-indent-or-complete-common)))
  ;; Documentation popups
  (use-package company-quickhelp
    :hook (company-mode . company-quickhelp-mode))

  (use-package company-box
    :hook (company-mode . company-box-mode))

  ;; Suspend page-break-lines-mode while company menu is active
  ;; (see https://github.com/company-mode/company-mode/issues/416)
  (with-eval-after-load 'page-break-lines
    (defvar-local sanityinc/page-break-lines-on-p nil)

    (defun sanityinc/page-break-lines-disable (&rest ignore)
      (when (setq sanityinc/page-break-lines-on-p (bound-and-true-p page-break-lines-mode))
        (page-break-lines-mode -1)))

    (defun sanityinc/page-break-lines-maybe-reenable (&rest ignore)
      (when sanityinc/page-break-lines-on-p
        (page-break-lines-mode 1)))

    (add-hook 'company-completion-started-hook 'sanityinc/page-break-lines-disable)
    (add-hook 'company-after-completion-hook 'sanityinc/page-break-lines-maybe-reenable)))

The question is, how to get TAB to both cycle indentations (when available) and perform completion. I already have (setq tab-always-indent 'complete)

  • What's the question? You haven't posed a question; you've just describe behavior that you see. – Drew Dec 17 '20 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.