ultisnip scripts, autopairs and spellcheck

This commit is contained in:
hollorol 2024-07-30 22:59:49 +02:00
parent 2f5c1137ff
commit 1fa37d6e39
23 changed files with 355 additions and 1 deletions

5
UltiSnips/all.snippets Normal file
View File

@ -0,0 +1,5 @@
snippet env "create an environment"
\begin{$1}
$0
\end{$1}
endsnippet

76
UltiSnips/c.snippets Normal file
View File

@ -0,0 +1,76 @@
snippet template "Creates a template for a c file"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char** argv){
$1
return 0;
}
endsnippet
snippet pr "Printf template"
printf("$1\n");
endsnippet
snippet gtk "Main gtk template"
#include <stdio.h>
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
GtkBuilder *builder;
GtkWidget *window;
GtkCalendar *calendar;
gtk_init(&argc, &argv);
builder = gtk_builder_new();
gtk_builder_add_from_file (builder, "`ls *.glade`", NULL);
window = GTK_WIDGET(gtk_builder_get_object(builder, "calChoose"));
gtk_builder_connect_signals(builder, NULL);
g_object_unref(builder);
gtk_widget_show(window);
gtk_main();
return 0;
}
// called when window is closed
void on_main_window_destroy()
{
gtk_main_quit();
}
void on_calendar_selected(GtkButton* Button,GtkCalendar* calendar)
{
guint day;
guint month;
guint year;
gtk_calendar_get_date(GTK_CALENDAR(calendar), &year, &month, &day);
printf("%d-%d-%d\n", year, month, day);
gtk_main_quit();
}
endsnippet
snippet fgets "fgets function from stdio.h"
fgets(${1:char* s}, ${2:int size}, ${3:FILE* stream});
endsnippet
snippet sscanf "sscanf function stdio.h"
sscanf(${1:const char *str}, ${2:const char *format}, ${3:...});
endsnippet
snippet DML "define maxlinelength"
#define MAXLINELEN 30000
endsnippet
snippet ML "maxlinelength"
MAXLINELEN
endsnippet

21
UltiSnips/go.snippets Normal file
View File

@ -0,0 +1,21 @@
snippet pri "fmt.Println"
fmt.Printf("$0\n")
endsnippet
snippet err "Error handling"
if err := $1; err != nil {
$0
}
endsnippet
snippet main_ "main template"
package main
import(
"fmt"
)
func main(){
fmt.Printf("$0\n")
}
endsnippet

27
UltiSnips/html.snippets Normal file
View File

@ -0,0 +1,27 @@
snippet template "Basic html template"
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>$1</title>
<meta name="description" content="$2">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="css/styles.css?v=1.0">
</head>
<body>
<script src="js/scripts.js"></script>
</body>
</html>
endsnippet
snippet bc "background-color"
background-color: $0
endsnippet

31
UltiSnips/mail.snippets Normal file
View File

@ -0,0 +1,31 @@
snippet szi "Basic hungarian email template"
Szia!
$0
Üdv.:
Roli
endsnippet
snippet sztok "Basic hungarian email template for multiple recipients"
Sziasztok!
$0
Üdv.:
Roli
endsnippet
snippet én1 "Informal me"
Üdv.:
Roli
endsnippet
snippet üdvöz "Üdvözlet"
Kedves $1 $2!
$0
Üdvözlettel:
Hollós Roland
endsnippet

15
UltiSnips/pandoc.snippets Normal file
View File

