aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkatherine <shmibs@shmibbles.me>2017-10-17 00:48:29 -0700
committerkatherine <shmibs@shmibbles.me>2017-10-17 00:48:29 -0700
commit7d1a33013e22396cfa62857db818f2cb756ea0ad (patch)
tree6f484e942b396e977df8111040a8ea89a1378a4b
parent60d12c13e01032b9de4d1b3855a58dff6122c654 (diff)
downloaddotfiles-7d1a33013e22396cfa62857db818f2cb756ea0ad.tar.gz
implement simple filetype templates for vim
will probably expand on this more later
-rw-r--r--.vim/skel/bash3
-rw-r--r--.vim/skel/tex17
-rw-r--r--.vim/skel/zsh3
-rw-r--r--.vimrc24
4 files changed, 46 insertions, 1 deletions
diff --git a/.vim/skel/bash b/.vim/skel/bash
new file mode 100644
index 0000000..b6d0a1b
--- /dev/null
+++ b/.vim/skel/bash
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+%START%
diff --git a/.vim/skel/tex b/.vim/skel/tex
new file mode 100644
index 0000000..3fb79fb
--- /dev/null
+++ b/.vim/skel/tex
@@ -0,0 +1,17 @@
+\documentclass[letter,12pt]{article}
+\usepackage[margin=1in]{geometry}
+
+\usepackage{xeCJK}
+\setCJKmainfont[Scale=.8]{IPAMincho}
+
+\title{}
+\author{}
+
+\begin{document}
+
+\frenchspacing
+\maketitle
+
+%START%
+
+\end{document}
diff --git a/.vim/skel/zsh b/.vim/skel/zsh
new file mode 100644
index 0000000..ebcd4c1
--- /dev/null
+++ b/.vim/skel/zsh
@@ -0,0 +1,3 @@
+#!/usr/bin/env zsh
+
+%START%
diff --git a/.vimrc b/.vimrc
index b9a2e4a..927d0b2 100644
--- a/.vimrc
+++ b/.vimrc
@@ -9,7 +9,7 @@ endif
set nocompatible
filetype off
-set rtp+=~/.vim/bundle/Vundle.vim
+execute 'set rtp+=' . split(&rtp, ',')[0] . '/bundle/Vundle.vim'
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
@@ -252,6 +252,28 @@ autocmd FileType text call Settings_text()
autocmd FileType vim call Settings_vim()
autocmd FileType zsh call Settings_shell()
+"command for reading filetype skeletons
+function! Settings_skel_read()
+ if line('$') != 1 || col('$') != 1
+ " echoh ErrorMsg
+ " echo "err: cannot load skeleton: buffer is not empty"
+ " echoh None
+ return 1
+ end
+ if filereadable(split(&rtp, ',')[0] . "/skel/" . &ft) == 0
+ " echoh ErrorMsg
+ " echo "err: cannot load skeleton: no skeleton found for filetype '" . &ft . "'"
+ " echoh None
+ return 1
+ end
+ let l:fname = split(&rtp, ',')[0] . "/skel/" . &ft
+ execute 'r ' . l:fname
+ execute "normal ggJ/%START%\<CR>cc"
+ redraw!
+endfunction
+autocmd FileType * call Settings_skel_read()
+
+""write mode" for markup-type formats
function! Settings_sub_wmodetoggle()
if &fo =~ 'a'
setlocal formatoptions-=a