Mercurial > vim
annotate runtime/indent/sass.vim @ 29688:1455814702ad v9.0.0184
patch 9.0.0184: virtual text prop highlight continues after truncation
Commit: https://github.com/vim/vim/commit/1d8844aa59416dd306912b5563b8e928dfd387ba
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 10 13:39:35 2022 +0100
patch 9.0.0184: virtual text prop highlight continues after truncation
Problem: Virtual text prop highlight continues after truncation.
Solution: Recompute the length of attributes.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 10 Aug 2022 14:45:02 +0200 |
parents | dce918af0c00 |
children | 92fd65eac53a |
rev | line source |
---|---|
1668 | 1 " Vim indent file |
2202 | 2 " Language: Sass |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
28141 | 4 " Last Change: 2022 Mar 15 |
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 | |
28141 | 15 let b:undo_indent = "setl ai< inde< indk<" |
16 | |
1668 | 17 " Only define the function once. |
18 if exists("*GetSassIndent") | |
19 finish | |
20 endif | |
21 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
22 let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)' |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
23 let s:extend = '^\s*\%(@extend\|@include\|+\)' |
1668 | 24 |
25 function! GetSassIndent() | |
26 let lnum = prevnonblank(v:lnum-1) | |
27 let line = substitute(getline(lnum),'\s\+$','','') | |
28 let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') | |
29 let lastcol = strlen(line) | |
30 let line = substitute(line,'^\s\+','','') | |
31 let indent = indent(lnum) | |
32 let cindent = indent(v:lnum) | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
33 if line !~ s:property && line !~ s:extend && cline =~ s:property |
11518 | 34 return indent + shiftwidth() |
1668 | 35 else |
36 return -1 | |
37 endif | |
38 endfunction | |
39 | |
40 " vim:set sw=2: |