-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
265 lines (235 loc) · 6.78 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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
vim.g.coq_settings = {
auto_start = true,
}
vim.wo.number = true
vim.wo.relativenumber = true
require "config.lazy"
local lsp = require "lspconfig"
local coq = require "coq" -- add this
require("autoclose").setup()
vim.keymap.set("i", "<C-Tab>", 'copilot#Accept("\\<CR>")', {
expr = true,
replace_keycodes = false,
})
vim.g.copilot_no_tab_map = true
require("mason").setup()
require("lazy").setup {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require "nvim-treesitter.configs"
configs.setup {
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
}
end,
},
}
local function my_on_attach(bufnr)
local api = require "nvim-tree.api"
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set("n", "<C-t>", api.tree.change_root_to_parent, opts "Up")
vim.keymap.set("n", "?", api.tree.toggle_help, opts "Help")
--- i want control n to toggle nvim tree
end
vim.api.nvim_set_keymap("n", "<C-n>", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
-- pass to setup along with your other options
require("nvim-tree").setup {
---
on_attach = my_on_attach,
---
}
require("nvim-tree").setup {
view = {
side = "right",
width = 40,
},
on_attach = my_on_attach,
}
--- Language servers
require("lspconfig").lua_ls.setup {}
require("lspconfig").svelte.setup {}
require("lspconfig").clangd.setup {}
require("lspconfig").tailwindcss.setup {}
require("lspconfig").cssls.setup {}
require("lspconfig").jedi_language_server.setup {}
require("lspconfig").emmet_language_server.setup {}
require("lspconfig").vtsls.setup {}
-- require'lspconfig'.tailwindcss_language_server.setup{}
lsp.lua_ls.setup(coq.lsp_ensure_capabilities())
lsp.vtsls.setup(coq.lsp_ensure_capabilities())
require("mason-lspconfig").setup {
ensure_installed = { "lua_ls", "rust_analyzer" },
}
require("telescope").setup {
pickers = {
help_tags = {
mappings = {},
},
},
}
local builtin = require "telescope.builtin"
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Telescope live grep" })
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Telescope buffers" })
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Telescope help tags" })
--Telescope buffer drop
-- require("telescope").setup {
-- pickers = {
-- buffers = {
-- mappings = {
-- i = { ["<CR>"] = actions.select_tab_drop },
-- },
-- find_files = {
-- mappings = {
-- i = { ["<CR>"] = actions.select_tab_drop },
-- },
-- },
-- git_files = {
-- mappings = {
-- i = { ["<CR>"] = actions.select_tab_drop },
-- },
-- },
-- old_files = {
-- mappings = {
-- i = { ["<CR>"] = actions.select_tab_drop },
-- },
-- },
-- },
-- },
-- }
local harpoon = require "harpoon"
-- REQUIRED
harpoon:setup()
-- REQUIRED
vim.keymap.set("n", "<leader>a", function()
harpoon:list():add()
end)
vim.keymap.set("n", "<A-e>", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end)
vim.keymap.set("n", "<A-1>", function()
harpoon:list():select(1)
end)
vim.keymap.set("n", "<A-2>", function()
harpoon:list():select(2)
end)
vim.keymap.set("n", "<A-3>", function()
harpoon:list():select(3)
end)
vim.keymap.set("n", "<A-4>", function()
harpoon:list():select(4)
end)
vim.keymap.set("n", "<A-5>", function()
harpoon:list():select(5)
end)
vim.keymap.set("n", "<A-6>", function()
harpoon:list():select(6)
end)
vim.keymap.set("n", "<A-7>", function()
harpoon:list():select(7)
end)
vim.keymap.set("n", "<A-8>", function()
harpoon:list():select(8)
end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set("n", "<C-S-P>", function()
harpoon:list():prev()
end)
vim.keymap.set("n", "<C-S-N>", function()
harpoon:list():next()
end)
require("nvim-surround").setup()
-- Colorscheme
-- vim.cmd [[colorscheme tokyonight]]
-- Clipboard
vim.api.nvim_set_option("clipboard", "unnamedplus")
-- NeoSolarized
local ok_status, NeoSolarized = pcall(require, "NeoSolarized")
if not ok_status then
return
end
-- Default Setting for NeoSolarized
NeoSolarized.setup {
style = "dark", -- "dark" or "light"
transparent = false, -- true/false; Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
enable_italics = true, -- Italics for different hightlight groups (eg. Statement, Condition, Comment, Include, etc.)
styles = {
-- Style to be applied to different syntax groups
comments = { italic = true },
keywords = { italic = true },
functions = { bold = true },
variables = {},
string = { italic = true },
underline = true, -- true/false; for global underline
undercurl = true, -- true/false; for global undercurl
},
-- Add specific hightlight groups
on_highlights = function(highlights, colors)
-- highlights.Include.fg = colors.red -- Using `red` foreground for Includes
end,
}
-- Set colorscheme to NeoSolarized
vim.cmd [[
try
colorscheme NeoSolarized
set background=dark
endtry
]]
-- Lualine
--
require("lualine").setup {
options = {
icons_enabled = true,
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
always_show_tabline = true,
globalstatus = false,
refresh = {
statusline = 100,
tabline = 100,
winbar = 100,
},
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
extensions = {},
inactive_winbar = {},
}
-- Spaces
vim.o.tabstop = 4 -- A TAB character looks like 4 spaces
vim.o.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character
vim.o.softtabstop = 4 -- Number of spaces inserted instead of a TAB character
vim.o.shiftwidth = 4 -- Number of spaces inserted when indenting