K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / usr / share / vim / vim74 / indent /
server ip : 104.21.89.46

your ip : 172.70.127.59

H O M E


Filename/usr/share/vim/vim74/indent/bst.vim
Size1.87 kb
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 09:56
Last modified03-Jan-2014 03:40
Last accessed06-Jul-2025 12:47
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
" Vim indent file
" Language: bst
" Author: Tim Pope <[email protected]>
" $Id: bst.vim,v 1.1 2007/05/05 18:11:12 vimboss Exp $

if exists("b:did_indent")
finish
endif
let b:did_indent = 1

setlocal expandtab
setlocal indentexpr=GetBstIndent(v:lnum)
"setlocal smartindent
setlocal cinkeys&
setlocal cinkeys-=0#
setlocal indentkeys&
"setlocal indentkeys+=0%

" Only define the function once.
if exists("*GetBstIndent")
finish
endif

function! s:prevgood(lnum)
" Find a non-blank line above the current line.
" Skip over comments.
let lnum = a:lnum
while lnum > 0
let lnum = prevnonblank(lnum - 1)
if getline(lnum) !~ '^\s*%.*$'
break
endif
endwhile
return lnum
endfunction

function! s:strip(lnum)
let line = getline(a:lnum)
let line = substitute(line,'"[^"]*"','""','g')
let line = substitute(line,'%.*','','')
let line = substitute(line,'^\s\+','','')
return line
endfunction

function! s:count(string,char)
let str = substitute(a:string,'[^'.a:char.']','','g')
return strlen(str)
endfunction

function! GetBstIndent(lnum) abort
if a:lnum == 1
return 0
endif
let lnum = s:prevgood(a:lnum)
if lnum <= 0
return indent(a:lnum - 1)
endif
let line = s:strip(lnum)
let cline = s:strip(a:lnum)
if cline =~ '^}' && exists("b:current_syntax")
call cursor(a:lnum,indent(a:lnum))
if searchpair('{','','}','bW',"synIDattr(synID(line('.'),col('.'),1),'name') =~? 'comment\\|string'")
if col('.')+1 == col('$')
return indent('.')
else
return virtcol('.')-1
endif
endif
endif
let fakeline = substitute(line,'^}','','').matchstr(cline,'^}')
let ind = indent(lnum)
let ind = ind + &sw * s:count(line,'{')
let ind = ind - &sw * s:count(fakeline,'}')
return ind
endfunction