Add your own custom snippets

This commit is contained in:
Maciej 2019-10-03 10:01:16 +03:00
parent bd480d3c12
commit 107a59f9b0
Signed by: maciej
GPG key ID: 41D62D42D3B0D765
14 changed files with 80 additions and 25 deletions

2
.gitignore vendored
View file

@ -11,3 +11,5 @@ tramp
url/*
transient/*
.lsp-session-*
eshell/*
.yas-compiled-snippets.el

View file

@ -3,7 +3,7 @@
:ensure t
:defer t
:bind ("<f5> c" . magit-checkout)
("<f5> b" . magit-blame)
("<f5> b" . magit-blame-addition)
("<f5> g" . magit-status)
(:map magit-blame-mode-map
("<f5> b" . 'magit-blame-quit)))

View file

@ -33,8 +33,9 @@
:defer t
:hook (((prog-mode text-mode) . rainbow-delimiters-mode))
:init
;;; Match parenthasis (left-right)
(electric-pair-mode t))
;;; Match parenthasis (left-right)
(electric-pair-mode t)
(show-paren-mode t))
;;; Show hex (#aaa) colors as colors
(use-package rainbow-mode
@ -69,3 +70,6 @@
:ensure t
:defer t
:config (global-column-enforce-mode t))
(provide '05prog-mode)
;;; 05prog-mode ends here

View file

@ -31,19 +31,21 @@
(yas-global-mode t)
(setq-default
company-minimum-prefix-length 2 ; minimum prefix character number for auto complete.
company-minimum-prefix-length 2 ;; minimum prefix character number for auto complete.
company-idle-delay 0.1
company-echo-delay 0 ;; company-show-numbers t
company-tooltip-align-annotations t ; align annotations to the right tooltip border.
company-echo-delay 0 ;;;; company-show-numbers t
company-tooltip-align-annotations t ;; align annotations to the right tooltip border.
company-tooltip-flip-when-above t
company-tooltip-limit 10 ; tooltip candidates max limit.
company-tooltip-minimum 2 ; minimum candidates limit.
company-tooltip-minimum-width 10 ; The minimum width of the tooltip's inner area.
; This doesn't include the margins and the scroll bar.
company-tooltip-margin 2 ; width of margin columns to show around the tooltip
company-tooltip-offset-display 'lines ; 'lines - how to show tooltip unshown candidates number.
company-show-numbers nil ; t: show quick-access numbers for the first ten candidates.
company-selection-wrap-around t ; loop over candidates
company-tooltip-limit 10 ;; tooltip candidates max limit.
company-tooltip-minimum 2 ;; minimum candidates limit.
company-tooltip-minimum-width 10 ;; The minimum width of the tooltip's inner area.
;; This doesn't include the margins and the scroll bar.
company-tooltip-margin 2 ;; width of margin columns to show around the tooltip
company-tooltip-offset-display 'lines ;; 'lines - how to show tooltip unshown candidates number.
company-show-numbers nil ;; t: show quick-access numbers for the first ten candidates.
company-selection-wrap-around t ;; loop over candidates
company-dabbrev-other-buffers t ;; Only offer dabbrev from the same major mode
company-dabbrev-downcase nil ;; Preserve case of candidates
;; company-async-wait 0.03
;; company-async-timeout 2
)

View file

@ -17,16 +17,17 @@
:defer t
:ensure t)
(setq-local indent-tabs-mode nil)
(defun activate-my-clojure-mode ()
"Goodies for clojure files."
(set-indent 2) ;; Default indentation of 2 characters
(column-enforce-n 80)
(clj-refactor-mode 1)
(cider-mode 1)
(clj-refactor-mode 1)
(cider-mode 1)
(paredit-mode 1)
;; Do not show separate error window when in REPL
(setq cider-show-error-buffer 'except-in-repl)
(paredit-mode 1))
(setq cider-show-error-buffer 'except-in-repl))
(add-hook 'clojure-mode-hook 'activate-my-clojure-mode)

View file

@ -2,12 +2,12 @@
"Goodies for editing emacs files."
(set-indent 2) ;; Default indentation of 2 characters
(column-enforce-n 80)
(setq-default indent-tabs-mode nil)
;; Company list override
(add-to-list (make-local-variable 'company-backends)
'(company-elisp company-yasnippet))
(paredit-mode 1)
)
(paredit-mode 1))
(add-hook 'emacs-lisp-mode-hook 'activate-emacs-lisp-mode)

View file

@ -66,14 +66,27 @@
(setq-local
ctags/refresh-command
(format
"ctags -e -R --languages=erlang -f %sTAGS %s. %slib/stdlib-* %slib/kernel-*"
"ctags -e -R --languages=erlang -f %sTAGS %ssrc %sdeps %sapps %s_build %slib/stdlib-* %slib/kernel-*"
(projectile-project-root) (projectile-project-root)
(projectile-project-root) (projectile-project-root)
(projectile-project-root)
(plist-get erlang/current-erlang :erlang-path)
(plist-get erlang/current-erlang :erlang-path)))
;; Add include path so that Erlang does not complain about
;; missing header files.
(setq-local flycheck-erlang-include-path
(list (format "%sdeps" (projectile-project-root))
(format "%sinclude" (projectile-project-root))
(format "%sapps" (projectile-project-root))))
;; (setq-local flycheck-erlang-library-path
;; (list (format "%sdeps" (projectile-project-root))
;; (format "%sapps" (projectile-project-root))))
;; Company list override
(add-to-list (make-local-variable 'company-backends)
'(company-etags company-yasnippet)))
'(company-yasnippet company-etags company-dabbrev)))
(add-hook 'erlang-mode-hook 'erlang/activate-erlang-mode)

View file

@ -25,7 +25,10 @@
(setq js2-mode-show-strict-warnings nil)
(tide-hl-identifier-mode +1)
(flycheck-add-next-checker 'javascript-standard 'javascript-tide 'append)
(if (string-match-p "rebelroam" (buffer-file-name))
(flycheck-add-next-checker 'javascript-standard 'javascript-tide 'append))
(setq-local flycheck-check-syntax-automatically '(save mode-enabled))
;; "Company list override."

View file

@ -0,0 +1,8 @@
;;;-------------------------------------------------------------------
;;; author: Maciej Szlosarczyk (${1: maciej@sosek.net})
;;; copyright (C) (${2:`(format-time-string "%Y")`}) Maciej Szlosarczyk
;;; @doc
;;;
;;; @end
;;; Created: ${3:`(format-time-string "%d %b %Y")`}
;;;-------------------------------------------------------------------

View file

@ -0,0 +1,12 @@
# -*- mode: snippet -*-
# name: preambule
# --
%%%-------------------------------------------------------------------
%%% @author Maciej Szlosarczyk (${1: maciej@sosek.net})
%%% @copyright (C) (${2:`(format-time-string "%Y")`}) Maciej Szlosarczyk
%%% @doc
%%%
%%% @end
%%% Created: ${3:`(format-time-string "%d %b %Y")`}
%%%-------------------------------------------------------------------
$0

3
snippets/js-mode/ar Normal file
View file

@ -0,0 +1,3 @@
(${1:a}) => {
$0
}

3
snippets/tide-mode/ar Normal file
View file

@ -0,0 +1,3 @@
(${1:a}) => {
$0
}

3
snippets/web-mode/ar Normal file
View file

@ -0,0 +1,3 @@
(${1:a}) => {
$0
}

View file

@ -11,6 +11,7 @@
(load "$HOME/.emacs.d/themes/themes-base16-not-harmonic.el" 'f 't)
(load-theme 'base16-mexico-light t t)
(load-theme 'base16-ia-dark t t)
(load-theme 'manoj-dark t t)
(load-theme 'base16-one-light t t)
(load-theme 'base16-zenburn t t)
@ -26,7 +27,7 @@
(if (display-graphic-p)
(progn
(sml/apply-theme 'respectful)
(enable-theme 'base16-mocha))
(enable-theme 'base16-not-harmonic))
(progn
(enable-theme 'base16-mexico-light)
(setq base16-theme-256-color-source "base16-shell")))