-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
196 lines (184 loc) · 6.55 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
--[[
keybinds
select block: Vf{%
]]
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.swapfile = false
vim.opt.scrolloff = 5
vim.opt.virtualedit = 'block'
vim.opt.ignorecase = true
vim.g.mapleader = ';'
vim.cmd[[set shortmess+=I]]
vim.keymap.set('v', 'J', [[:m '>+1<cr>gv=gv]])
vim.keymap.set('v', 'K', [[:m '<-2<cr>gv=gv]])
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, 'WarningMsg' },
{ '\nPress any key to exit...' },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
spec = {
{
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-telescope/telescope-fzf-native.nvim',
'nvim-lua/plenary.nvim'
},
config = function()
local telescope = require('telescope')
local builtin = require('telescope.builtin')
local actions = require('telescope.actions')
telescope.setup({
defaults = {
mappings = {
i = {
['<c-j>'] = actions.move_selection_next,
['<c-k>'] = actions.move_selection_previous,
['<esc>'] = actions.close,
},
},
},
})
telescope.load_extension('fzf')
vim.keymap.set('n', '<leader>ff', builtin.find_files)
vim.keymap.set('n', '<leader>fg', builtin.live_grep)
vim.keymap.set('n', '<leader>fb', builtin.buffers)
end,
},
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make'
},
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
},
{
'neovim/nvim-lspconfig',
config = function()
local function sign(type, icon)
vim.fn.sign_define('DiagnosticSign' .. type, { text = icon, texthl = 'DiagnosticSign' .. type })
end
sign('Error', 'e')
sign('Warn', 'w')
sign('Hint', 'h')
sign('Info', 'i')
end,
},
{
'hrsh7th/nvim-cmp',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'L3MON4D3/LuaSnip',
--'saadparwaiz1/cmp_luasnip',
},
config = function()
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = {
['<c-j>'] = {
i = function()
if not cmp.visible() then
cmp.complete()
end
cmp.select_next_item({ behavior = 'insert' })
end,
},
['<c-k>'] = {
i = function()
if not cmp.visible() then
cmp.complete()
end
cmp.select_prev_item({ behavior = 'insert' })
end,
},
['<c-e>'] = {
i = cmp.mapping.abort(),
},
['<c-c>'] = {
i = cmp.mapping.confirm({ select = true })
},
},
sources = {
{ name = 'path' },
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
},
})
end,
},
{
'L3MON4D3/LuaSnip',
config = function()
local luasnip = require('luasnip')
vim.keymap.set({ 'i', 's' }, '<c-n>', function() luasnip.jump(1) end)
vim.keymap.set({ 'i', 's' }, '<c-p>', function() luasnip.jump(-1) end)
end,
},
{
'williamboman/mason.nvim',
opts = {
ui = {
icons = {
package_installed = '+',
package_pending = '*',
package_uninstalled = 'x'
}
}
}
},
{
'williamboman/mason-lspconfig.nvim',
dependencies = {
'neovim/nvim-lspconfig',
'williamboman/mason.nvim',
'hrsh7th/cmp-nvim-lsp',
'lopi-py/luau-lsp.nvim',
},
config = function(_, opts)
require('mason-lspconfig').setup(opts)
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('mason-lspconfig').setup_handlers({
function(server_name)
require('lspconfig')[server_name].setup({
capabilities = capabilities,
})
end,
luau_lsp = function()
require('luau-lsp').setup({
capabilities = capabilities,
})
end,
})
end,
},
},
--install = { colorscheme = { 'habamax' } },
checker = {
enabled = true,
notify = false,
},
})