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