Added screenshot filenamesEmacs:- Added yasnippet- Added company- Added flycheck- Added htmlize for reveal.js- Changed tabbing- Fixed org-insert-structure-template shortcut- display line numbers in c/cpp-mode

This commit is contained in:
TuDatTr
2020-12-14 04:57:42 +01:00
parent 293bf29e49
commit 78945a969d
15 changed files with 166 additions and 28 deletions

View File

@@ -141,9 +141,37 @@
=A template system for Emacs=
#+begin_src emacs-lisp
(use-package yasnippet)
(use-package yasnippet
:config
(setq yas-snippet-dirs '("~/.emacs.d/snippets/"))
(yas-global-mode 1))
#+end_src
*** [[https://github.com/company-mode/company-mode][company-mode]]
=Modular in-buffer completion framework for Emacs=
#+begin_src emacs-lisp
(use-package company
:config
(global-company-mode))
#+end_src
*** [[https://github.com/flycheck/flycheck][flycheck]]
=On the fly syntax checking for GNU Emacs=
#+begin_src emacs-lisp
(use-package flycheck
:config
(global-flycheck-mode))
#+end_src
*** [[https://github.com/hniksic/emacs-htmlize][htmlize.el]]
=Convert buffer text and decorations to HTML.=
#+begin_src emacs-lisp
(use-package htmlize)
#+end_src
* Appearance
This section is for appearance customization. Either via packages or manually.
@@ -183,15 +211,27 @@
(setq vc-follow-symlinks t)
#+end_src
** Tab Behavior (spaces > tabs)
#+BEGIN_SRC emacs-lisp
(setq-default indent-tabs-mode nil)
#+END_SRC
* Mode Configuration
** Org-Mode
Enable org-bullets and hide leading stars.
#+begin_src emacs-lisp
(add-hook 'org-mode-hook
(lambda ()
(org-bullets-mode 1)))
(lambda ()
(org-bullets-mode 1)
(setq org-pretty-entities t)
(setq org-src-fontify-natively t)))
#+end_src
*** Keybindings
#+begin_src emacs-lisp
(define-key org-mode-map (kbd "C-c ,") 'org-insert-structure-template)
#+end_src
Enables specific languages for org-babel, so those languages can be used and compiled in code blocks and disable the compilation concirmation. The code afterwords enables proper indentation inside those source blocks.
#+begin_src emacs-lisp
@@ -207,3 +247,16 @@
(setq org-confirm-babel-evaluate nil)
(setq org-src-tab-acts-natively t)
#+end_src
** C-Mode
#+begin_src emacs-lisp
(add-hook 'c-mode-hook
(lambda ()
(display-line-numbers-mode 1)))
#+end_src
** C++-Mode
#+begin_src emacs-lisp
(add-hook 'c++-mode-hook
(lambda ()
(display-line-numbers-mode 1)))
#+end_src

View File

@@ -1,2 +1,15 @@
(org-babel-load-file "~/.emacs.d/config.org")
(put 'upcase-region 'disabled nil)
(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
'(go-mode yasnippet use-package theme-magic rainbow-mode rainbow-delimiters ox-twbs ox-reveal ox-hugo org-bullets no-littering moe-theme magit ivy-prescient god-mode evil-collection diminish counsel auctex)))
(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.
)

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: template
# key: template
# --
#include <stdio>
int main(int argc, char *argv[]){
$0
}

View File

@@ -1,6 +1,6 @@
# -*- mode: snippet -*-
# name: template
# key: templat
# key: template
# --
#include <stdio.h>

View File

@@ -1,16 +0,0 @@
# -*- mode: snippet -*-
# name: template
# key: template
# --
CC = gcc
CFLAGS =
RM = rm
TARGET = $0
all: ${TARGET}
${TARGET}: ${TARGET}.c
${CC} ${CFLAGS} -o ${TARGET} ${TARGET}.c
clean:
${RM} ${TARGET}

View File

@@ -0,0 +1,19 @@
# -*- mode: snippet -*-
# name: templatec
# key: templatec
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))
# --
CC = gcc
SRC = \$(wildcard *.c)
OBJ = \$(SRC:.c=.o)
CFLAGS =
RM = rm
TARGET = $1
all: \$(TARGET)
\$(TARGET): \$(OBJ)
\$(CC) \$(CFLAGS) -o \$@ \$^
clean:
\$(RM) \$(TARGET) \$(OBJ)

View File

@@ -0,0 +1,19 @@
# -*- mode: snippet -*-
# name: templatecxx
# key: templatecxx
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))
# --
CXX = g++
SRC = \$(wildcard *.cpp)
OBJ = \$(SRC:.cpp=.o)
CFLAGS =
RM = rm
TARGET = $1
all: \$(TARGET)
\$(TARGET): \$(OBJ)
\$(CXX) \$(CFLAGS) -o \$@ \$^
clean:
\$(RM) \$(TARGET) \$(OBJ)

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: leftarrow
# key: <-
# --
\leftarrow{}$0

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: rightarrow
# key: ->
# --
\rightarrow{}$0

View File

@@ -3,4 +3,4 @@
# key: template
# --
#+TITLE: $0
#+SETUPFILE: $HOME/Templates/Org-Mode/setupfile.org
#+SETUPFILE: ~/Templates/Org-Mode/setupfile.org

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: template
# key: template
# --
if __name__ == '__main__':
$0