Add zig mode and snippets for C#

This commit is contained in:
Taryel Hlontsi 2024-01-20 10:04:12 +01:00
parent fc23dc235b
commit d6def578dd
15 changed files with 94 additions and 6 deletions

19
init.el
View File

@ -5,7 +5,7 @@
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(initial-frame-alist '((fullscreen . maximized))) '(initial-frame-alist '((fullscreen . maximized)))
'(package-selected-packages '(package-selected-packages
'(ef-themes dockerfile-mode dap-mode julia-ts-mode lsp-julia julia-mode marginalia vertico tide which-key use-package pyenv-mode flycheck exec-path-from-shell elpy doom-themes doom-modeline all-the-icons))) '(zig-mode treesit ef-themes dockerfile-mode dap-mode julia-ts-mode lsp-julia julia-mode marginalia vertico tide which-key use-package pyenv-mode flycheck exec-path-from-shell elpy doom-themes doom-modeline all-the-icons)))
(require 'package) (require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
@ -27,6 +27,11 @@
(use-package marginalia (use-package marginalia
:ensure t) :ensure t)
(require 'treesit)
(use-package zig-mode
:ensure t)
(use-package dired (use-package dired
:config :config
(put 'dired-find-alternate-file 'disabled nil) (put 'dired-find-alternate-file 'disabled nil)
@ -45,8 +50,8 @@
(scroll-bar-mode -1) (scroll-bar-mode -1)
;;(set-face-attribute 'default nil :font "Luculent" :height 110) (set-face-attribute 'default nil :font "Hack Nerd Font Mono" :height 110)
(set-face-attribute 'default nil :font "VictorMono Nerd Font Mono" :height 110) ;;(set-face-attribute 'default nil :font "VictorMono Nerd Font Mono" :height 110)
(set-default-coding-systems 'utf-8) (set-default-coding-systems 'utf-8)
@ -62,6 +67,8 @@
(setq show-paren-delay 0) (setq show-paren-delay 0)
(setq native-comp-async-report-warnings-errors 'silent)
(delete-selection-mode 1) (delete-selection-mode 1)
(show-paren-mode 1) (show-paren-mode 1)
@ -223,8 +230,8 @@ Exempt major modes are defined in `display-line-numbers-exempt-modes'."
(use-package modus-themes (use-package modus-themes
:ensure t) :ensure t)
(load-theme 'modus-operandi-tinted t) (modus-themes-select 'modus-vivendi-tinted)
;; (load-theme 'modus-vivendi t) (setq modus-themes-to-toggle '(modus-operandi-tinted modus-vivendi-tinted))
(use-package ef-themes (use-package ef-themes
:ensure t) :ensure t)
@ -247,7 +254,7 @@ ef-themes-variable-pitch-ui t)
;; (mapc #'disable-theme custom-enabled-themes) ;; (mapc #'disable-theme custom-enabled-themes)
;; (ef-themes-select 'ef-autumn) ;; (ef-themes-select 'ef-maris-light)
;; theming stops here ;; theming stops here

View File

@ -0,0 +1,12 @@
# -*- mode: csharp -*-
# name: class
# key: cl
# --
namespace $0`(directory-file-name default-directory)`;
public sealed class `(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`
{
public `(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`()
{
}
}

View File

@ -0,0 +1,8 @@
# -*- mode: csharp -*-
# name: ctor
# key: ctor
# --
public `(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`()
{
$0
}

View File

@ -0,0 +1,8 @@
# -*- mode: csharp -*-
# name: foreach
# key: f
# --
foreach (var ${1:Name} in ${2:Collection})
{
$0
}

View File

@ -0,0 +1,8 @@
# -*- mode: csharp -*-
# name: mpriv
# key: mr
# --
private ${1:void} ${2:Method}($3)
{
$0
}

View File

@ -0,0 +1,8 @@
# -*- mode: csharp -*-
# name: mpub
# key: mp
# --
public ${1:void} ${2:Method}($3)
{
$0
}

View File

@ -0,0 +1,8 @@
# -*- mode: csharp -*-
# name: mpubstatv
# key: mpsv
# --
public static void ${1:Method}($2)
{
$0
}

View File

@ -0,0 +1,5 @@
# -*- mode: csharp -*-
# name: print
# key: p
# --
System.Console.WriteLine($"{$0}");

View File

@ -0,0 +1,5 @@
# -*- mode: csharp -*-
# name: prop
# key: prop
# --
public ${1:string} ${2:PropertyName} { get; set; }

View File

@ -0,0 +1,7 @@
# -*- mode: csharp -*-
# name: summary
# key: ///
# --
/// <summary>
/// $0
/// </summary>

12
snippets/csharp-mode/try Normal file
View File

@ -0,0 +1,12 @@
# -*- mode: csharp -*-
# name: try
# key: t
# --
try
{
$0
}
catch (${1:Exception} ${2:ex})
{
${3:System.Console.WriteLine(ex.Message);}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
tree-sitter/libtree-sitter-zig.so Executable file

Binary file not shown.