From df363af79cca263609724343735578cc0069ee3a Mon Sep 17 00:00:00 2001
From: tiynger
Date: Tue, 12 Nov 2019 22:48:35 +0100
Subject: [PATCH] changing latex/html shortcuts in vim
---
.config/nvim/init.vim | 60 +++++++++++++++++++++++++++++++++++++------
1 file changed, 52 insertions(+), 8 deletions(-)
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index e944297..cbf60e9 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -19,15 +19,14 @@ filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
+" Enable autocompletion:
+set wildmode=longest,list,full
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Setting Tab-length
set tabstop=4
set softtabstop=4
set shiftwidth=4
-"set expandtab
-"set autoindent
-"set copyindent
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
@@ -36,6 +35,9 @@ set splitbelow splitright
vnoremap "+y
map "+P
+" Save file as sudo on files that require root permission
+cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit!
+
" Mapping Dictionaries
map :setlocal spell! spelllang=de
map :set spelllang=en_us
@@ -43,14 +45,56 @@ map :set spelllang=en_us
" Read files correctly
autocmd BufRead,BufNewFile *.tex set filetype=tex
-""" LATEX
+""" Shortcuts
+" Navigating with guides
+inoremap /<++>"_c4l
+vnoremap /<++>"_c4l
+map /<++>"_c4l
+
+"" LATEX
" Clean LaTex build files
autocmd VimLeave *.tex !texclear %
-autocmd FileType tex inoremap ,ul \begin{itemize}\end{itemize}3kA\item
+autocmd FileType tex inoremap ,fr \begin{frame}\frametitle{}<++>\end{frame}<++>6kf}i
+autocmd FileType tex inoremap ,em \emph{}<++>T{i
+autocmd FileType tex inoremap ,bf \textbf{}<++>T{i
+autocmd FileType tex inoremap ,it \textit{}<++>T{i
+autocmd FileType tex inoremap ,ct \textcite{}<++>T{i
+autocmd FileType tex inoremap ,cp \parencite{}<++>T{i
+autocmd FileType tex inoremap ,ol \begin{enumerate}\end{enumerate}<++>3kA\item
+autocmd FileType tex inoremap ,ul \begin{itemize}\end{itemize}<++>3kA\item
autocmd FileType tex inoremap ,li \item
-autocmd FileType tex inoremap ,sec \section*{}2kf}i
-autocmd FileType tex inoremap ,ssec \subsection*{}2kf}i
-autocmd FileType tex inoremap ,sssec \subsubsection*{}2kf}i
+autocmd FileType tex inoremap ,ref \ref{}<++>T{i
+autocmd FileType tex inoremap ,tab \begin{tabular}<++>\end{tabular}<++>4kA{}i
+autocmd FileType tex inoremap ,a \href{}{<++>}<++>2T{i
+autocmd FileType tex inoremap ,sc \textsc{}<++>T{i
+autocmd FileType tex inoremap ,chap \chapter{}<++>2kf}i
+autocmd FileType tex inoremap ,sec \section{}<++>2kf}i
+autocmd FileType tex inoremap ,ssec \subsection{}<++>2kf}i
+autocmd FileType tex inoremap ,sssec \subsubsection{}<++>2kf}i
+autocmd FileType tex inoremap ,beg \begin{DELRN}<++>\end{DELRN}<++>4k0fR:MultipleCursorsFindDELRNc
+autocmd FileType tex inoremap ,up /usepackageo\usepackage{}i
+autocmd FileType tex nnoremap ,up /usepackageo\usepackage{}i
+autocmd FileType tex inoremap ,tt \texttt{}<++>T{i
+
+"""HTML
+autocmd FileType html inoremap ,b <++>FbT>i
+autocmd FileType html inoremap ,it <++>FeT>i
+autocmd FileType html inoremap ,1 <++>2kf<++>2kf<++>2kf
<++>02kf>a
+autocmd FileType html inoremap ,a href=""><++><++>14hi
+autocmd FileType html inoremap ,e target="_blank"href=""><++><++>14hi
+autocmd FileType html inoremap ,ul <++>03kfoF>a
+autocmd FileType html inoremap ,ol
<++>03kf<++>Fcf"a
+autocmd FileType html inoremap & &
+autocmd FileType html inoremap ä ä
+autocmd FileType html inoremap ë ë
+autocmd FileType html inoremap ï ï
+autocmd FileType html inoremap ö ö
+autocmd FileType html inoremap ü ü
" Compiler for languages
map c :w! \| !compiler %