Browse Source

Add java and yasnippet cubes

modify-logo
Sameer Rahmani 1 year ago
parent
commit
b3d5cd422d
  1. 6
      config/fg42.user.v3.el
  2. 67
      core/cubes/java.el
  3. 49
      core/cubes/snippets.el
  4. 8
      core/cubes/snippets/org-mode/align
  5. 8
      core/cubes/snippets/org-mode/begin
  6. 8
      core/cubes/snippets/org-mode/block
  7. 8
      core/cubes/snippets/org-mode/equation
  8. 9
      core/cubes/snippets/org-mode/infobox
  9. 6
      core/cubes/snippets/org-mode/prod
  10. 6
      core/cubes/snippets/org-mode/sum

6
config/fg42.user.v3.el

@ -34,7 +34,8 @@ @@ -34,7 +34,8 @@
(require 'cubes/project)
(require 'cubes/irc)
(require 'cubes/terminal)
(require 'cubes/java)
(require 'cubes/snippets)
;; ============== MY STUFF ==============================
(custom-set-faces
@ -125,7 +126,8 @@ @@ -125,7 +126,8 @@
("irc.oftc.net" :channels ("#llvm") :nick "lxsameer")))
(fg42/vterm-cube)
(fg42/java-cube)
(fg42/yasnippet-cube)
;; Themes should be the last cube and anything that wants to manipulate a face
;; has to use either `fg42/before-initializing-theme-hook' or
;; `fg42/after-initializing-theme-hook' hooks.

67
core/cubes/java.el

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
;;; JavaCubes --- The Java cubes for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://gitlab.com/FG42/FG42
;; Version: 3.0.0
;;
;; 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:
;;; Code:
(require 'fpkg)
(require 'fg42/cube)
(defcube fg42/gradle-cube
(:docs "cubes/fg42/java-cube.org"
:flag gradle
:flag-default t)
(fpkg/use groovy-mode
:mode "\\.gradle\\'")
(fpkg/use gradle-mode
:hook (java-mode-hook . gradle-mode))
(when-flag flycheck
(fpkg/use flycheck-gradle)))
(defcube fg42/java-cube
(:docs "cubes/fg42/java-cube.org"
:flag java
:flag-default t)
(add-hook 'java-mode-hook
(lambda()
;; To fix the indentation of function arguments
(c-set-offset 'arglist-intro '+)
(setq java-basic-offset 2)
(setq c-basic-offset 2)
(when-flag lsp-java
(setq lsp-java-server-install-dir fg42-tmp)
(lsp))))
(when-flag gradle
(fg42/gradle-cube))
(when-flag lsp
(fpkg/use lsp-java)))
(provide 'cubes/java)
;;; java.el ends here

49
core/cubes/snippets.el

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
;;; JavaCubes --- The Java cubes for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://gitlab.com/FG42/FG42
;; Version: 3.0.0
;;
;; 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:
;;; Code:
(require 'fpkg)
(require 'fg42/cube)
(defcube fg42/yasnippet-cube
(:docs "cubes/fg42/yasnippet-cube.org"
:flag yasnippet
:flag-default t)
(fpkg/use yasnippet-snippets)
(fpkg/use yasnippet
:init
(let* ((snippet-home (expand-file-name "snippets"
(file-name-directory (locate-library "yasnippet-snippets"))))
(local-snippet (expand-file-name "core/cubes/snippets" fg42-home))
(user-snippets (or (plist-get fg42/yasnippet-cube-params :snippets-dir)
;; Just to make sure that we don't return nil. Since
;; yas-snippet-dirs shoud not contain nil value
local-snippet)))
(setq yas-snippet-dirs `(,user-snippets ,local-snippet ,snippet-home))
(yas-global-mode 1))))
(provide 'cubes/snippets)
;;; snippets.el ends here

8
core/cubes/snippets/org-mode/align

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# contributor: lxsameer <lxsameer@gnu.org>
# name: Latex begin block
# key: al*
# --
\begin{align*}
$0
\end{align*}

8
core/cubes/snippets/org-mode/begin

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# contributor: lxsameer <lxsameer@gnu.org>
# name: Latex begin block
# key: begin
# --
\begin{$1}
$0
\end{$1}

8
core/cubes/snippets/org-mode/block

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# contributor: lxsameer <lxsameer@gnu.org>
# name: Latex begin block
# key: block
# --
#+BEGIN_{$1}
$0
#+END_{$1}

8
core/cubes/snippets/org-mode/equation

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# contributor: lxsameer <lxsameer@gnu.org>
# name: Latex equation* block
# key: eq*
# --
\begin{equation*}
$0
\end{equation*}

9
core/cubes/snippets/org-mode/infobox

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# contributor: lxsameer <lxsameer@gnu.org>
# name: Latex Definition box
# key: def
# --
#+attr_latex: :options {Definition}
#+BEGIN_infobox
$0
#+END_infobox

6
core/cubes/snippets/org-mode/prod

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# contributor: lxsameer <lxsameer@gnu.org>
# name: Latex \prod
# key: prod
# --
\prod ^{$1} _{$2} $0

6
core/cubes/snippets/org-mode/sum

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# contributor: lxsameer <lxsameer@gnu.org>
# name: Latex \sum
# key: sum
# --
\sum ^{$1} _{$2} $0
Loading…
Cancel
Save