diff options
author | Akshay <[email protected]> | 2020-11-20 05:52:10 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2020-11-20 05:52:10 +0000 |
commit | 54062528662142f27cb039992fe8e36e30da87db (patch) | |
tree | 1cde45bf6c036f8b2a86f6e26f017c55dfea02a5 /nvim/.config/nvim | |
parent | 4c7b6751ee381993e448ab43766555bf178ae28c (diff) |
factor out textobjs into a plugin
Diffstat (limited to 'nvim/.config/nvim')
-rw-r--r-- | nvim/.config/nvim/init.vim | 4 | ||||
-rw-r--r-- | nvim/.config/nvim/plugin/textobjs.vim | 27 | ||||
-rw-r--r-- | nvim/.config/nvim/syntax/kotlin.vim | 139 |
3 files changed, 141 insertions, 29 deletions
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index d748fa6..ebe7ad2 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim | |||
@@ -9,8 +9,6 @@ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |||
9 | Plug 'junegunn/fzf.vim' | 9 | Plug 'junegunn/fzf.vim' |
10 | Plug 'mattn/emmet-vim', {'for': ['javascript.jsx', 'html', 'css']} | 10 | Plug 'mattn/emmet-vim', {'for': ['javascript.jsx', 'html', 'css']} |
11 | Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}, 'branch': 'release'} | 11 | Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}, 'branch': 'release'} |
12 | Plug 'wellle/targets.vim' | ||
13 | Plug 'editorconfig/editorconfig-vim' | ||
14 | Plug 'vimwiki/vimwiki' | 12 | Plug 'vimwiki/vimwiki' |
15 | 13 | ||
16 | " tpope | 14 | " tpope |
@@ -26,7 +24,9 @@ Plug 'neovimhaskell/haskell-vim', {'for': ['haskell', 'cabal']} | |||
26 | Plug 'elmcast/elm-vim' | 24 | Plug 'elmcast/elm-vim' |
27 | Plug 'LnL7/vim-nix' | 25 | Plug 'LnL7/vim-nix' |
28 | 26 | ||
27 | " my stuff | ||
29 | Plug 'git@ferrn:vim/vim-colors-plain' | 28 | Plug 'git@ferrn:vim/vim-colors-plain' |
29 | Plug 'git@ferrn:vim/better-text-objs' | ||
30 | 30 | ||
31 | call plug#end() | 31 | call plug#end() |
32 | 32 | ||
diff --git a/nvim/.config/nvim/plugin/textobjs.vim b/nvim/.config/nvim/plugin/textobjs.vim deleted file mode 100644 index 16f9a46..0000000 --- a/nvim/.config/nvim/plugin/textobjs.vim +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | " line text-objects | ||
2 | xnoremap il g_o^ | ||
3 | onoremap il :normal vil<CR> | ||
4 | xnoremap al $o0 | ||
5 | onoremap al :normal val<CR> | ||
6 | |||
7 | " buffer text-objects | ||
8 | " ------------------- | ||
9 | " i% a% | ||
10 | xnoremap i% :<C-u>let z = @/\|1;/^./kz<CR>G??<CR>:let @/ = z<CR>V'z | ||
11 | onoremap i% :normal vi%<CR> | ||
12 | xnoremap a% GoggV | ||
13 | onoremap a% :normal va%<CR> | ||
14 | |||
15 | " comment text-objects | ||
16 | " -------------------- | ||
17 | " i? a? | ||
18 | xnoremap <buffer> i? ?/\*<CR>o/\*\/<CR> | ||
19 | onoremap <buffer> i? :normal vi?<CR> | ||
20 | |||
21 | " square brackets text-objects | ||
22 | " ---------------------------- | ||
23 | " ir ar | ||
24 | xnoremap ir i[ | ||
25 | xnoremap ar a[ | ||
26 | onoremap ir :normal vi[<CR> | ||
27 | onoremap ar :normal va[<CR> | ||
diff --git a/nvim/.config/nvim/syntax/kotlin.vim b/nvim/.config/nvim/syntax/kotlin.vim new file mode 100644 index 0000000..48fc6ce --- /dev/null +++ b/nvim/.config/nvim/syntax/kotlin.vim | |||
@@ -0,0 +1,139 @@ | |||
1 | " Vim syntax file | ||
2 | " Language: Kotlin | ||
3 | " Maintainer: Alexander Udalov | ||
4 | " Latest Revision: 13 July 2020 | ||
5 | |||
6 | if exists('b:current_syntax') | ||
7 | finish | ||
8 | endif | ||
9 | |||
10 | syn keyword ktStatement break continue return | ||
11 | syn keyword ktConditional if else when | ||
12 | syn keyword ktRepeat do for while | ||
13 | syn keyword ktOperator in is by | ||
14 | syn keyword ktKeyword get set out super this where | ||
15 | syn keyword ktException try catch finally throw | ||
16 | |||
17 | syn keyword ktInclude import package | ||
18 | |||
19 | " The following is generated by generate-stdlib-class-names.main.kts | ||
20 | syn keyword ktType AbstractCollection AbstractCoroutineContextElement AbstractCoroutineContextKey AbstractDoubleTimeSource AbstractIterator AbstractList AbstractLongTimeSource | ||
21 | syn keyword ktType AbstractMap AbstractMutableCollection AbstractMutableList AbstractMutableMap AbstractMutableSet AbstractSet AccessDeniedException Accessor Annotation | ||
22 | syn keyword ktType AnnotationRetention AnnotationTarget Any Appendable ArithmeticException Array ArrayDeque ArrayList AssertionError Boolean BooleanArray BooleanIterator | ||
23 | syn keyword ktType BuilderInference Byte ByteArray ByteIterator CallsInPlace CancellationException Char CharArray CharCategory CharDirectionality CharIterator CharProgression | ||
24 | syn keyword ktType CharRange CharSequence CharacterCodingException Charsets ClassCastException Cloneable ClosedFloatingPointRange ClosedRange Collection Comparable Comparator | ||
25 | syn keyword ktType ConcurrentModificationException ConditionalEffect Continuation ContinuationInterceptor ContractBuilder CoroutineContext DeepRecursiveFunction DeepRecursiveScope | ||
26 | syn keyword ktType Delegates Deprecated DeprecatedSinceKotlin DeprecationLevel Destructured Double DoubleArray DoubleIterator DslMarker Duration DurationUnit Effect Element | ||
27 | syn keyword ktType EmptyCoroutineContext Entry Enum Error Exception Experimental ExperimentalContracts ExperimentalJsExport ExperimentalMultiplatform ExperimentalStdlibApi | ||
28 | syn keyword ktType ExperimentalTime ExperimentalTypeInference ExperimentalUnsignedTypes ExtensionFunctionType FileAlreadyExistsException FileSystemException FileTreeWalk | ||
29 | syn keyword ktType FileWalkDirection Float FloatArray FloatIterator Function Function0 Function1 Function10 Function11 Function12 Function13 Function14 Function15 Function16 | ||
30 | syn keyword ktType Function17 Function18 Function19 Function2 Function20 Function21 Function22 Function3 Function4 Function5 Function6 Function7 Function8 Function9 FunctionN | ||
31 | syn keyword ktType Getter Grouping HashMap HashSet IllegalArgumentException IllegalStateException IndexOutOfBoundsException IndexedValue Int IntArray IntIterator IntProgression | ||
32 | syn keyword ktType IntRange InvocationKind Iterable Iterator JsExport JsName JvmDefault JvmDefaultWithoutCompatibility JvmField JvmMultifileClass JvmName JvmOverloads JvmStatic | ||
33 | syn keyword ktType JvmSuppressWildcards JvmSynthetic JvmWildcard KAnnotatedElement KCallable KClass KClassifier KDeclarationContainer KFunction KMutableProperty KMutableProperty0 | ||
34 | syn keyword ktType KMutableProperty1 KMutableProperty2 KParameter KProperty KProperty0 KProperty1 KProperty2 KType KTypeParameter KTypeProjection KVariance KVisibility Key Kind | ||
35 | syn keyword ktType KotlinNullPointerException KotlinReflectionNotSupportedError KotlinVersion Lazy LazyThreadSafetyMode Level LinkedHashMap LinkedHashSet List ListIterator Long | ||
36 | syn keyword ktType LongArray LongIterator LongProgression LongRange Map MatchGroup MatchGroupCollection MatchNamedGroupCollection MatchResult Metadata Monotonic MustBeDocumented | ||
37 | syn keyword ktType MutableCollection MutableEntry MutableIterable MutableIterator MutableList MutableListIterator MutableMap MutableSet NoSuchElementException NoSuchFileException | ||
38 | syn keyword ktType NoWhenBranchMatchedException NotImplementedError Nothing NullPointerException Number NumberFormatException ObservableProperty OnErrorAction OptIn | ||
39 | syn keyword ktType OptionalExpectation OverloadResolutionByLambdaReturnType Pair ParameterName PropertyDelegateProvider PublishedApi PurelyImplements Random RandomAccess | ||
40 | syn keyword ktType ReadOnlyProperty ReadWriteProperty Regex RegexOption Repeatable ReplaceWith RequiresOptIn RestrictsSuspension Result Retention Returns ReturnsNotNull | ||
41 | syn keyword ktType RuntimeException Sequence SequenceScope Set Setter SharedImmutable Short ShortArray ShortIterator SimpleEffect SinceKotlin Strictfp String StringBuilder Suppress | ||
42 | syn keyword ktType Synchronized Target TestTimeSource ThreadLocal Throwable Throws TimeMark TimeSource TimedValue Transient Triple TypeCastException Typography UByte UByteArray | ||
43 | syn keyword ktType UByteIterator UInt UIntArray UIntIterator UIntProgression UIntRange ULong ULongArray ULongIterator ULongProgression ULongRange UShort UShortArray UShortIterator | ||
44 | syn keyword ktType UninitializedPropertyAccessException Unit UnsafeVariance UnsupportedOperationException UseExperimental Volatile | ||
45 | |||
46 | syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic expect actual | ||
47 | syn keyword ktStructure class object interface typealias fun val var constructor init | ||
48 | |||
49 | syn keyword ktReservedKeyword typeof | ||
50 | |||
51 | syn keyword ktBoolean true false | ||
52 | syn keyword ktConstant null | ||
53 | |||
54 | syn keyword ktModifier data tailrec lateinit reified external inline noinline crossinline const operator infix suspend | ||
55 | |||
56 | syn match ktOperator "\v\?:|::|\<\=? | \>\=?|[!=]\=\=?|<as>\??|[-!%&*+/|]" | ||
57 | |||
58 | syn keyword ktTodo TODO FIXME XXX contained | ||
59 | syn match ktShebang "\v^#!.*$" | ||
60 | syn match ktLineComment "\v//.*$" contains=ktTodo,@Spell | ||
61 | syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contains=ktComment,ktTodo,@Spell | ||
62 | |||
63 | syn region ktDocComment start="/\*\*" end="\*/" contains=ktDocTag,ktTodo,@Spell | ||
64 | syn match ktDocTag "\v\@(author|constructor|receiver|return|since|suppress)>" contained | ||
65 | syn match ktDocTag "\v\@(exception|param|property|throws|see|sample)>\s*\S+" contains=ktDocTagParam contained | ||
66 | syn match ktDocTagParam "\v(\s|\[)\S+" contained | ||
67 | syn match ktComment "/\*\*/" | ||
68 | |||
69 | syn match ktSpecialCharError "\v\\." contained | ||
70 | syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained | ||
71 | syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError | ||
72 | syn region ktString start='"""' end='""""*' contains=ktSimpleInterpolation,ktComplexInterpolation | ||
73 | syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError | ||
74 | syn match ktCharacter "\v'\\''" contains=ktSpecialChar | ||
75 | syn match ktCharacter "\v'[^\\]'" | ||
76 | |||
77 | " TODO: highlight label in 'this@Foo' | ||
78 | syn match ktAnnotation "\v(\w)@<!\@[[:alnum:]_.]*(:[[:alnum:]_.]*)?" | ||
79 | syn match ktLabel "\v\w+\@" | ||
80 | |||
81 | syn match ktSimpleInterpolation "\v\$\h\w*" contained | ||
82 | syn region ktComplexInterpolation matchgroup=ktComplexInterpolationBrace start="\v\$\{" end="\v\}" contains=ALLBUT,ktSimpleInterpolation,ktTodo,ktSpecialCharError,ktSpecialChar,ktDocTag,ktDocTagParam | ||
83 | |||
84 | syn match ktNumber "\v<\d+[_[:digit:]]*(uL?|UL?|[LFf])?" | ||
85 | syn match ktNumber "\v<0[Xx]\x+[_[:xdigit:]]*(uL?|UL?|L)?" | ||
86 | syn match ktNumber "\v<0[Bb][01]+[_01]*(uL?|UL?|L)?" | ||
87 | syn match ktFloat "\v<\d*(\d[eE][-+]?\d+|\.\d+([eE][-+]?\d+)?)[Ff]?" | ||
88 | |||
89 | syn match ktEscapedName "\v`.*`" | ||
90 | |||
91 | syn match ktExclExcl "!!" | ||
92 | syn match ktArrow "->" | ||
93 | |||
94 | hi def link ktStatement Statement | ||
95 | hi def link ktConditional Conditional | ||
96 | hi def link ktRepeat Repeat | ||
97 | hi def link ktOperator Operator | ||
98 | hi def link ktKeyword Keyword | ||
99 | hi def link ktException Exception | ||
100 | hi def link ktReservedKeyword Error | ||
101 | |||
102 | hi def link ktInclude Include | ||
103 | |||
104 | hi def link ktType Type | ||
105 | hi def link ktModifier StorageClass | ||
106 | hi def link ktStructure Structure | ||
107 | hi def link ktTypedef Typedef | ||
108 | |||
109 | hi def link ktBoolean Boolean | ||
110 | hi def link ktConstant Constant | ||
111 | |||
112 | hi def link ktTodo Todo | ||
113 | hi def link ktShebang Comment | ||
114 | hi def link ktLineComment Comment | ||
115 | hi def link ktComment Comment | ||
116 | hi def link ktCommentMatchGroup Comment | ||
117 | hi def link ktDocComment Comment | ||
118 | hi def link ktDocTag Special | ||
119 | hi def link ktDocTagParam Identifier | ||
120 | |||
121 | hi def link ktSpecialChar SpecialChar | ||
122 | hi def link ktSpecialCharError Error | ||
123 | hi def link ktString String | ||
124 | hi def link ktCharacter Character | ||
125 | |||
126 | hi def link ktAnnotation Identifier | ||
127 | hi def link ktLabel Identifier | ||
128 | |||
129 | hi def link ktSimpleInterpolation Identifier | ||
130 | hi def link ktComplexInterpolationBrace Identifier | ||
131 | |||
132 | hi def link ktNumber Number | ||
133 | hi def link ktFloat Float | ||
134 | |||
135 | hi def link ktExclExcl Special | ||
136 | hi def link ktArrow Structure | ||
137 | |||
138 | let b:current_syntax = 'kotlin' | ||
139 | |||