Updated vim macros
Test Neovim config on push / build (ubuntu-20.04) (push) Failing after 22s Details

This commit is contained in:
Yannick Reiß 2024-06-21 08:06:01 +02:00
parent f33b495d12
commit 39b9d351c0
7 changed files with 57 additions and 10 deletions

View File

@ -117,6 +117,7 @@ snippet docstring "Document String with most important infor" b
-- Created on: `date`
-- Author(s): ${1:Yannick Reiß}
-- Content: ${2: Function `!p snip.rv = fn.split('.')[0]`}
$0
endsnippet
snippet project "Project" b

View File

@ -92,3 +92,8 @@ snippet cite "Cite from a paper" b
Tags: $2
$0
endsnippet
snippet immernoch "ARGH, lern schreiben!" A
noch immer
endsnippet

View File

@ -266,27 +266,27 @@ endsnippet
snippet sch "chapter"
\\chapter{$1}
\\label{chapter:`!p snip.rv = t[1].lower().replace(" ", "_")`}$0
\\label{chapter:`!p snip.rv = get_label(t[1])`}$0
endsnippet
snippet sse "Section"
\\section{$1}
\\label{section:`!p snip.rv = t[1].lower().replace(" ", "_")`}$0
\\label{section:`!p snip.rv = get_label(t[1])`}$0
endsnippet
snippet sss "Subsection"
\\subsection{$1}
\\label{subsection:`!p snip.rv = t[1].lower().replace(" ", "_")`}$0
\\label{subsection:`!p snip.rv = get_label(t[1])`}$0
endsnippet
snippet ssn "Subsubsection"
\\subsubsection{$1}
\\label{subsubsection:`!p snip.rv = t[1].lower().replace(" ", "_")`}$0
\\label{subsubsection:`!p snip.rv = get_label(t[1])`}$0
endsnippet
snippet par "Paragraph"
\\paragraph{$1}
\\label{paragraph:`!p snip.rv = t[1].lower().replace(" ", "_")`}$0
\\label{paragraph:`!p snip.rv = get_label(t[1])`}$0
endsnippet
snippet mquote "max quote"
@ -379,6 +379,16 @@ def create_table(cols, rows, sep, start, end, head="##"):
placeholder += 1
res += end
return res[:-1]
def get_label(title):
return_label = title.lower()
return_label = return_label.replace(" ", "_")
return_label = return_label.replace("ä", "ae")
return_label = return_label.replace("ö", "oe")
return_label = return_label.replace("ü", "ue")
return_label = return_label.replace("-", "__")
return return_label
endglobal
post_jump "create_table_tabs(snip)"
@ -469,11 +479,11 @@ snippet bsp "Beispielsweise" A
beispielsweise
endsnippet
snippet ß "Backslash" iA
snippet ß "Backslash" A
\\
endsnippet
snippet \´ "Add another Backslash" iA
snippet \0 "Add another Backslash" iA
\\\\
endsnippet

View File

@ -61,6 +61,7 @@ require("mason").setup(require("mason").setup({
require("mason-lspconfig").setup({
-- ensure_installed = { "clangd", "cmake", "jdtls", "texlab", "pylsp" },
ensure_installed = { "clangd" },
})
require("mason-lspconfig").setup_handlers({

View File

@ -65,4 +65,19 @@ return {
{ "tzachar/cmp-fuzzy-buffer", requires = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" } },
"jaredgorski/spacecamp",
"voldikss/vim-floaterm",
-- {
-- "lervag/vimtex",
-- lazy = false, -- we don't want to lazy load VimTeX
-- -- tag = "v2.15", -- uncomment to pin to a specific release
-- init = function()
-- -- VimTeX configuration goes here, e.g.
-- vim.o.foldmethod = "expr"
-- vim.o.foldexpr = "vimtex#fold#level(v:lnum)"
-- vim.o.foldtext = "vimtex#fold#text()"
-- vim.o.foldlevel = 1
-- vim.g.vimtex_view_general_viewer = "okular"
-- vim.g.vimtex_view_general_options = "--unique file:@pdf#src:@line@tex"
-- vim.g.vimtex_fold_enabled = 1
-- end,
--},
}

View File

@ -27,6 +27,7 @@ vim.opt.encoding = "UTF-8"
vim.g.tex_flavor = "latex"
vim.opt.conceallevel = 2
vim.opt.showmatch = true
vim.o.guifont = "Source Code Pro:h13"
-- set color scheme
vim.opt.termguicolors = true
@ -39,4 +40,3 @@ vim.opt.mouse = ""
-- set copy mode
vim.keymap.set("n", "<leader>ll", ":set nonumber<cr>")
vim.keymap.set("n", "<leader>lm", ":set number<cr>")

View File

@ -1,3 +1,10 @@
" various tools inside vim
function! GetCharUnderCursor()
let line = getline('.')
let col = col('.')
return line[col - 1]
endfunction
" predefined macros in functions
function SpacedLine()
normal o
@ -11,7 +18,15 @@ function SwapWords()
normal e
exec 'normal! a '
normal p
normal l
let char = GetCharUnderCursor()
if char == ' '
normal x
endif
normal h
normal b
normal b
endfunction
nnoremap <leader>o :call SpacedLine()<CR>
nnoremap <leader>ls :call SwapWords()<CR>
let @o = ':call SpacedLine() '
let @s = ':call SwapWords() '