summaryrefslogtreecommitdiffstats
path: root/ravi-init-insertion.el
blob: 876ea4a1eb7f1a7e5e823110e9f112e06ef29fa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
;;; ravi-init-insertion.el --- inserting text

;; Copyright (C) 2013  

;; Author:  <ravi@nero.lan>
;; 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 <http://www.gnu.org/licenses/>.

;;; Commentary:

;; Automatic text insertion

;;; Code:

(require 'autoinsert)
(auto-insert-mode)

(use-package yasnippet
  :init
  (progn
    (setq yas-snippet-dirs
	  `(,(ravi/emacs-file "snippets")
	     )
	  )
    (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)
    )
  :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 smart-tab for TAB-completion but this means that we do not use TAB with auto-complete for now.
(use-package smart-tab
  :init
  (setq smart-tab-using-hippie-expand t)
  :config
  (global-smart-tab-mode 1)
  :ensure t
  :diminish
  )

(use-package auto-complete
  :diminish auto-complete-mode
  :init
  (progn
    (use-package pos-tip :ensure t)
    (use-package auto-complete-config)
    (ac-config-default))

  :config
  (progn
    (ac-set-trigger-key "<M-f7>")
    (setq ac-use-menu-map t)

    ;(bind-key "A-M-?" 'ac-last-help)
    ;(unbind-key "C-s" ac-completing-map)
    )
  :ensure t
  )

(provide 'ravi-init-insertion)
;;; ravi-init-insertion.el ends here