;;; ravi-init-insertion.el --- inserting text ;; Copyright (C) 2013 ;; Author: ;; Keywords: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; Automatic text insertion ;;; Code: (require 'autoinsert) (auto-insert-mode) (use-package yasnippet :init (progn (setq yas-snippet-dirs `(,(ravi/emacs-file "snippets") yas-installed-snippets-dir) ) (yas-global-mode 1) ) :config (progn ;; No dropdowns (setq yas/prompt-functions '(yas/ido-prompt yas/completing-prompt)) ;; Wrap around region (setq yas/wrap-around-region t) ;; Automatically create throw-away snippets (use-package auto-yasnippet :bind (("C-" . aya-create) ("" . aya-expand)) :ensure t) ) :ensure t :diminish yas-minor-mode ) ;; Default completion (some day via "M-/") (require 'hippie-exp) (setq hippie-expand-try-functions-list '(yas/hippie-try-expand try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs ) ) (use-package company :init (progn (add-hook 'after-init-hook 'global-company-mode)) :config (progn (setq company-tooltip-flip-when-above t company-idle-delay 0.1 company-show-numbers t company-tooltip-align-annotations t company-require-match nil company-minimum-prefix-length 2 company-occurrence-weight-function 'company-occurrence-prefer-any-closest company-dabbrev-downcase nil) (defun ravi/complete-or-indent () (interactive) (if (company-manual-begin) (company-complete-common) (indent-according-to-mode))) (bind-key "\t" 'ravi/complete-or-indent)) :ensure t) (provide 'ravi-init-insertion) ;;; ravi-init-insertion.el ends here