aboutsummaryrefslogtreecommitdiff
path: root/.vim/functions
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2019-10-02 11:49:11 +0200
committerPatrick Spek <p.spek@tyil.nl>2019-10-02 11:49:11 +0200
commiteac0f1c0d14a9c3ac33cefb8eed82fe6f6ea9849 (patch)
tree15a91bb31a491a85f690ca1d5ccf2732e7a6e913 /.vim/functions
parent56bc2df958b655da811f0eb68a5063a962198b08 (diff)
Include vim configuration
Diffstat (limited to '.vim/functions')
-rw-r--r--.vim/functions/pick-theme.vim19
-rw-r--r--.vim/functions/set-char-limit.vim9
-rw-r--r--.vim/functions/set-indent.vim19
3 files changed, 47 insertions, 0 deletions
diff --git a/.vim/functions/pick-theme.vim b/.vim/functions/pick-theme.vim
new file mode 100644
index 0000000..e601a83
--- /dev/null
+++ b/.vim/functions/pick-theme.vim
@@ -0,0 +1,19 @@
+" PickTheme
+"
+" Pick a customized theme. If no specific theme is given, a random one will be
+" loaded instead.
+"
+" @param string name The name of the theme to load, if any.
+function PickTheme (...)
+ let name = get(a:, 1, "")
+
+ if name
+ exe "ru " . g:path . "/themes/" . name . ".vim"
+ return 0
+ endif
+
+ let s:themes = split(globpath(g:path . "/themes", "*.vim"), "\n")
+ let s:index = system("perl -e 'print int(rand(" . len(s:themes) . "))'")
+
+ exe "so " . s:themes[s:index]
+endfunction
diff --git a/.vim/functions/set-char-limit.vim b/.vim/functions/set-char-limit.vim
new file mode 100644
index 0000000..9269059
--- /dev/null
+++ b/.vim/functions/set-char-limit.vim
@@ -0,0 +1,9 @@
+" SetCharLimit
+"
+" Set's character limit for a file.
+"
+" @param int chars The number of chars to put the limit on.
+function SetCharLimit (chars)
+ exe "set cc=" . a:chars
+ exe "set tw=" . a:chars
+endfunction
diff --git a/.vim/functions/set-indent.vim b/.vim/functions/set-indent.vim
new file mode 100644
index 0000000..8fdc308
--- /dev/null
+++ b/.vim/functions/set-indent.vim
@@ -0,0 +1,19 @@
+" SetIndent
+"
+" Set the size of indents and whether to use tabs or spaces.
+"
+" @param int size The width of the indents.
+" @param bool tabs Whether to use hard tabs or not. Defaults to 1.
+function SetIndent (...)
+ let size = get(a:, 1)
+ let tabs = get(a:, 2, 1)
+
+ if (tabs)
+ set noet
+ else
+ set et
+ endif
+
+ exe "set sw=" . size
+ exe "set ts=" . size
+endfunction