annotate runtime/indent/chatito.vim @ 30799:ffa5492137c3 v9.0.0734

patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll' Commit: https://github.com/vim/vim/commit/2fbabd238a94022c99506e920186a5b6cdf15426 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Oct 12 19:53:38 2022 +0100 patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll' Problem: Cursor position invalid when scrolling with 'smoothscroll' set. (Ernie Rael) Solution: Add w_valid_skipcol and clear flags when it changes. Adjust w_skipcol after moving the cursor.
author Bram Moolenaar <Bram@vim.org>
date Wed, 12 Oct 2022 21:00:05 +0200
parents 1e91e26ceebf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim indent file
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: Chatito
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: ObserverOfTime <chronobserver@disroot.org>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Last Change: 2022 Sep 20
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 if exists('b:did_indent')
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 finish
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 endif
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 let b:did_indent = 1
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 setlocal indentexpr=GetChatitoIndent()
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 setlocal indentkeys=o,O,*<Return>,0#,!^F
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 let b:undo_indent = 'setl inde< indk<'
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 if exists('*GetChatitoIndent')
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 finish
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 endif
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 function GetChatitoIndent()
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 let l:prev = v:lnum - 1
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 if getline(prevnonblank(l:prev)) =~# '^[~%@]\['
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 " shift indent after definitions
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 return shiftwidth()
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 elseif getline(l:prev) !~# '^\s*$'
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 " maintain indent in sentences
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 return indent(l:prev)
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 else
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 " reset indent after a blank line
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 return 0
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 end
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 endfunction