mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 03:53:52 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29ec69ffa0 | ||
|
|
6636144497 | ||
|
|
2a205569eb | ||
|
|
114f731483 | ||
|
|
4b8687ebca | ||
|
|
78f6c8f318 | ||
|
|
86bf33aa3b | ||
|
|
b64fcedd82 |
1199
extras/menu.vim
Normal file
1199
extras/menu.vim
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2545,7 +2545,7 @@ if !has_key(s:disabled_packages, 'alsaconf')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if !has_key(s:disabled_packages, 'conf')
|
if !has_key(s:disabled_packages, 'conf')
|
||||||
au BufNewFile,BufRead *.conf,auto.master,config setf conf
|
au BufNewFile,BufRead *.conf,*/etc/hosts,auto.master,config setf conf
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !has_key(s:disabled_packages, 'master')
|
if !has_key(s:disabled_packages, 'master')
|
||||||
@@ -2634,6 +2634,10 @@ if !has_key(s:disabled_packages, 'autoindent')
|
|||||||
" Code below re-implements sleuth for vim-polyglot
|
" Code below re-implements sleuth for vim-polyglot
|
||||||
let g:loaded_sleuth = 1
|
let g:loaded_sleuth = 1
|
||||||
|
|
||||||
|
if &tabstop == 8
|
||||||
|
let &tabstop = 2
|
||||||
|
endif
|
||||||
|
|
||||||
func! s:get_shiftwidth(indents) abort
|
func! s:get_shiftwidth(indents) abort
|
||||||
let shiftwidth = 0
|
let shiftwidth = 0
|
||||||
let max_count = 0
|
let max_count = 0
|
||||||
@@ -2657,9 +2661,8 @@ if !has_key(s:disabled_packages, 'autoindent')
|
|||||||
let minindent = 10
|
let minindent = 10
|
||||||
let spaces_minus_tabs = 0
|
let spaces_minus_tabs = 0
|
||||||
let lineno = 0
|
let lineno = 0
|
||||||
|
let stack = [0]
|
||||||
let indents = { '2': 0, '3': 0, '4': 0, '6': 0, '8': 0 }
|
let indents = { '2': 0, '3': 0, '4': 0, '6': 0, '8': 0 }
|
||||||
let next_indent_lineno = 1
|
|
||||||
let prev_indent = 0
|
|
||||||
|
|
||||||
for line in a:lines
|
for line in a:lines
|
||||||
let lineno += 1
|
let lineno += 1
|
||||||
@@ -2731,18 +2734,28 @@ if !has_key(s:disabled_packages, 'autoindent')
|
|||||||
if line[0] == "\t"
|
if line[0] == "\t"
|
||||||
let spaces_minus_tabs -= 1
|
let spaces_minus_tabs -= 1
|
||||||
else
|
else
|
||||||
|
if line[0] == " "
|
||||||
let spaces_minus_tabs += 1
|
let spaces_minus_tabs += 1
|
||||||
|
endif
|
||||||
let indent = len(matchstr(line, '^ *'))
|
let indent = len(matchstr(line, '^ *'))
|
||||||
let indent_inc = abs(indent - prev_indent)
|
while stack[-1] > indent
|
||||||
|
call remove(stack, -1)
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
let indent_inc = indent - stack[-1]
|
||||||
|
|
||||||
|
if indent_inc == 0 && len(stack) > 1
|
||||||
|
let indent_inc = indent - stack[-2]
|
||||||
|
endif
|
||||||
|
|
||||||
if indent_inc > 0 && lineno == next_indent_lineno
|
|
||||||
if has_key(indents, indent_inc)
|
if has_key(indents, indent_inc)
|
||||||
let indents[indent_inc] += 1
|
let indents[indent_inc] += 1
|
||||||
endif
|
let prev_indent = indent
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let next_indent_lineno = lineno + 1
|
if stack[-1] != indent
|
||||||
let prev_indent = indent
|
call add(stack, indent)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@@ -2757,9 +2770,7 @@ if !has_key(s:disabled_packages, 'autoindent')
|
|||||||
if shiftwidth > 0
|
if shiftwidth > 0
|
||||||
setlocal expandtab
|
setlocal expandtab
|
||||||
let &l:shiftwidth=shiftwidth
|
let &l:shiftwidth=shiftwidth
|
||||||
if &tabstop == 8
|
let &l:softtabstop=shiftwidth
|
||||||
let &l:tabstop=shiftwidth
|
|
||||||
endif
|
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -2771,18 +2782,13 @@ if !has_key(s:disabled_packages, 'autoindent')
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if &expandtab
|
" Do not autodetect indent if language sets it
|
||||||
" Make tabstop to be synchronized with shiftwidth by default
|
if &l:shiftwidth != &g:shiftwidth
|
||||||
" Some plugins are using &shiftwidth directly or accessing &tabstop
|
return
|
||||||
if &tabstop != 8 || &shiftwidth == 0
|
|
||||||
let &shiftwidth = &tabstop
|
|
||||||
else
|
|
||||||
let &tabstop = &shiftwidth
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:sleuth_culprit = expand("<afile>:p")
|
let b:sleuth_culprit = expand("<afile>:p")
|
||||||
if s:guess(getline(1, 64))
|
if s:guess(getline(1, 128))
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
if s:guess(getline(1, 1024))
|
if s:guess(getline(1, 1024))
|
||||||
@@ -2819,12 +2825,6 @@ if !has_key(s:disabled_packages, 'autoindent')
|
|||||||
let level -= 1
|
let level -= 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
setlocal expandtab
|
|
||||||
let &l:shiftwidth = 2
|
|
||||||
if &tabstop == 8
|
|
||||||
let &l:tabstop = 2
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:sleuth_culprit = "default"
|
let b:sleuth_culprit = "default"
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|||||||
@@ -1958,6 +1958,7 @@ filetypes:
|
|||||||
filenames:
|
filenames:
|
||||||
- auto.master
|
- auto.master
|
||||||
- config
|
- config
|
||||||
|
- '*/etc/hosts'
|
||||||
---
|
---
|
||||||
name: b
|
name: b
|
||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
|
|||||||
Reference in New Issue
Block a user