Merge branch 'master' of github.com:y0rune/myhome into master
This commit is contained in:
commit
49f17be877
@ -9,7 +9,7 @@
|
||||
'(livedown-port 1337)
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(org-jira use-package switch-window ox-reveal ox-jira markdown-mode magit htmlize dracula-theme dired-sidebar confluence))))
|
||||
(auto-complete use-package switch-window ox-reveal ox-jira org-jira markdown-mode magit htmlize dracula-theme dired-sidebar confluence))))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
|
@ -47,7 +47,6 @@
|
||||
(setq browse-url-browser-function 'browse-url-generic
|
||||
browse-url-generic-program "browser-x")
|
||||
|
||||
|
||||
;; Switch-window
|
||||
(use-package switch-window
|
||||
:ensure t
|
||||
@ -83,6 +82,13 @@
|
||||
; )
|
||||
;(setq jiralib-url "https://localhost/")
|
||||
|
||||
;; AutoComlete
|
||||
(use-package auto-complete
|
||||
:ensure t
|
||||
)
|
||||
(ac-config-default)
|
||||
(global-auto-complete-mode t)
|
||||
|
||||
;; Theme
|
||||
(use-package dracula-theme
|
||||
:ensure t
|
||||
|
261
.emacs.d/plugins/org-ac.el
Normal file
261
.emacs.d/plugins/org-ac.el
Normal file
@ -0,0 +1,261 @@
|
||||
;;; org-ac.el --- Some auto-complete sources for org-mode
|
||||
|
||||
;; Copyright (C) 2014 Hiroaki Otsu
|
||||
|
||||
;; Author: Hiroaki Otsu <ootsuhiroaki@gmail.com>
|
||||
;; Keywords: org, completion
|
||||
;; URL: https://github.com/aki2o/org-ac
|
||||
;; Version: 0.0.2
|
||||
;; Package-Requires: ((auto-complete-pcmp "0.0.1") (log4e "0.2.0") (yaxception "0.1"))
|
||||
|
||||
;; 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 file 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:
|
||||
;;
|
||||
;; This extension provides auto-complete sources for org-mode.
|
||||
|
||||
;;; Dependency:
|
||||
;;
|
||||
;; - auto-complete-pcmp.el ( see <https://github.com/aki2o/auto-complete-pcmp> )
|
||||
;; - yaxception.el ( see <https://github.com/aki2o/yaxception> )
|
||||
;; - log4e.el ( see <https://github.com/aki2o/log4e> )
|
||||
|
||||
;;; Installation:
|
||||
;;
|
||||
;; Put this to your load-path.
|
||||
;; And put the following lines in your .emacs or site-start.el file.
|
||||
;;
|
||||
;; (require 'org-ac)
|
||||
|
||||
;;; Configuration:
|
||||
;;
|
||||
;; ;; Make config suit for you. About the config item, see Customization or eval the following sexp.
|
||||
;; ;; (customize-group "org-ac")
|
||||
;;
|
||||
;; (org-ac/config-default)
|
||||
|
||||
;;; Customization:
|
||||
;;
|
||||
;; [EVAL] (autodoc-document-lisp-buffer :type 'user-variable :prefix "org-ac/" :docstring t)
|
||||
;; `org-ac/ac-trigger-command-keys'
|
||||
;; Keystrokes for doing `ac-start' with self insert.
|
||||
;;
|
||||
;; *** END auto-documentation
|
||||
|
||||
;;; API:
|
||||
;;
|
||||
;; [EVAL] (autodoc-document-lisp-buffer :type 'command :prefix "org-ac/" :docstring t)
|
||||
;; `org-ac/setup-current-buffer'
|
||||
;; Do setup for using org-ac in current buffer.
|
||||
;;
|
||||
;; *** END auto-documentation
|
||||
;; [Note] Functions and variables other than listed above, Those specifications may be changed without notice.
|
||||
|
||||
;;; Tested On:
|
||||
;;
|
||||
;; - Emacs ... GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2) of 2013-08-22 on chindi02, modified by Debian
|
||||
;; - auto-complete-pcmp.el ... Version 0.0.1
|
||||
;; - yaxception.el ... Version 0.1
|
||||
;; - log4e.el ... Version 0.2.0
|
||||
|
||||
|
||||
;; Enjoy!!!
|
||||
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(require 'org)
|
||||
(require 'auto-complete-pcmp)
|
||||
(require 'rx)
|
||||
(require 'log4e)
|
||||
(require 'yaxception)
|
||||
|
||||
(defgroup org-ac nil
|
||||
"Auto completion for org-mode."
|
||||
:group 'org
|
||||
:prefix "org-ac/")
|
||||
|
||||
(defcustom org-ac/ac-trigger-command-keys '("\\" "*" "SPC" ":" "[" "+")
|
||||
"Keystrokes for doing `ac-start' with self insert."
|
||||
:type '(repeat string)
|
||||
:group 'org-ac)
|
||||
|
||||
|
||||
(log4e:deflogger "org-ac" "%t [%l] %m" "%H:%M:%S" '((fatal . "fatal")
|
||||
(error . "error")
|
||||
(warn . "warn")
|
||||
(info . "info")
|
||||
(debug . "debug")
|
||||
(trace . "trace")))
|
||||
(org-ac--log-set-level 'trace)
|
||||
|
||||
|
||||
(defun* org-ac--show-message (msg &rest args)
|
||||
(apply 'message (concat "[ORG-AC] " msg) args)
|
||||
nil)
|
||||
|
||||
(defun org-ac--complete-close-option-at-current-point ()
|
||||
(let ((pt (point)))
|
||||
(yaxception:$
|
||||
(yaxception:try
|
||||
(org-ac--trace "start complete close option at current point")
|
||||
(when (save-excursion
|
||||
(re-search-backward "#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9]+\\) *\\=" nil t))
|
||||
(let* ((opennm (match-string-no-properties 1))
|
||||
(typenm (match-string-no-properties 2))
|
||||
(closenm (cond ((string= opennm "begin") "end")
|
||||
((string= opennm "BEGIN") "END")))
|
||||
(case-fold-search t))
|
||||
(if (or (not (re-search-forward "^[ \t]*#\\+" nil t))
|
||||
(not (re-search-forward (concat "\\=" closenm "_") nil t)))
|
||||
(progn (goto-char pt)
|
||||
(insert "\n#+" closenm "_" typenm)
|
||||
(org-cycle))
|
||||
(let ((currtypenm (if (re-search-forward "\\=\\([a-zA-Z0-9]+\\)" nil t)
|
||||
(match-string-no-properties 1)
|
||||
"")))
|
||||
(backward-delete-char (+ (length closenm)
|
||||
1
|
||||
(length currtypenm)))
|
||||
(insert closenm "_" typenm)))
|
||||
(goto-char pt))))
|
||||
(yaxception:catch 'error e
|
||||
(org-ac--show-message "Failed complete close option : %s" (yaxception:get-text e))
|
||||
(org-ac--error "failed complete close option at current point : %s\n%s"
|
||||
(yaxception:get-text e)
|
||||
(yaxception:get-stack-trace-string e))
|
||||
(goto-char pt)))))
|
||||
|
||||
(defun org-ac--get-link-head-candidates ()
|
||||
(append (ac-pcmp/get-ac-candidates)
|
||||
(mapcar (lambda (x) (concat x ":")) org-link-types)))
|
||||
|
||||
(defvar ac-source-org-ac-tex
|
||||
'((candidates . ac-pcmp/get-ac-candidates)
|
||||
(prefix . "\\\\\\([a-zA-Z0-9_-]*\\)")
|
||||
(symbol . "t")
|
||||
(requires . 0)
|
||||
(cache)
|
||||
(action . ac-pcmp/do-ac-action)))
|
||||
|
||||
(defvar ac-source-org-ac-head
|
||||
'((candidates . ac-pcmp/get-ac-candidates)
|
||||
(prefix . "[^\r\n*]\\*\\([^\t\r\n]*\\)")
|
||||
(symbol . "h")
|
||||
(requires . 0)
|
||||
(cache)
|
||||
(action . ac-pcmp/do-ac-action)))
|
||||
|
||||
(defvar ac-source-org-ac-todo
|
||||
'((candidates . ac-pcmp/get-ac-candidates)
|
||||
(prefix . "^\\*+ \\([a-zA-Z0-9_-]*\\)")
|
||||
(symbol . "d")
|
||||
(requires . 0)
|
||||
(cache)
|
||||
(action . ac-pcmp/do-ac-action)))
|
||||
|
||||
(defvar ac-source-org-ac-tag
|
||||
'((candidates . ac-pcmp/get-ac-candidates)
|
||||
(prefix . "[ \t]:\\([a-zA-Z0-9_-]*\\)")
|
||||
(symbol . "t")
|
||||
(requires . 0)
|
||||
(cache)
|
||||
(action . ac-pcmp/do-ac-action)))
|
||||
|
||||
(defvar org-ac--regexp-link-head (rx-to-string `(and "["
|
||||
(* (any " \t"))
|
||||
"["
|
||||
(group (* (not (any ":*]")))))))
|
||||
(defvar ac-source-org-ac-link-head
|
||||
`((candidates . org-ac--get-link-head-candidates)
|
||||
(prefix . ,org-ac--regexp-link-head)
|
||||
(symbol . "l")
|
||||
(requires . 0)
|
||||
(cache)
|
||||
(action . (lambda ()
|
||||
(ac-pcmp/do-ac-action)
|
||||
(ac-start)))))
|
||||
|
||||
(defvar ac-source-org-ac-option
|
||||
'((candidates . ac-pcmp/get-ac-candidates)
|
||||
(prefix . "^[ \t]*#\\+\\([a-zA-Z0-9_:=-]*\\)")
|
||||
(symbol . "o")
|
||||
(requires . 0)
|
||||
(cache)
|
||||
(action . (lambda ()
|
||||
(ac-pcmp/do-ac-action)
|
||||
(org-ac--complete-close-option-at-current-point)
|
||||
(auto-complete '(ac-source-org-ac-option-key))))))
|
||||
|
||||
(defvar ac-source-org-ac-option-key
|
||||
'((candidates . ac-pcmp/get-ac-candidates)
|
||||
(prefix . "^[ \t]*#\\+[a-zA-Z0-9_:=-]+ +\\([a-zA-Z0-9_-]*\\)")
|
||||
(symbol . "k")
|
||||
(requires . 0)
|
||||
(cache)
|
||||
(action . ac-pcmp/do-ac-action)))
|
||||
|
||||
(defvar ac-source-org-ac-option-options
|
||||
'((candidates . ac-pcmp/get-ac-candidates)
|
||||
(prefix . "^[ \t]*#\\+\\(?:options\\|OPTIONS\\):.* +\\([a-zA-Z0-9_-]*\\)")
|
||||
(symbol . "x")
|
||||
(requires . 0)
|
||||
(cache)
|
||||
(action . ac-pcmp/do-ac-action)))
|
||||
|
||||
(defvar ac-source-org-ac-file
|
||||
'((init . (setq ac-filename-cache nil))
|
||||
(candidates . org-ac/file-candidate)
|
||||
(prefix . "\\[file:\\(.*\\)")
|
||||
(symbol . "f")
|
||||
(requires . 0)
|
||||
(action . ac-start)
|
||||
(limit . nil)))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun org-ac/setup-current-buffer ()
|
||||
"Do setup for using org-ac in current buffer."
|
||||
(interactive)
|
||||
(when (eq major-mode 'org-mode)
|
||||
(loop for stroke in org-ac/ac-trigger-command-keys
|
||||
do (local-set-key (read-kbd-macro stroke) 'ac-pcmp/self-insert-command-with-ac-start))
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-tex)
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-head)
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-todo)
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-tag)
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-link-head)
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-option)
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-option-key)
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-option-options)
|
||||
(add-to-list 'ac-sources 'ac-source-org-ac-file)
|
||||
(auto-complete-mode t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-ac/config-default ()
|
||||
"Do setting recommemded configuration."
|
||||
(add-to-list 'ac-modes 'org-mode)
|
||||
(add-hook 'org-mode-hook 'org-ac/setup-current-buffer t))
|
||||
|
||||
|
||||
(defun org-ac/file-candidate ()
|
||||
"Adds [file: to the normal file completition, plus allows relative paths"
|
||||
(if (string-match "^[~./]+" ac-prefix)
|
||||
(ac-filename-candidate)
|
||||
(let ((ac-prefix (concat "./" ac-prefix)))
|
||||
(mapcar (lambda (path) (substring path 2))
|
||||
(ac-filename-candidate)))))
|
||||
|
||||
|
||||
(provide 'org-ac)
|
||||
;;; org-ac.el ends here
|
29
.vimrc
29
.vimrc
@ -14,7 +14,6 @@ au BufWritePre * let &bex = '@' . strftime("%F.%H:%M")
|
||||
" plugins
|
||||
call plug#begin('~/.vim/plugged')
|
||||
Plug 'preservim/nerdtree'
|
||||
Plug 'y0rune/vimwiki'
|
||||
Plug 'nmante/vim-latex-live-preview'
|
||||
Plug 'lervag/vimtex'
|
||||
Plug 'junegunn/goyo.vim'
|
||||
@ -22,23 +21,15 @@ Plug 'jceb/vim-orgmode'
|
||||
Plug 'tpope/vim-speeddating'
|
||||
Plug 'prettier/vim-prettier', { 'do': 'npm install --force' }
|
||||
Plug 'iamcco/markdown-preview.nvim', { 'do': 'npm install --force' }
|
||||
Plug 'ycm-core/YouCompleteMe', { 'do': 'python3 install.py --clangd-completer --java-completer'}
|
||||
Plug 'hashivim/vim-terraform'
|
||||
Plug 'vim-syntastic/syntastic'
|
||||
Plug 'juliosueiras/vim-terraform-completion'
|
||||
" Problem with vim-prettier
|
||||
"
|
||||
" git checkout -b test origin/feature/issue-232-add-support-for-prettier-2.x;
|
||||
" npm install --force
|
||||
call plug#end()
|
||||
|
||||
" Vim wiki
|
||||
let wiki = {}
|
||||
let wiki.path = '~/git/notes/'
|
||||
let wiki.path_html = '~/git/notes/www/'
|
||||
let wiki.syntax = 'default'
|
||||
let wiki.ext = '.wiki'
|
||||
let text_ignore_newline = 0
|
||||
let g:vimwiki_list = [wiki]
|
||||
let g:vimwiki_list_ignore_newline = 1
|
||||
let g:vimwiki_table_mappings = 0
|
||||
|
||||
" Status-line
|
||||
set statusline=
|
||||
set statusline+=%#IncSearch#
|
||||
@ -64,6 +55,10 @@ set encoding=utf-8
|
||||
" livepreviewer
|
||||
let g:livepreview_previewer = 'mupdf'
|
||||
|
||||
" markdown preview
|
||||
let g:mkdp_browser = '/home/yorune/.local/bin/browser-x'
|
||||
let g:mkdp_echo_preview_url = 1
|
||||
|
||||
" line numbers
|
||||
set number
|
||||
set ruler
|
||||
@ -132,10 +127,4 @@ autocmd BufWritePre * %s/\s\+$//e
|
||||
autocmd BufWritepre * %s/\n\+\%$//e
|
||||
|
||||
" Autoformating markdown
|
||||
autocmd BufWritePost *.md :Prettier
|
||||
|
||||
" Livedown
|
||||
let g:livedown_browser = "browser-x"
|
||||
let g:livedown_autorun = 0
|
||||
let g:livedown_open = 1
|
||||
let g:livedown_port = 4242
|
||||
"autocmd BufWritePost *.md :Prettier
|
||||
|
Loading…
Reference in New Issue
Block a user