@ -0,0 +1,15 @@
snippet sh "sh"
\`\`\`\{bash\}
$0
\`\`\`
endsnippet
snippet R "R"
\`\`\`\{r\}
$0
\`\`\`
endsnippet
snippet url "URL"
[${1:link text}](${2:url})$0
endsnippet

11
UltiSnips/python.snippets Normal file
View File

@ -0,0 +1,11 @@
snippet main "for python scripts"
#!`which python3`
if __name__ == "__main__":
$0
endsnippet
snippet #python "Set python interpreter"
#!`which python3`
$0
endsnippet

74
UltiSnips/r.snippets Normal file
View File

@ -0,0 +1,74 @@
global !p
def complete(t, opts):
if t:
opts = [m[len(t):] for m in opts if m.startswith(t)]
if len(opts) == 1:
return opts[0]
return "(" + '|'.join(opts) + ")"
endglobal
snippet template.shiny "This creates a basic shiny app"
$1 <- fluidPage(title="My quick app",
tags$h1($2)
)
$3 <- function (input,output,session) {
$4
}
shinyApp($1,$3)
endsnippet
snippet csv "read.csv"
read.csv($1, stringsAsFactors=FALSE)
endsnippet
snippet lsf "list.files"
list.files($1)
endsnippet
snippet head "head"
head($1)
$0
endsnippet
snippet hist "head"
head($1)
$0
endsnippet
snippet äđĐ "An intelligent Doxygen -- I'll improve it further" A
`!p
if snip.c == "":
curr_row = int(vim.eval('line(\'.\')'))
fun_name = vim.eval('getline({},{})'.format(curr_row+8, curr_row+8))[0]
result = fun_name.split('<-')[0]
snip.rv = f"\
#' {result}"
`
#'
#' ${1: Description}
#'
#' @param ${2: first parameter}
#' @usage ...
#' @export
$0
endsnippet
snippet "(#' @param.*)" "new param" r
`!p snip.rv = match.group(1) + '\n' + '#\' @param'` $0
endsnippet
snippet "(#' .*)\.\.\." "doxygen new line" r
`!p snip.rv = match.group(1) + '\n' + '#\''` $0
endsnippet
snippet today
`date +%Y-%m-%d` $0
endsnippet

View File

@ -0,0 +1,21 @@
snippet template "This creates a basic template for markdown files"
---
title: "$1"
author: "Hollós Roland"
output: "$3"
---
\`\`\`{r qplot, fig.width=4, message=FALSE}
library(ggplot2)
summary(cars)
qplot(speed, dist, data=cars) +
geom_smooth()
\`\`\`
endsnippet
snippet ,r "creates R codeblock"
\`\`\`{r}
$1
\`\`\`
endsnippet

View File

@ -0,0 +1,5 @@
snippet snip "Make snippets"
snippet ${1:Keys} "${2:Description}"
${0:content}
`echo endsnippet`
endsnippet

20
UltiSnips/tex.snippets Normal file
View File

@ -0,0 +1,20 @@
snippet frame "New Frame"
\begin{frame}{$1}
$0
\end{frame}
endsnippet
snippet description "description"
\begin{description}
\item [$1] $0
\end{description}
endsnippet
snippet labitem "labelled item"
\item [$1] $0
endsnippet
snippet it "item"
\item $0
endsnippet

18
UltiSnips/vim.snippets Normal file
View File

@ -0,0 +1,18 @@
snippet fun "Create a function"
function! ${1:FunctionName}(${2:Arguments})
${0:function body}
endfunction
endsnippet
snippet pyfun "Create a function"
function! ${1:FunctionName}(${2:Arguments})
python3 <<EOF
import vim
${0:function body}
EOF
endfunction
endsnippet

View File

@ -0,0 +1,19 @@
snippet '^h([0-9]{1})$' "header creation" r
`!p
snip.rv='='*int(match.group(1))`$1`!p
snip.rv='='*int(match.group(1))`
$0
endsnippet
snippet '_t([0-9]+)([w,d]{1})$' "header creation" r
`!p
import datetime
shift_amount=int(match.group(1))
shift_unit=match.group(2)
if shift_unit == "d":
ret = (datetime.date.today()+datetime.timedelta(days=shift_amount)).strftime("%Y-%m-%d")
else:
ret = (datetime.date.today()+datetime.timedelta(weeks=shift_amount)).strftime("%Y-%m-%d")
snip.rv = f"({ret})"
`$0
endsnippet

View File

@ -16,7 +16,7 @@ vim.keymap.set('n','<F4>',':set hlsearch!<CR>',{ noremap = true, silent = true }
vim.keymap.set('n','<F12>',':set number!<CR>',{ noremap = true, silent = true })
vim.keymap.set('n','<leader>ss', function() vim.cmd('LinesWithPreview') end,{ noremap = true, silent = true })
vim.keymap.set('n', 'á', '`', { noremap = true, silent = true })
vim.keymap.set('n', 'z7', 'z=', { noremap = true, silent = true })
vim.keymap.set('n', 'z7', '<cmd>Telescope spell_suggest', { noremap = true, silent = true })
vim.keymap.set('n', '<F5>', ':set ignorecase!<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<F6>',':set spell! spelllang=hu<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<F7>',':set spell! spelllang=en<CR>', { noremap = true, silent = true })

View File

@ -9,3 +9,5 @@ vim.opt.mouse="a"
vim.opt.clipboard="unnamedplus"
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.opt.spell = true
vim.opt.ignorecase = true

View File

@ -2,6 +2,7 @@ return {
{'tpope/vim-fugitive'},
{'gorkunov/smartpairs.vim'},
{'tpope/vim-surround'},
{'jiangmiao/auto-pairs'},
{'mattn/emmet-vim',
ft = { 'html', 'css', 'javascript', 'typescript', 'vue' },
}

BIN
spell/de.utf-8.spl Normal file

Binary file not shown.

BIN
spell/de.utf-8.sug Normal file

Binary file not shown.

1
spell/en.utf-8.add Normal file
View File

@ -0,0 +1 @@
inmemory

BIN
spell/en.utf-8.add.spl Normal file

Binary file not shown.

7
spell/hu.utf-8.add Normal file
View File

@ -0,0 +1,7 @@
agysérültek
koponyasérültek
OECD
neovim
Szcenárió
szcenáriók
HIDY

BIN
spell/hu.utf-8.add.spl Normal file

Binary file not shown.

BIN
spell/hu.utf-8.spl Normal file

Binary file not shown.