-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvim-backslash.txt
86 lines (69 loc) · 2.4 KB
/
vim-backslash.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
*vim-backslash.txt* Automatically insert a leading slash in Vim script
Author: Alisue <lambdalisue@hashnote.net>
License: MIT license
=============================================================================
CONTENTS *vim-backslask-contents*
INTRODUCTION |vim-backslask-introduction|
USAGE |vim-backslask-usage|
INTERFACE |vim-backslask-interface|
VARIABLE |vim-backslask-variable|
=============================================================================
INTRODUCTION *vim-backslask-introduction*
*vim-backslask* is a filetype plugin to automatically insert a
leading backslash to continue expression in in Vim script.
=============================================================================
USAGE *vim-backslask-usage*
Assume "|" indicate the cursor in the following content:
>
let foobar = [
\ 'foo',|
<
The |o| in a normal mode or |i_<CR>| in an insert mode makes the content like:
>
let foobar = [
\ 'foo',
\ |
<
And when the line contains only whitespaces and "\" like:
>
let foobar = line('.') ==# 'Hello'
\ ? 'Good bye'
\ : 'Foobar'
\ |
<
Hitting |o| or |i_<CR>| remove the leading spaces and "\" like:
>
let foobar = line('.') ==# 'Hello'
\ ? 'Good bye'
\ : 'Foobar'
|
<
Note that this plugin care about g:vim_indent_cont which is used in
$VIMRUNTIME/indent/vim.vim
Use |g:vim_backslash_disable_default_mappings| to disable default mappings.
=============================================================================
INTERFACE *vim-backslask-interface*
-----------------------------------------------------------------------------
VARIABLE *vim-backslask-variable*
*g:vim_backslask_disable_default_mappings*
Set 1 to disable default mappings.
Default: 0
*g:vim_backslash#preventers*
A |List| of |Function| which is called prior to determine if backslash
is required or not. Return 1 to prevent automatic backslash insertion.
For example, use it to prevent backslash insertion in non vim context
with https://github.com/Shougo/context_filetype.vim like
>
let g:vim_backslash#preventers = [
\ { -> context_filetype#get_filetype() !=# 'vim' },
\]
<
Then no automatic backslash insertion will invoked if the cursor is on
non vim context like below:
>
python <<EOF
foo = {|}
EOF
<
=============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl