-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
editing.lua
85 lines (80 loc) · 2.34 KB
/
editing.lua
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
return {
{
'kylechui/nvim-surround',
keys = { 'ys', 'cs', 'ds' },
opts = {},
},
{
'ggandor/leap.nvim',
config = function()
require('leap').set_default_keymaps()
end,
},
{
'numToStr/Comment.nvim',
keys = {
{ 'gc', mode = { 'n', 'v' }, 'gcc' },
},
opts = {
pre_hook = function(ctx)
return require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook()(ctx)
end,
},
},
{
'JoosepAlviste/nvim-ts-context-commentstring',
ft = { 'typescriptreact' },
opts = {
enable_autocmd = false,
},
},
{
'axelvc/template-string.nvim',
opts = {
filetypes = { 'typescript', 'javascript', 'typescriptreact', 'javascriptreact', 'vue' },
remove_template_string = true,
restore_quotes = {
normal = [[']],
jsx = [["]],
},
},
event = 'InsertEnter',
ft = { 'typescript', 'javascript', 'typescriptreact', 'javascriptreact', 'vue' },
},
{ 'echasnovski/mini.pairs', version = false, opts = {} },
{
'echasnovski/mini.ai',
dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' },
config = function()
local treesitter = require('mini.ai').gen_spec.treesitter
require('mini.ai').setup {
custom_textobjects = {
-- Whole buffer
e = function()
local from = { line = 1, col = 1 }
local to = {
line = vim.fn.line '$',
col = math.max(vim.fn.getline('$'):len(), 1),
}
return { from = from, to = to }
end,
-- Current line
j = function(args)
local index_of_first_non_whitespace_character = string.find(vim.fn.getline '.', '%S')
local col = args == 'i' and index_of_first_non_whitespace_character or 1
return {
from = { line = vim.fn.line '.', col = col },
to = { line = vim.fn.line '.', col = math.max(vim.fn.getline('.'):len(), 1) },
}
end,
-- Function definition (needs treesitter queries with these captures)
m = treesitter { a = '@function.outer', i = '@function.inner' },
o = treesitter {
a = { '@conditional.outer', '@loop.outer' },
i = { '@conditional.inner', '@loop.inner' },
},
},
}
end,
},
}