From e9982531f2d29cf4924b5af6476bed0cc568991d Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Mon, 5 Nov 2018 20:12:38 +0000 Subject: [PATCH] folds --- vimrc | 199 ++++++++++++++++++++++++---------------------------------- 1 file changed, 83 insertions(+), 116 deletions(-) diff --git a/vimrc b/vimrc index 7998a8d..02392eb 100644 --- a/vimrc +++ b/vimrc @@ -1,4 +1,3 @@ - " #plugins {{{ if empty(glob('~/.vim/autoload/plug.vim'))"{{{ @@ -12,12 +11,12 @@ call plug#begin('~/.vim/bundle') " #css3-syntax{{{ Plug 'hail2u/vim-css3-syntax' -"}}} +"}}} " #scss-syntax{{{ Plug 'cakebaker/scss-syntax.vim' -"}}} +"}}} " #vim-vue {{{ " https://github.com/posva/vim-vue Plug 'posva/vim-vue' @@ -39,28 +38,28 @@ augroup END Plug 'vim-python/python-syntax' let g:python_highlight_all = 1 -"}}} +"}}} "#html5{{{ " https://github.com/othree/html5.vim Plug 'othree/html5.vim' -"}}} +"}}} " #php.vim{{{ " https://github.com/StanAngeloff/php.vim Plug 'StanAngeloff/php.vim' -"}}} +"}}} "#vim-json{{{ " https://github.com/elzr/vim-json Plug 'elzr/vim-json' -"}}} +"}}} "#i3config.vim{{{ " https://github.com/mboughaba/i3config.vim Plug 'mboughaba/i3config.vim' -"}}} +"}}} " #tagbar {{{ Plug 'majutsushi/tagbar' @@ -105,17 +104,17 @@ let g:tagbar_type_vue = { \ 'v:variable' \ ] \ } -"}}} +"}}} " #vim-surround{{{ Plug 'tpope/vim-surround' -"}}} +"}}} " #undotree {{{ Plug 'mbbill/undotree' -"}}} +"}}} " #Ctrlp {{{ Plug 'ctrlpvim/ctrlp.vim' " :h ctrlp-commands @@ -133,16 +132,16 @@ endif if executable('ag') set grepprg=ag\ --nogroup\ --nocolor\ --ignore\ node_modules endif -"}}} +"}}} " #Obsession{{{ Plug 'tpope/vim-obsession' -"}}} -" vim-javascript{{{ +"}}} +" #vim-javascript{{{ Plug 'pangloss/vim-javascript' -"}}} +"}}} " #ultisnips {{{ " https://github.com/sirver/UltiSnips Plug 'SirVer/ultisnips' @@ -160,7 +159,7 @@ let g:UltiSnipsJumpForwardTrigger='' let g:UltiSnipsJumpBackwardTrigger='' let g:UltiSnipsEditSplit='horizontal' -function! ListUltisnips() abort +function! ListUltisnips() abort"{{{ let l:snips = UltiSnips#SnippetsInCurrentScope(1) let l:keylist = sort(keys(l:snips)) echo ' --------------------------------------------------' @@ -170,7 +169,8 @@ function! ListUltisnips() abort echo '---------------------------------------------------' endfunction -function! CompleteSnippets(findstart, base) +"}}} +function! CompleteSnippets(findstart, base)"{{{ if a:findstart let l:line = getline('.') let l:start = col('.') - 1 @@ -192,10 +192,11 @@ function! CompleteSnippets(findstart, base) endif endfunction +"}}} + set completefunc=CompleteSnippets "}}} - " #ALE {{{ " https://github.com/w0rp/ale Plug 'w0rp/ale' @@ -213,21 +214,21 @@ let g:ale_linters = {'scss': ['stylelint'], 'javascript': [], 'php':['php'], 'ht " let g:ale_linters_explicit = 1 let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' let g:ale_fixers = {'javascript': ['eslint']} -"}}} +"}}} " #MatchTagAlways{{{ " https://github.com/Valloric/MatchTagAlways Plug 'Valloric/MatchTagAlways' -"}}} +"}}} " #phpcomplete.vim{{{ " https://github.com/shawncplus/phpcomplete.vim Plug 'shawncplus/phpcomplete.vim' " https://github.com/dsawardekar/wordpress.vim " For up to date Wordpress Files see: " https://github.com/joseluis/wordpress.vim-generator -"}}} +"}}} " #wordpress.vim{{{ " doesn't support universal ctags " #Plug 'dsawardekar/wordpress.vim' @@ -235,18 +236,18 @@ Plug 'shawncplus/phpcomplete.vim' " https://github.com/DArcMattr/wordpress.vim/tree/universal-ctags " Using studio-vx fork Plug 'studio-vx/wordpress.vim', { 'branch': 'universal-ctags' } -"}}} +"}}} " #vim-commentary{{{ " https://github.com/tpope/vim-commentary Plug 'tpope/vim-commentary' -"}}} +"}}} " #vim-repeat{{{ " https://github.com/tpope/vim-repeat Plug 'tpope/vim-repeat' -"}}} +"}}} " #emmet-vim {{{ " https://github.com/mattn/emmet-vim Plug 'mattn/emmet-vim' @@ -257,31 +258,27 @@ let g:user_emmet_settings = { \ 'indentation': ' ', \ } \} -"}}} +"}}} " #vimwiki {{{ " https://github.com/vimwiki/vimwiki Plug 'vimwiki/vimwiki' let g:vimwiki_list = [{'path': '~/vimwiki/', 'path_html': '~/vimwiki_html/'}] -"}}} +"}}} " #vim-gutentags {{{ " https://github.com/ludovicchabant/vim-gutentags Plug 'ludovicchabant/vim-gutentags' let g:gutentags_ctags_tagfile = '.tags' let g:gutentags_ctags_exclude = ['package.json', 'Session.vim', 'package-lock.json', 'TODO.txt'] + "}}} - -" #vim-qlist -" https://github.com/romainl/vim-qlist/ -" Plug 'romainl/vim-qlist' - " #vim-dispatch{{{ " https://github.com/tpope/vim-dispatch Plug 'tpope/vim-dispatch' -"}}} +"}}} " #colorV {{{ " original: " https://github.com/gu-fan/colorv.vim @@ -316,8 +313,8 @@ function! ToggleColorPreview() abort "{{{ endif endfunction "}}} -"}}} +"}}} " #switch {{{ "https://github.com/AndrewRadev/switch.vim Plug 'AndrewRadev/switch.vim' @@ -331,8 +328,8 @@ let g:switch_custom_definitions = [ \ ['top', 'bottom'], \ ['relative', 'absolute', 'fixed'] \ ] -"}}} +"}}} " #gitgutter {{{ " https://github.com/airblade/vim-gitgutter/blob/master/README.mkd Plug 'airblade/vim-gitgutter' @@ -343,36 +340,36 @@ omap ih GitGutterTextObjectInnerPending omap ah GitGutterTextObjectOuterPending xmap ih GitGutterTextObjectInnerVisual xmap ah GitGutterTextObjectOuterVisual -"}}} +"}}} " #fugitive-vim{{{ " https://github.com/tpope/vim-fugitive/blob/master/README.markdown Plug 'tpope/vim-fugitive' -"}}} +"}}} " #vim-git{{{ " https://github.com/tpope/vim-git Plug 'tpope/vim-git' -"}}} +"}}} " #gitv{{{ " https://github.com/gregsexton/gitv Plug 'gregsexton/gitv' -"}}} +"}}} " #wakatime{{{ " https://wakatime.com/vim Plug 'wakatime/vim-wakatime' -"}}} +"}}} " #vim-easy-align {{{ " https://github.com/junegunn/vim-easy-align Plug 'junegunn/vim-easy-align' xmap ga (EasyAlign) nmap ga (EasyAlign) -"}}} +"}}} " #vim-lsp {{{ " https://github.com/prabirshrestha/vim-lsp Plug 'prabirshrestha/async.vim' @@ -421,8 +418,8 @@ augroup User lsp_setup \ }) endif augroup END -"}}} +"}}} " #inline_edit.vim {{{ " https://github.com/AndrewRadev/inline_edit.vim Plug 'AndrewRadev/inline_edit.vim' @@ -441,42 +438,39 @@ let g:inline_edit_new_buffer_command ='tabedit' let g:inline_edit_modify_statusline = 0 nnoremap ie :InlineEdit -"}}} -" Netrw {{{ +"}}} +" #Netrw {{{ let g:netrw_liststyle=3 let g:netrw_list_hide='^\..*' let g:netrw_preview = 0 -"}}} +"}}} " #Activity Watch #aw-watcher-vim{{{ " https://github.com/ActivityWatch/aw-watcher-vim Plug 'ActivityWatch/aw-watcher-vim' -"}}} +"}}} call plug#end() runtime macros/matchit.vim -"}}} - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - +"----------------------------------------------------------------------------}}} " #functions {{{ function! DoInsertEnter() "{{{ " call SetColor('LineNr', '#262626', '', '#cccccc', '', '') " call SetColor('CursorLineNr', '#bcbcbc', '', '#999999', '', 'bold') endfunction -"}}} +"}}} function! DoInsertLeave() "{{{ " call SetColor('LineNr', '#3a3a3a', '', '#999999', '', '') " call SetColor('CursorLineNr', '#767676', '', '#777777', '', 'bold') endfunction -"}}} +"}}} function! SetColor(name, fg, bg, fg_l, bg_l, style) abort"{{{ if &background ==? 'dark' @@ -557,16 +551,18 @@ function! SetColor(name, fg, bg, fg_l, bg_l, style) abort"{{{ execute 'hi clear ' . a:name execute l:histring -endfunction"}}} +endfunction +"}}} function! GetStatusFrag(condition, colorname, conditionprefix, text) abort "{{{ " TODO better name let l:frag='%#' . a:colorname . '#' let l:frag.=a:conditionprefix let l:frag.='%{(' . a:condition . ")?'" . a:text . "':''}" return l:frag -endfunction"}}} +endfunction +"}}} function! MyFoldText() "{{{ if !exists('g:foldtext_column') let g:foldtext_column = 80 " column to right align foldtext with @@ -606,8 +602,9 @@ function! MyFoldText() "{{{ endif return l:foldtext -endfunction"}}} +endfunction +"}}} function! IndentFoldTextColumn(amount) abort "{{{ if !exists('g:foldtext_column') " column to right align foldtext with @@ -638,16 +635,16 @@ endfunction nnoremap z, :call IndentFoldTextColumn(-5 * (v:count == 0 ? 1 : v:count)) nnoremap z. :call IndentFoldTextColumn(5 * (v:count == 0 ? 1 : v:count)) nnoremap z= :call IndentFoldTextColumn(0) -"}}} +"}}} function! SyntaxItem() abort "{{{ " get name of syntax item return synIDattr(synID(line('.'),col('.'),1),'name') . ' -> ' . synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name' ) endfunction nnoremap pp :echom SyntaxItem() -"}}} +"}}} function! s:Get_env() abort "{{{ " devdocs DD " https://gist.github.com/romainl/8d3b73428b4366f75a19be2dad2f0987#file-devdocs-vim @@ -666,8 +663,8 @@ let s:stub = s:cmds[Get_env()] . " 'http://devdocs.io/?q=" command! -nargs=* DD silent! call system(len(split(, ' ')) == 0 ? \ s:stub . &ft . ' ' . expand('') . "'" : len(split(, ' ')) == 1 ? \ s:stub . &ft . ' ' . . "'" : s:stub . . "'") -"}}} +"}}} if !exists('*RangerExplorer') "{{{ " use ranger as file manager function RangerExplorer() abort @@ -680,15 +677,15 @@ if !exists('*RangerExplorer') "{{{ endfun map ra :call RangerExplorer() endif -"}}} +"}}} function! SetColorColumn() abort"{{{ if &buftype == '' setlocal colorcolumn=80,120 endif endfunction -"}}} +"}}} function! GetLinterStatus(key) abort "{{{ let l:statuscount = 0 @@ -704,8 +701,8 @@ function! GetLinterStatus(key) abort "{{{ endif return l:statuscount endfunction -"}}} +"}}} function! s:RunShellCommand(cmdline) abort"{{{ " Shell command " http://vim.wikia.com/wiki/VimTip1599 @@ -761,8 +758,8 @@ endfunction command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand() let g:shell_scratch_buffer_nr = -1 -"}}} +"}}} function! GetDiagnosticCountsFromSigns(buffer) abort "{{{ let l:error = 0 let l:warn = 0 @@ -793,8 +790,8 @@ function! GetDiagnosticCountsFromSigns(buffer) abort "{{{ return {'error': l:error, 'warning': l:warn, 'info': l:info, 'hint': l:hint} endfunction -"}}} +"}}} function! SaveAndExecute(ex_command) abort "{{{ " https://stackoverflow.com/a/40195855 " ex_command: command to run to execute file @@ -848,8 +845,8 @@ function! SaveAndExecute(ex_command) abort "{{{ setlocal readonly " setlocal nomodifiable endfunction -"}}} +"}}} function! JsIncludeExpr(file)"{{{ " substitute(substitute(v:fname,'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','') @@ -857,12 +854,11 @@ function! JsIncludeExpr(file)"{{{ return substitute(substitute(a:file,'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','') -endfunction"}}} +endfunction "}}} -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - +"----------------------------------------------------------------------------}}} " #settings {{{ scriptencoding utf-8 set ttyfast @@ -923,22 +919,6 @@ set spelllang=en_gb set dictionary+=/usr/share/dict/brit-a-z.txt,/usr/share/dict/britcaps.txt set thesaurus+=/usr/share/dict/mthesaur.txt -" function! GetGitRoot() abort -" let gitroot=system("git rev-parse --show-toplevel") -" if gitroot=~?"^fatal" -" let gitstring = system("echo ${PWD/#$HOME/'~'}") . "/" -" let gitstring .= expand("%t") -" else -" let gitstring = system("echo ${PWD/#$HOME/'~'}") . "/" -" let gitstring .= expand("%t") -" let gitstring .= " [ " . system("git branch | grep '*' | cut -d ' ' -f2") -" let gitstring .= " ] ( " . system('basename "' . gitroot . '"') . " )" -" endif -" return gitstring -" endfunction -" let &titlestring="%{GetGitRoot()}" -" set title - set tabstop=8 set softtabstop=2 set shiftwidth=2 @@ -982,10 +962,7 @@ set mouse=a set listchars=eol:¬,tab:>-,trail:~,extends:>,precedes:<,space:· set foldtext=MyFoldText() -"}}} - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - +"----------------------------------------------------------------------------}}} " #mappings {{{ let g:mapleader = ' ' @@ -1017,7 +994,6 @@ nnoremap dd :DD nnoremap bx :w\|bd "}}} - " git mappings {{{ nnoremap gs :Gstatus nnoremap gd :Gdiff @@ -1031,14 +1007,14 @@ nnoremap gp :!clear; echo 'git push'; git push " nnoremap gp :Gpush " nnoremap gp :pedit | read ! echo 'git push'; git push nnoremap gl :Glog -"}}} +"}}} " netrw {{{ nnoremap ex :Ex nnoremap ee :e . nnoremap eq :Rex -"}}} +"}}} " better window/tab/buffer navigation/management {{{ nnoremap j :resize -5 nnoremap k :resize +5 @@ -1046,7 +1022,6 @@ nnoremap l :vertical resize +5 nnoremap h :vertical resize -5 "}}} - "location list and quickfix mappings {{{ nnoremap lo :botright lwindow nnoremap :lprevzv @@ -1063,15 +1038,15 @@ nnoremap qc :cclose nnoremap qh :chistory nnoremap qp :colder nnoremap qn :cnewer -"}}} +"}}} " insert mode mappings {{{ inoremap jkrg :reg inoremap :w :w inoremap [:w :w inoremap {:w :w -"}}} +"}}} " brace/quotes completion {{{ inoremap {{ {} inoremap { {}O @@ -1097,18 +1072,18 @@ inoremap '; ''; "}}} "}}} -"}}} - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - +"----------------------------------------------------------------------------}}} " #abbreviations {{{ + +" spelling"{{{ iabbrev adn and iabbrev waht what iabbrev tehn then iabbrev functin function iabbrev positin position -" css +"}}} +" css{{{ iabbrev pabs; position: absolute; iabbrev pfix; position: fixed; iabbrev prel; position: relative; @@ -1125,8 +1100,7 @@ iabbrev ct'' content-type: ''; "}}} -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - +"----------------------------------------------------------------------------}}} " #autocommands {{{ " persistent folds {{{ @@ -1137,23 +1111,23 @@ augroup AutoSaveFolds " autocmd BufWinEnter ?* silent loadview autocmd BufRead ?* silent loadview augroup END -"}}} +"}}} " Show trailing whitepace and spaces before a tab: {{{ augroup whitespaceerrors autocmd! autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL augroup END -"}}} +"}}} " automatically reload if color scheme file written {{{ " augroup coloreload " autocmd! " autocmd BufWritePost customred256.vim so $MYVIMRC " augroup end " -"}}} +"}}} " line numbering {{{ augroup linenumbering autocmd! @@ -1165,8 +1139,8 @@ augroup linenumbering autocmd CmdlineLeave * :set number relativenumber " see 'mapping nnoremap :' for setting norelative number. augroup END -"}}} +"}}} " WinEnter, WinLeave {{{ augroup windowenteringleaving autocmd! @@ -1175,8 +1149,8 @@ augroup windowenteringleaving autocmd WinLeave * setlocal colorcolumn=0 autocmd WinLeave * set nocursorline | set nocursorcolumn augroup END -"}}} +"}}} " InsertEnter, InsertLeave {{{ augroup insertenterleave au! @@ -1184,25 +1158,23 @@ augroup insertenterleave au InsertLeave * call DoInsertLeave() augroup END +"}}} " Automatically reload .vimrc if chanaged {{{ augroup myvimrc autocmd! autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif augroup END -"}}} +"}}} " Open qfix after grepping {{{ augroup qfixopen autocmd! autocmd QuickFixCmdPost *grep* botright cwindow augroup END -"}}} -" }}} "}}} -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - +"----------------------------------------------------------------------------}}} " #statusline {{{ set statusline=%!GetStatus(1) @@ -1442,10 +1414,7 @@ augroup status "{{{ augroup END "}}} -"}}} - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - +"----------------------------------------------------------------------------}}} " #tabline {{{ if exists('+showtabline') @@ -1519,9 +1488,7 @@ if exists('+showtabline') hi def link TabLineNumSel TabLineSel endif " exists("+showtabline") -"}}} - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"----------------------------------------------------------------------------}}} " vim: set foldmethod=marker: