generated from AstroNvim/user_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
228 lines (211 loc) · 7.68 KB
/
init.lua
File metadata and controls
228 lines (211 loc) · 7.68 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
return {
-- { "rebelot/heirline.nvim", enabled = false },
-- Configure AstroNvim updates
updater = {
remote = "origin", -- remote to use
channel = "stable", -- "stable" or "nightly"
version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
branch = "nightly", -- branch name (NIGHTLY ONLY)
commit = nil, -- commit hash (NIGHTLY ONLY)
pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
skip_prompts = false, -- skip prompts about breaking changes
show_changelog = true, -- show the changelog after performing an update
auto_quit = false, -- automatically quit the current session after a successful update
remotes = { -- easily add new remotes to track
-- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
-- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
-- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
},
},
-- Set colorscheme to use
colorscheme = "everforest",
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = {
virtual_text = true,
underline = true,
},
lsp = {
-- customize lsp formatting options
formatting = {
-- filmer = function(client)
-- -- disable formatting for tsserver
-- if client.name == "tsserver" then return false end
--
-- return true
-- end,
-- control auto formatting on save
format_on_save = {
enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only
-- "go",
},
ignore_filetypes = { -- disable format on save for specified filetypes
"ruby",
},
},
disabled = { -- disable formatting capabilities for the listed language servers
-- "sumneko_lua",
},
timeout_ms = 1000, -- default format timeout
-- filter = function(client) -- fully override the default formatting function
-- return true
-- end
},
-- enable servers that you already have installed without mason
servers = {
-- cssls = { settings = { css = { lint = { unknownAtRules = "ignore" } } } },
-- tailwindcss = { settings = { css = { lint = { unknownAtRules = "ignore" } } } },
},
config = {
cssls = {
settings = {
css = { validate = true, lint = {
unknownAtRules = "ignore",
} },
scss = { validate = true, lint = {
unknownAtRules = "ignore",
} },
less = { validate = true, lint = {
unknownAtRules = "ignore",
} },
},
},
},
},
-- Configure require("lazy").setup() options
lazy = {
defaults = { lazy = true },
performance = {
rtp = {
-- customize default disabled vim plugins
disabled_plugins = {
"tohtml",
"gzip",
"matchit",
"zipPlugin",
"netrwPlugin",
"tarPlugin",
"matchparen",
},
},
},
},
-- This function is run last and is a good place to configuring
-- augroups/autocommands and custom filetypes also this just pure lua so
-- anything that doesn't fit in the normal config locations above can go here
polish = function()
-- telescopePickers.prettyGrepPicker { picker = "live_grep" }
-- Disable buffer and git tabs in NeoTree
-- vim.g.neotree_show_buffer = 0
-- vim.g.neotree_git_hl = 0
-- require("astronvim.utils.lsp").setup("cssls", {
-- settings = {
-- css = { validate = true, lint = {
-- unknownAtRules = "ignore",
-- } },
-- scss = { validate = true, lint = {
-- unknownAtRules = "ignore",
-- } },
-- less = { validate = true, lint = {
-- unknownAtRules = "ignore",
-- } },
-- },
-- })
if vim.g.neovide then
-- Put anything you want to happen only in Neovide here
vim.opt.guifont = { "FiraCode Nerd Font", ":h12" }
vim.g.neovide_scale_factor = 1.0
vim.g.neovide_input_macos_alt_is_meta = true
vim.g.neovide_cursor_animate_command_line = false
vim.g.neovide_cursor_animation_length = 0.1
vim.g.neovide_input_use_logo = true
end
-- -- add auto change line numbers
-- vim.api.nvim_create_autocmd({ "ColorScheme" }, {
-- callback = function() vim.opt.relativenumber = false end,
-- })
--
--
--
-- vim.api.nvim_set_keymap("n", "j", "jzz", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "k", "kzz", { noremap = true, silent = true })
-- Execute the Vim command
-- vim.cmd(vim_command)
-- add auto change line numbers
vim.api.nvim_create_autocmd({ "InsertEnter" }, {
callback = function() vim.opt.relativenumber = false end,
})
vim.api.nvim_create_autocmd({ "InsertLeave" }, {
callback = function() vim.opt.relativenumber = true end,
})
vim.api.nvim_create_autocmd({ "BufRead" }, {
callback = function() vim.api.nvim_command "normal bsi" end,
})
-- -- local api = vim.api
--
-- vim.api.nvim_create_autocmd({ "CursorMoved" }, {
-- pattern = "*",
-- callback = function()
-- -- Check if the last event was generated by the mouse
-- if v: ~= 0 then
-- -- Get the current cursor position
-- local cursor = vim.api.nvim_win_get_cursor(0)
-- -- Move the cursor up or down based on the direction of scrolling
-- if vim.v.mouse_dy > 0 then
-- -- Scroll up, move the cursor up
-- vim.api.nvim_win_set_cursor(0, { cursor[1] - 1, cursor[2] })
-- elseif vim.v.mouse_dy < 0 then
-- -- Scroll down, move the cursor down
-- api.nvim_win_set_cursor(0, { cursor[1] + 1, cursor[2] })
-- end
-- end
-- end,
-- })
--
-- vim.api.nvim_create_autocmd({ "CursorMovedI" }, {
-- pattern = "*",
-- callback = function()
-- if vim.v.mouse_win ~= 0 then
-- local cursor = api.nvim_win_get_cursor(0)
-- if vim.v.mouse_dy > 0 then
-- api.nvim_win_set_cursor(0, { cursor[1] - 1, cursor[2] })
-- elseif vim.v.mouse_dy < 0 then
-- api.nvim_win_set_cursor(0, { cursor[1] + 1, cursor[2] })
-- end
-- end
-- end,
-- })
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
callback = function()
-- if vim.v.mouse_win ~= 0 and vim.v.mouse_lnum ~= 0 and vim.v.mouse_col ~= 0 then return end
if vim.bo.filetype ~= "neo-tree" and vim.bo.filetype ~= "alpha" then vim.api.nvim_command "normal zz" end
end,
})
-- -- Define a variable to track the autocmd status
-- local autocmd_enabled = true
--
-- -- Create the autocmd
-- vim.api.nvim_create_autocmd({ "CursorMoved" }, {
-- callback = function()
-- -- Check if the autocmd is enabled
-- if autocmd_enabled and vim.bo.filetype ~= "neotree" then vim.api.nvim_command "normal zz" end
-- end,
-- })
-- Function to toggle the autocmd status
-- local function toggle_autocmd() autocmd_enabled = not autocmd_enabled end
-- Map <leader>ubz to toggle the autocmd status
-- vim.api.nvim_set_keymap("n", "<leader>uz", "<cmd>lua toggle_autocmd()<CR>", { noremap = true, silent = true })
-- Set up custom filetypes
-- vim.filetype.add {
-- extension = {
-- foo = "fooscript",
-- },
-- filename = {
-- ["Foofile"] = "fooscript",
-- },
-- pattern = {
-- ["~/%.config/foo/.*"] = "fooscript",
-- },
-- }
end,
}