Mercurial > vim
annotate runtime/indent/sass.vim @ 10410:783a75eca83a v8.0.0099
commit https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 24 17:47:07 2016 +0100
patch 8.0.0099
Problem: Popup menu always appears above the cursor when it is in the lower
half of the screen. (Matt Gardner)
Solution: Compute the available space better. (Hirohito Higashi,
closes #1241)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 24 Nov 2016 18:00:05 +0100 |
parents | 43efa4f5a8ea |
children | 63b0b7b79b25 |
rev | line source |
---|---|
1668 | 1 " Vim indent file |
2202 | 2 " Language: Sass |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
4 " Last Change: 2016 Aug 29 |
1668 | 5 |
6 if exists("b:did_indent") | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
11 setlocal autoindent sw=2 et | |
12 setlocal indentexpr=GetSassIndent() | |
13 setlocal indentkeys=o,O,*<Return>,<:>,!^F | |
14 | |
15 " Only define the function once. | |
16 if exists("*GetSassIndent") | |
17 finish | |
18 endif | |
19 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
20 let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)' |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
21 let s:extend = '^\s*\%(@extend\|@include\|+\)' |
1668 | 22 |
23 function! GetSassIndent() | |
24 let lnum = prevnonblank(v:lnum-1) | |
25 let line = substitute(getline(lnum),'\s\+$','','') | |
26 let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') | |
27 let lastcol = strlen(line) | |
28 let line = substitute(line,'^\s\+','','') | |
29 let indent = indent(lnum) | |
30 let cindent = indent(v:lnum) | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
31 if line !~ s:property && line !~ s:extend && cline =~ s:property |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
32 return indent + (exists('*shiftwidth') ? shiftwidth() : &sw) |
1668 | 33 else |
34 return -1 | |
35 endif | |
36 endfunction | |
37 | |
38 " vim:set sw=2: |