function! FixLastSpellingError() normal! mm[s1z=`m endfunction function! MakeHeading(level) if a:level == 1 normal! yypVr= elseif a:level == 2 normal! yypVr~ endif endfunction function! Spelling(lang) if a:lang == "en" setlocal spell spelllang=en_us setlocal spellfile=~/.vim/spell/en.utf-8.add elseif a:lang == "sv" setlocal spell spelllang=sv setlocal spellfile=~/.vim/spell/sv.utf-8.add elseif a:lang == "off" setlocal nospell endif endfunction nnoremap :echo "No left for you!" vnoremap :echo "No left for you!" inoremap :echo "No left for you!" nnoremap :echo "No right for you!" vnoremap :echo "No right for you!" inoremap :echo "No right for you!" nnoremap :echo "No left up you!" vnoremap :echo "No up for you!" inoremap :echo "No up for you!" nnoremap :echo "No Down for you!" vnoremap :echo "No Down for you!" inoremap :echo "No Down for you!" " Basic vim settings set title set number set laststatus=2 set encoding=utf-8 set autoindent set nocompatible set complete=.,w,b,u,t,i,kspell syntax on nnoremap let mapleader=" " map ss :call FixLastSpellingError() map u1 :call MakeHeading(1) map u2 :call MakeHeading(2) map ls :call Spelling("sv") map le :call Spelling("en") map lo :call Spelling("off") filetype indent plugin on " Global tab settings set tabstop=4 set shiftwidth=4 set softtabstop=4 set expandtab set relativenumber " Pathogen execute pathogen#infect() " Spellcheck " 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 list listchars=tab:»\ ,trail:· " Mark characters 80+ on each line with red color function! Highlight() highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.\+/ endfunction " remaps noremap _h :call Highlight() nmap i**=strftime("%Y-%m-%d")** imap **=strftime("%Y-%m-%d")** """""""""""""""""""" " GnuPG Extensions " """""""""""""""""""" " sudo zypper install vim-plugin-gnupg let g:GPGDefaultRecipients=[ \"Jonas Forsberg ", \"Jonas Forsberg " \] " Tell the GnuPG plugin to armor new files. let g:GPGPreferArmor=1 " Tell the GnuPG plugin to sign new files. let g:GPGPreferSign=1 augroup GnuPGExtra " Set extra file options. autocmd BufReadCmd,FileReadCmd *.\(gpg\|asc\|pgp\) call SetGPGOptions() " Automatically close unmodified files after inactivity. autocmd CursorHold *.\(gpg\|asc\|pgp\) quit augroup END function SetGPGOptions() " Set updatetime to 1 minute. set updatetime=60000 " Fold at markers. set foldmethod=marker " Automatically close all folds. set foldclose=all " Only open folds with insert commands. set foldopen=insert endfunction if has("autocmd") " To spell check all git commit messages au BufNewFile,BufRead COMMIT_EDITMSG set spelllang=en_us spell nonumber nolist wrap linebreak " To spell check all Markdown files autocmd FileType markdown setlocal spell autocmd BufRead,BufNewFile *.rst setlocal spell " Set filetype tab settings autocmd FileType python,doctest set ai ts=4 sw=4 sts=4 et 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