| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | " Vim indent file | 
					
						
							| 
									
										
										
										
											2021-10-04 21:32:54 +01:00
										 |  |  | " Language:		readline configuration file | 
					
						
							|  |  |  | " Maintainer:		Doug Kearns <dougkearns@gmail.com> | 
					
						
							|  |  |  | " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | 
					
						
							|  |  |  | " Last Change:		24 Sep 2021 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if exists("b:did_indent") | 
					
						
							|  |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | let b:did_indent = 1 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | setlocal indentexpr=GetReadlineIndent() | 
					
						
							|  |  |  | setlocal indentkeys=!^F,o,O,=$else,=$endif | 
					
						
							| 
									
										
										
										
											2007-05-10 19:30:25 +00:00
										 |  |  | setlocal nosmartindent | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-04 21:32:54 +01:00
										 |  |  | let b:undo_indent = "setl inde< indk< si<" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | if exists("*GetReadlineIndent") | 
					
						
							|  |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function GetReadlineIndent() | 
					
						
							|  |  |  |   let lnum = prevnonblank(v:lnum - 1) | 
					
						
							|  |  |  |   if lnum == 0 | 
					
						
							|  |  |  |     return 0 | 
					
						
							|  |  |  |   endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   let ind = indent(lnum) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-06-29 22:40:58 +00:00
										 |  |  |   if getline(lnum) =~ '^\s*$\(if\|else\)\>' | 
					
						
							| 
									
										
										
										
											2017-03-16 17:41:02 +01:00
										 |  |  |     let ind = ind + shiftwidth() | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |   endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-06-29 22:40:58 +00:00
										 |  |  |   if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>' | 
					
						
							| 
									
										
										
										
											2017-03-16 17:41:02 +01:00
										 |  |  |     let ind = ind - shiftwidth() | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |   endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return ind | 
					
						
							|  |  |  | endfunction |