aboutsummaryrefslogtreecommitdiff
path: root/.vim
diff options
context:
space:
mode:
Diffstat (limited to '.vim')
m---------.vim/bundle/feature-camelcasemotion0
m---------.vim/bundle/feature-rainbow-parenthesis0
m---------.vim/bundle/syntax-blade0
m---------.vim/bundle/syntax-go0
m---------.vim/bundle/syntax-hcl0
m---------.vim/bundle/syntax-helm0
m---------.vim/bundle/syntax-ledger0
m---------.vim/bundle/syntax-markdown0
m---------.vim/bundle/syntax-mustache0
m---------.vim/bundle/syntax-raku0
m---------.vim/bundle/syntax-terraform0
m---------.vim/bundle/syntax-todo0
m---------.vim/bundle/syntax-toml0
m---------.vim/bundle/theme-codedark0
m---------.vim/bundle/theme-colorsbox0
m---------.vim/bundle/theme-jellybeans0
m---------.vim/bundle/theme-molokai0
-rw-r--r--.vim/ftplugin/php.vim3
-rw-r--r--.vim/ftplugin/yaml.vim49
-rw-r--r--.vim/plugin/k8s-edit-secret.vim60
-rw-r--r--.vim/vimrc3
21 files changed, 115 insertions, 0 deletions
diff --git a/.vim/bundle/feature-camelcasemotion b/.vim/bundle/feature-camelcasemotion
new file mode 160000
+Subproject dbf66cf6d66f6716b72c6f683624ad694c0b8d4
diff --git a/.vim/bundle/feature-rainbow-parenthesis b/.vim/bundle/feature-rainbow-parenthesis
new file mode 160000
+Subproject 61f719aebe0dc5c3048330c50db72cfee1afdd3
diff --git a/.vim/bundle/syntax-blade b/.vim/bundle/syntax-blade
new file mode 160000
+Subproject 9534101808cc320eef003129a40cab04b026a20
diff --git a/.vim/bundle/syntax-go b/.vim/bundle/syntax-go
new file mode 160000
+Subproject feef9b31507f8e942bcd21f9e1f22d587c83c72
diff --git a/.vim/bundle/syntax-hcl b/.vim/bundle/syntax-hcl
new file mode 160000
+Subproject 1e1116c17a5774851360ea8077f349e36fc733c
diff --git a/.vim/bundle/syntax-helm b/.vim/bundle/syntax-helm
new file mode 160000
+Subproject 86cc6766db60b8cc5731068d0c2111dee1f2b32
diff --git a/.vim/bundle/syntax-ledger b/.vim/bundle/syntax-ledger
new file mode 160000
+Subproject 281346a221434574dd7f8767a352b2bf0b218b7
diff --git a/.vim/bundle/syntax-markdown b/.vim/bundle/syntax-markdown
new file mode 160000
+Subproject a657e697376909c41475a686eeef7fc7a4972d9
diff --git a/.vim/bundle/syntax-mustache b/.vim/bundle/syntax-mustache
new file mode 160000
+Subproject 0153fe03a919add2d6cf2d41b2d5b6e1188bc0e
diff --git a/.vim/bundle/syntax-raku b/.vim/bundle/syntax-raku
new file mode 160000
+Subproject 84a65c415f966c3cd5536fdbc6d70ee8f0d7350
diff --git a/.vim/bundle/syntax-terraform b/.vim/bundle/syntax-terraform
new file mode 160000
+Subproject 21f756b933cd11ac5990a6046fdc7c4e2a6c0ae
diff --git a/.vim/bundle/syntax-todo b/.vim/bundle/syntax-todo
new file mode 160000
+Subproject 3bb5f9cf0d6c7ee91b476a97054c336104d2b6f
diff --git a/.vim/bundle/syntax-toml b/.vim/bundle/syntax-toml
new file mode 160000
+Subproject d36caa6b1cf508a4df1c691f915572fc0214325
diff --git a/.vim/bundle/theme-codedark b/.vim/bundle/theme-codedark
new file mode 160000
+Subproject 05d7843412c4fb7d1bdafefd04462ac4db841f0
diff --git a/.vim/bundle/theme-colorsbox b/.vim/bundle/theme-colorsbox
new file mode 160000
+Subproject 77de081eab27872f94c4eab120e23e4ca5481b7
diff --git a/.vim/bundle/theme-jellybeans b/.vim/bundle/theme-jellybeans
new file mode 160000
+Subproject ef83bf4dc8b3eacffc97bf5c96ab2581b415c9f
diff --git a/.vim/bundle/theme-molokai b/.vim/bundle/theme-molokai
new file mode 160000
+Subproject c67bdfcdb31415aa0ade7f8c003261700a88547
diff --git a/.vim/ftplugin/php.vim b/.vim/ftplugin/php.vim
new file mode 100644
index 0000000..b8df966
--- /dev/null
+++ b/.vim/ftplugin/php.vim
@@ -0,0 +1,3 @@
+set shiftwidth=4
+set tabstop=4
+set expandtab
diff --git a/.vim/ftplugin/yaml.vim b/.vim/ftplugin/yaml.vim
index 0c0c07f..ae4ce66 100644
--- a/.vim/ftplugin/yaml.vim
+++ b/.vim/ftplugin/yaml.vim
@@ -1,3 +1,52 @@
set shiftwidth=2
set tabstop=2
set expandtab
+
+function! GetAncestors(line)
+ if(indent(a:line) == 0 && a:line == 1)
+ return ''
+ endif
+
+ if(indent(a:line) == 0 && a:line > 1)
+ if(getline(a:line) !~ '^\s*$') " not an empty line
+ return ''
+ else
+ " sometimes there are newlines within a multiline key
+ return GetAncestors(a:line-1) " return ancestors of previous line
+ endif
+ endif
+
+ let lowerIndent = indent(a:line)-1
+ " check if line is part of a list
+ let isList = ''
+ if(getline(a:line) =~# '^\s*-')
+ let isList = '[]'
+ " find the first key above this in the file that has is not a list member
+ let lastKeyLine = search('^\s\{0,'.indent(a:line).'}[^-]\S\+:', 'bnW')
+ else
+ " find the first key above this in the file that has a lower indent or a
+ " containing list member
+ let lastKeyLine = search('^\s\{0,'.lowerIndent.'}\(\S\+\|-\s\S\+\):', 'bnW')
+ let lastKeyLineContent = getline(lastKeyLine)
+ " check if the containing key is not a member of the same object
+ if(lastKeyLineContent =~# ':\s.\+$' && lastKeyLineContent =~# '^\s*-')
+ let lastKeyLine = search('^\s\{0,'.lowerIndent.'}\(\S\+\|-\s\S\+\):\s*$', 'zbnW')
+ let isList = '[]'
+ endif
+ endif
+
+ let key = matchstr(getline(lastKeyLine), '\s*[\-]\?\s*\zs.\+\ze:').isList
+
+ if(indent(lastKeyLine) > 0)
+ return GetAncestors(lastKeyLine).' . '.key
+ endif
+
+ return key
+endfunction
+
+augroup YamlRevealer
+ au!
+ if(&filetype =~# 'yaml')
+ autocmd CursorMoved <buffer> redraw | echo GetAncestors(line('.'))
+ endif
+aug END
diff --git a/.vim/plugin/k8s-edit-secret.vim b/.vim/plugin/k8s-edit-secret.vim
new file mode 100644
index 0000000..1a3e063
--- /dev/null
+++ b/.vim/plugin/k8s-edit-secret.vim
@@ -0,0 +1,60 @@
+" This program is free software: you can redistribute it and/or modify it under
+" the terms of the GNU Affero General Public License as published by the Free
+" Software Foundation, either version 3 of the License, or (at your option) any
+" later version.
+"
+" This program is distributed in the hope that it will be useful, but WITHOUT
+" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+" FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+" details.
+
+" Ensure this plugin is only loaded once
+if (exists("g:k8s_edit_secret") || &cp || exists("#K8sEditSecret"))
+ finish
+endif
+
+let g:k8s_edit_secret = "1"
+
+" Define the file pattern
+let g:k8s_edit_secret_file_pattern = get(g:, "k8s_edit_secret_file_pattern", "/tmp/kubectl-edit-*.yaml")
+
+" Define the decode function
+function K8sEditSecretDecode (...)
+ " Check if the file is really a secret
+ silent exe "!grep -q \"^kind: Secret$\" \"%:p\""
+
+ " Not a secret, just read the file as usual
+ if (v:shell_error)
+ return
+ endif
+
+ " Pipe buffer through kubectl secret decode
+ let view = winsaveview()
+ silent exe "%!kubectl secret decode"
+ call winrestview(view)
+endfunction
+
+" Define the encode function
+function K8sEditSecretEncode (...)
+ " Check if the file is really a secret
+ silent exe "!grep -q \"^kind: Secret$\" \"%:p\""
+
+ " Not a secret, just read the file as usual
+ if (v:shell_error)
+ return
+ endif
+
+ " Pipe buffer through kubectl secret encode
+ let view = winsaveview()
+ silent exe "%!kubectl secret encode"
+ call winrestview(view)
+endfunction
+
+" Define the autocmd
+augroup K8sEditSecret
+ autocmd!
+
+ " Register autocmd on read/write
+ exe "autocmd BufWritePre " . g:k8s_edit_secret_file_pattern . " call K8sEditSecretEncode()"
+ exe "autocmd BufReadPost,BufWritePost " . g:k8s_edit_secret_file_pattern . " call K8sEditSecretDecode()"
+augroup END
diff --git a/.vim/vimrc b/.vim/vimrc
index 2ff5b86..b6172be 100644
--- a/.vim/vimrc
+++ b/.vim/vimrc
@@ -26,6 +26,9 @@ set ut=500
set wig=*.swp,*.bak,*.pyc,*.class,*.jar,*.gif,*.png,*.jpg,.precomp
set wmnu
+filetype plugin on
+syntax on
+
call PickTheme('codedark')
call SetIndent(8)