]> git.nbdom.net Git - nb.git/commitdiff
etc/vim/source/functions.vim
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 5 Dec 2017 04:46:10 +0000 (04:46 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 5 Dec 2017 04:46:10 +0000 (04:46 +0000)
etc/vim/source/functions.vim

index 3965efdd5263d2b3d82883e30b3c7b50bcf4bf86..e6990922891549453d082d164e76a0cbd6dea643 100644 (file)
@@ -291,131 +291,3 @@ func! VS(...)
    " return system(Cmd)
    return Cmd
 endfunc
-
-func! VimShortcurtsAuto(...)
-   let Cmd = g:Cmd
-   let FilePath = expand('%:p')
-       " return a:1.match(a:1,"_comment_line_toggle")
-       " f (match(a:1,"_comment_line_toggle"))
-        if (a:1 == "Wcomment_line_toggle")
-               " return Cmd
-               let Cmd = 'cat|' . Cmd
-       endif
-
-       setlocal paste
-
-       " return (g:Cmd .' auto_' . a:1 . ' ' . FilePath)
-       return system(g:Cmd .' auto_' . a:1 . ' ' . FilePath)
-
-endfunc
-
-func! VimShortcurtsList()
-" NB 09.11.11  call input('Entry: ')
-       let list = system(g:Cmd .' all_choose')
-       let i = input(list . 'Please choose a number function: ')
-
-       let fct = substitute(list, '^.*\s' . i . '\. \(\w\+\).*$', '\1', '')
-       return fct
-
-       let items = split(list,"\n\t")
-       return items
-       let opt = inputlist(items)
-" NB 09.11.11  call setline(lnum, '" zaza ' . getline(lnum))
-       " echo items[opt]
-       " g:nicoInput = items[opt]
-       return items[opt]
-endfunc
-
-
-" Trim
-function! StrTrim (string)
-       let string=a:string
-       let string = substitute(string, '[\s\t\r\n]\+$', '', '')
-       return string
-endfunction
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Other function copy from examples
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-function! CountSpaces(type, ...)
-
-       let sel_save = &selection
-       let &selection = "inclusive"
-       let reg_save = @@
-
-       if a:0  " Invoked from Visual mode, use '< and '> marks.
-       silent exe "normal! `<" . a:type . "`>y"
-
-       elseif a:type == 'line'
-       silent exe "normal! '[V']y"
-
-       elseif a:type == 'block'
-       silent exe "normal! `[\<C-V>`]y"
-
-       else
-       silent exe "normal! `[v`]y"
-
-       endif
-
-       echomsg strlen(substitute(@@, '[^ ]', '', 'g'))
-
-       let &selection = sel_save
-       let @@ = reg_save
-endfunction
-
-" You can call this function with: :10,30call Count_words()
-func! Count_words() range
-       let lnum = a:firstline
-       let n = 0
-       while lnum <= a:lastline
-               let n = n + len(split(getline(lnum)))
-               let lnum = lnum + 1
-       endwhile
-               echo lnum
-       return "found " . n . " words"
-endfunction
-
-" Capitalize the first letter of each word
-func! Capitalize() range
-       for line_number in range(a:firstline, a:lastline)
-               let line_content = getline(line_number)
-               let line_content = substitute(line_content, "\\w\\+", "\\u\\0", "g")
-               call setline(line_number, line_content)
-       endfor
-endfunction
-
-" Escape special characters in a string for exact matching.
-" This is useful to copying strings from the file to the search tool
-" Based on this - http://peterodding.com/code/vim/profile/autoload/xolox/escape.vim
-function! EscapeString (string)
-       let string=a:string
-       " Escape regex characters
-       let string = escape(string, '^$.*\/~[]')
-       " Escape the line endings
-       let string = substitute(string, '\n', '\\n', 'g')
-       return string
-endfunction
-
-" Get the current visual block for search and replaces
-" This function passed the visual block through a string escape function
-" Based on this - http://stackoverflow.com/questions/676600/vim-replace-selected-text/677918#677918
-function! GetVisual() range
-       " Save the current register and clipboard
-       let reg_save = getreg('"')
-       let regtype_save = getregtype('"')
-       let cb_save = &clipboard
-       set clipboard&
-
-       " Put the current visual selection in the " register
-       normal! ""gvy
-       let selection = getreg('"')
-
-       " Put the saved registers and clipboards back
-       call setreg('"', reg_save, regtype_save)
-       let &clipboard = cb_save
-
-       "Escape any special characters in the selection
-       let escaped_selection = EscapeString(selection)
-
-       return escaped_selection
-endfunction
-