VimWiki configuration

This commit is contained in:
Jonas Forsberg 2020-07-10 10:23:39 +02:00
parent c4b8012957
commit 8041c66a7b
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9
4 changed files with 96 additions and 36 deletions

1
.alias
View File

@ -6,4 +6,3 @@ alias dotf='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
alias ls_dotfiels='/usr/bin/git --git-dir=$HOME/.dotfiles ls-tree --full-tree -r --name-only HEAD' alias ls_dotfiels='/usr/bin/git --git-dir=$HOME/.dotfiles ls-tree --full-tree -r --name-only HEAD'
alias t="todo.sh" alias t="todo.sh"
alias gl='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --date=relative' alias gl='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --date=relative'
alias wiki="vim ~/vimwiki/wiki.wiki"

View File

@ -1,57 +1,57 @@
function docker(){ function docker(){
sudo docker "$@" sudo docker "$@"
} }
function pw(){ function pw(){
FILE="$1" FILE="$1"
[[ -z "$PWHOME" ]] && printf "\$PWHOME not set\n" && return [[ -z "$PWHOME" ]] && printf "\$PWHOME not set\n" && return
[[ -z "$FILE" ]] && FILE="web.gpg" [[ -z "$FILE" ]] && FILE="web.gpg"
if [[ ! "${FILE: -4}" == ".gpg" ]];then if [[ ! "${FILE: -4}" == ".gpg" ]];then
FILE="${FILE}.gpg" FILE="${FILE}.gpg"
fi fi
cd "$PWHOME" cd "$PWHOME"
vi "$FILE" vi "$FILE"
cd "$OLDPWD" cd "$OLDPWD"
} }
_pw_completion() _pw_completion()
{ {
local cur prev suggestions local cur prev suggestions
[[ -z "$PWHOME" ]] && return [[ -z "$PWHOME" ]] && return
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
cd "$PWHOME" cd "$PWHOME"
suggestions="$(ls *.gpg)" suggestions="$(ls *.gpg)"
cd "$OLDPWD" cd "$OLDPWD"
if [[ "$prev" != "pw" ]];then if [[ "$prev" != "pw" ]];then
COMPREPLY=() COMPREPLY=()
else else
COMPREPLY=( $(compgen -W "${suggestions}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${suggestions}" -- ${cur}) )
fi fi
} }
complete -F _pw_completion pw complete -F _pw_completion pw
function doh() function doh()
{ {
local options local options
options=(start stop restart status) options=(start stop restart status)
if [[ ! " ${options[@]} " =~ " ${1} " ]]; then if [[ ! " ${options[@]} " =~ " ${1} " ]]; then
echo "wrong option, valid: ${options[@]}" echo "wrong option, valid: ${options[@]}"
return return
fi fi
if [[ "$1" == "status" ]]; then if [[ "$1" == "status" ]]; then
systemctl status local-doh-proxy systemctl status local-doh-proxy
else else
sudo systemctl "$1" local-doh-proxy sudo systemctl "$1" local-doh-proxy
fi fi
} }
function copy_k8s_token(){ function copy_k8s_token(){
grep "id-token" ~/.kube/config | awk '{print $2}' | xclip -sel clip grep "id-token" ~/.kube/config | awk '{print $2}' | xclip -sel clip
} }
function ip_to_hex(){ function ip_to_hex(){
@ -62,3 +62,21 @@ function ip_to_hex(){
function salt-call(){ function salt-call(){
sudo salt-call --local "$@" sudo salt-call --local "$@"
} }
function wiki(){
local selected_wiki
selected_wiki="$1"
case $1 in
SUSE|suse|S|s|2)
vim -c "normal 2,ww"
;;
Private|private|p|2)
vim -c "normal 3,ww"
;;
*)
vim -c "normal 1,ww"
;;
esac
}

41
.vimrc
View File

@ -6,6 +6,7 @@ set encoding=utf-8
set autoindent set autoindent
set nocompatible set nocompatible
syntax on syntax on
let mapleader=","
filetype indent plugin on filetype indent plugin on
@ -15,15 +16,38 @@ set shiftwidth=4
set softtabstop=4 set softtabstop=4
set expandtab set expandtab
" Pathogen
execute pathogen#infect()
" vimwiki
let wiki_1 = {}
let wiki_1.path = '~/Nextcloud/vimwiki'
let wiki_1.syntax = 'markdown'
let wiki_1.ext = '.md'
let wiki_2 = {}
let wiki_2.path = '~/Nextcloud/vimwiki/suse'
let wiki_2.syntax = 'markdown'
let wiki_2.ext = '.md'
let wiki_3 = {}
let wiki_3.path = '~/Nextcloud/vimwiki/private'
let wiki_3.syntax = 'markdown'
let wiki_3.ext = '.md'
let g:vimwiki_list = [wiki_1, wiki_2, wiki_3]
" Set to show invisibles (tabs & trailing spaces) & their highlight color " Set to show invisibles (tabs & trailing spaces) & their highlight color
set list listchars=tab:»\ ,trail set list listchars=tab:»\ ,trail
" Mark characters 80+ on each line with red color
function! Highlight() function! Highlight()
highlight OverLength ctermbg=red ctermfg=white guibg=#592929 highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/ match OverLength /\%81v.\+/
endfunction endfunction
nnoremap _h :call Highlight()<CR>
" remaps
noremap <Leader>_h :call Highlight()<CR>
nmap <F2> i**<C-R>=strftime("%Y-%m-%d %H:%M:%S")<CR>**<CR><CR><Esc>
imap <F2> **<C-R>=strftime("%Y-%m-%d %H:%M:%S")<CR>**<CR><CR>
nmap <F8> c~<c-r>"~
"""""""""""""""""""" """"""""""""""""""""
" GnuPG Extensions " " GnuPG Extensions "
@ -70,3 +94,18 @@ if has("autocmd")
" Set filetype tab settings " Set filetype tab settings
autocmd FileType python,doctest set ai ts=4 sw=4 sts=4 et autocmd FileType python,doctest set ai ts=4 sw=4 sts=4 et
endif endif
" vim-instant-markdown settings
"Uncomment to override defaults:
let g:instant_markdown_slow = 0
let g:instant_markdown_autostart = 0
let g:instant_markdown_open_to_the_world = 0
let g:instant_markdown_allow_unsafe_content = 0
let g:instant_markdown_allow_external_content = 1
"let g:instant_markdown_mathjax = 1
"let g:instant_markdown_browser = "firefox --new-window"
"let g:instant_markdown_logfile = '/tmp/instant_markdown.log'
"let g:instant_markdown_autoscroll = 0
"let g:instant_markdown_port = 8888
"let g:instant_markdown_python = 1

View File

@ -9,3 +9,7 @@ packages:
go: { status: installed } go: { status: installed }
nextcloud-client: { status: installed } nextcloud-client: { status: installed }
keepassxc: { status: installed } keepassxc: { status: installed }
vim-plugin-gnupg: { status: installed }
# vim-instant-markdown
xdg-utils: { status: installed }
nodejs10 { status: installed }