-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
135 lines (134 loc) · 4.11 KB
/
init.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
return {
plugins = {
{
"github/copilot.vim",
lazy = false,
config = function()
vim.g.copilot_no_tab_map = true
vim.g.copilot_filetypes = { yaml = true }
local keymap = vim.keymap.set
-- https://github.com/orgs/community/discussions/29817#discussioncomment-4217615
keymap("i", "<C-g>", 'copilot#Accept("<CR>")',
{ silent = true, expr = true, script = true, replace_keycodes = false })
keymap("i", "<C-j>", "<Plug>(copilot-next)")
keymap("i", "<C-k>", "<Plug>(copilot-previous)")
keymap("i", "<C-o>", "<Plug>(copilot-dismiss)")
keymap("i", "<C-s>", "<Plug>(copilot-suggest)")
end
},
{
"neo-tree.nvim",
opts = function()
return {
filesystem = {
window = {
mappings = {
-- disable fuzzy finder
["/"] = "noop",
-- Jump to current nodes parent
-- like `p` in NERDTree Mappings
["P"] = function(state)
local tree = state.tree
local node = tree:get_node()
local parent_node = tree:get_node(node:get_parent_id())
local renderer = require("neo-tree.ui.renderer")
renderer.redraw(state)
renderer.focus_node(state, parent_node:get_id())
end,
["T"] = { "toggle_preview", config = { use_float = true } },
}
},
filtered_items = {
visible = true,
hide_dotfiles = false
}
}
}
end
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- list like portions of a table cannot be merged naturally and require the user to merge it manually
-- check to make sure the key exists
if not opts.ensure_installed then
opts.ensure_installed = {}
end
vim.list_extend(opts.ensure_installed, {
"go",
"gomod",
"gosum",
"gotmpl",
"html",
"java",
"jq",
"json",
"scala",
"sql",
"terraform",
"yaml"
})
end
},
{
"rebelot/heirline.nvim",
opts = function(_, opts)
local status = require("astronvim.utils.status")
opts.statusline = {
-- statusline
hl = { fg = "fg", bg = "bg" },
status.component.mode { mode_text = { padding = { left = 1, right = 1 } } },
status.component.git_branch(),
status.component.separated_path {
max_depth = 1000,
path_func = status.provider.filename { modify = ":.:h" },
separator = "/"
},
status.component.file_info {
filename = {
fallback = "Empty",
},
filetype = false,
file_modified = false
},
status.component.git_diff(),
status.component.diagnostics(),
status.component.fill(),
status.component.cmd_info(),
status.component.fill(),
status.component.lsp(),
status.component.treesitter(),
status.component.nav(),
status.component.mode { surround = { separator = "right" } },
}
end
},
{
"rust-lang/rust.vim",
lazy = false,
config = function()
vim.g.rustfmt_autosave = 1
end
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
}
},
-- This function is run last
-- good place to configure mappings and vim options
polish = function()
-- Set autocommands
vim.api.nvim_create_autocmd("VimEnter", {
command = "Neotree toggle",
})
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = '*.go',
callback = function()
vim.lsp.buf.code_action({ context = { only = { 'source.organizeImports' } }, apply = true })
end
})
end
}