Skip to content

Instantly share code, notes, and snippets.

@evgeniysharapov
Created August 11, 2017 16:36
Show Gist options
  • Select an option

  • Save evgeniysharapov/e0446081501108d4e5fb384042d979c1 to your computer and use it in GitHub Desktop.

Select an option

Save evgeniysharapov/e0446081501108d4e5fb384042d979c1 to your computer and use it in GitHub Desktop.
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(url (concat (if no-ssl "http" "https") "://melpa.org/packages/")))
(add-to-list 'package-archives (cons "melpa" url) t))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(use-package company
:ensure t
:init
(setq company-idle-delay 0.1
company-tooltip-limit 20
company-show-numbers t
company-selection-wrap-around t
company-minimum-prefix-length 2
company-tooltip-align-annotations t
company-echo-delay 0)
:config
;; default `company-backends'
(setq company-backends '(company-capf
(company-dabbrev-code
company-gtags
company-etags
company-keywords)
company-files
company-dabbrev))
(defun ffe-add-company-backends (&rest backends)
"Adds BACKENDS to the beginning of the buffer-local version of `company-backends' list"
(set (make-local-variable 'company-backends)
(append backends company-backends)))
(global-company-mode 1))
(use-package python
:defer t
:commands python-mode
:config
(add-hook 'python-mode-hook #'eldoc-mode))
(use-package anaconda-mode
:ensure t
:init (progn
(add-hook 'python-mode-hook #'anaconda-mode)
(add-hook 'python-mode-hook #'anaconda-eldoc-mode)))
(use-package company-anaconda
:defer t
:ensure t
:init (with-eval-after-load 'company
(add-hook 'python-mode-hook (lambda () (ffe-add-company-backends 'company-anaconda)))))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
(company-anaconda anaconda-mode company use-package))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment