Skip to content

Commit c109dcf

Browse files
committed
Added Neotree and Nvim-tree for file explorer, fixed Roblox luau-lsp on Neovim
1 parent 122dc8b commit c109dcf

File tree

2 files changed

+134
-9
lines changed

2 files changed

+134
-9
lines changed

init.lua

Lines changed: 131 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ vim.g.have_nerd_font = false
9898
-- NOTE: You can change these options as you wish!
9999
-- For more options, you can see `:help option-list`
100100

101+
-- disable netrw at the very start of your init.lua
102+
vim.g.loaded_netrw = 1
103+
vim.g.loaded_netrwPlugin = 1
104+
105+
-- optionally enable 24-bit colour
106+
vim.opt.termguicolors = true
107+
101108
-- Make line numbers default
102109
vim.o.number = true
103110
-- You can also add relative line numbers, to help with jumping.
@@ -169,9 +176,9 @@ vim.o.cursorline = true
169176
-- Minimal number of screen lines to keep above and below the cursor.
170177
vim.o.scrolloff = 10
171178

172-
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
173-
-- instead raise a dialog asking if you wish to save the current file(s)
174-
-- See `:help 'confirm'`
179+
-- vs cresbezvat na bcrengvba gung jbhyq snvy qhr gb hafnirq punatrf va gur ohssre (yvxr `:d`),
180+
-- vafgrnq envfr n qvnybt nfxvat vs lbh jvfu gb fnir gur pheerag svyr(f)
181+
-- Frr `:uryc 'pbasvez'`
175182
vim.o.confirm = true
176183

177184
-- [[ Basic Keymaps ]]
@@ -183,7 +190,7 @@ vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
183190

184191
-- Diagnostic keymaps
185192
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
186-
193+
vim.keymap.set('n', '<C-n>', ':Neotree<CR>', { desc = 'Toggles Neotree' })
187194
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
188195
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
189196
-- is not what someone will guess without a bit more experience.
@@ -216,6 +223,16 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
216223
-- [[ Basic Autocommands ]]
217224
-- See `:help lua-guide-autocommands`
218225

226+
vim.lsp.config('*', {
227+
capabilities = {
228+
workspace = {
229+
didChangeWatchedFiles = {
230+
dynamicRegistration = true,
231+
},
232+
},
233+
},
234+
})
235+
219236
-- Highlight when yanking (copying) text
220237
-- Try it with `yap` in normal mode
221238
-- See `:help vim.hl.on_yank()`
@@ -238,6 +255,7 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
238255
end
239256
end
240257

258+
241259
---@type vim.Option
242260
local rtp = vim.opt.rtp
243261
rtp:prepend(lazypath)
@@ -256,7 +274,50 @@ rtp:prepend(lazypath)
256274
require('lazy').setup({
257275
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
258276
'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
259-
277+
{
278+
'nvim-lualine/lualine.nvim',
279+
dependencies = { 'nvim-tree/nvim-web-devicons' },
280+
config = function()
281+
require('lualine').setup {
282+
options = {
283+
theme = 'tomorrow_night',
284+
},
285+
}
286+
end,
287+
},
288+
{
289+
"mason-org/mason-lspconfig.nvim",
290+
opts = {},
291+
dependencies = {
292+
{ "mason-org/mason.nvim", opts = {} },
293+
"neovim/nvim-lspconfig",
294+
},
295+
},
296+
{
297+
'lopi-py/luau-lsp.nvim',
298+
opts = {
299+
...,
300+
},
301+
dependencies = {
302+
'nvim-lua/plenary.nvim',
303+
},
304+
},
305+
--[[{
306+
'nvim-tree/nvim-tree.lua',
307+
version = '*',
308+
lazy = false,
309+
dependencies = {
310+
'nvim-tree/nvim-web-devicons',
311+
},
312+
config = function()
313+
require('nvim-tree').setup {
314+
view = {
315+
width = 25,
316+
},
317+
}
318+
end,
319+
},]]
320+
--
260321
-- NOTE: Plugins can also be added by using a table,
261322
-- with the first argument being the link and the following
262323
-- keys can be used to configure plugin behavior/loading/etc.
@@ -525,7 +586,6 @@ require('lazy').setup({
525586
--
526587
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
527588
-- and elegantly composed help section, `:help lsp-vs-treesitter`
528-
529589
-- This function gets run when an LSP attaches to a particular buffer.
530590
-- That is to say, every time a new file is opened that is associated with
531591
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
@@ -981,11 +1041,11 @@ require('lazy').setup({
9811041
-- Here are some example plugins that I've included in the Kickstart repository.
9821042
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
9831043
--
984-
-- require 'kickstart.plugins.debug',
1044+
require 'kickstart.plugins.debug',
9851045
-- require 'kickstart.plugins.indent_line',
9861046
-- require 'kickstart.plugins.lint',
9871047
-- require 'kickstart.plugins.autopairs',
988-
-- require 'kickstart.plugins.neo-tree',
1048+
require 'kickstart.plugins.neo-tree',
9891049
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
9901050

9911051
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
@@ -1020,5 +1080,68 @@ require('lazy').setup({
10201080
},
10211081
})
10221082

1083+
vim.api.nvim_create_autocmd({ 'WinEnter', 'BufWinEnter' }, {
1084+
pattern = { 'NvimTree*' },
1085+
callback = function()
1086+
vim.opt.guicursor = '' -- Hide the cursor
1087+
end,
1088+
})
1089+
1090+
vim.api.nvim_create_autocmd({ 'WinLeave', 'BufWinLeave' }, {
1091+
pattern = { 'NvimTree*' },
1092+
callback = function()
1093+
-- Restore your desired cursor settings for other windows/buffers
1094+
-- Example: Restore default block cursor for normal mode
1095+
vim.opt.guicursor = 'n-v-c:block,i-ci-r:ver25,sm:block'
1096+
end,
1097+
})
1098+
1099+
vim.lsp.config('luau-lsp', {
1100+
settings = {
1101+
['luau-lsp'] = {
1102+
completion = {
1103+
imports = {
1104+
enabled = true, -- enable auto imports
1105+
},
1106+
},
1107+
},
1108+
},
1109+
})
1110+
1111+
require('mason-lspconfig').setup {
1112+
automatic_enable = {
1113+
exclude = { 'luau_lsp' },
1114+
},
1115+
platform = {
1116+
type = 'roblox',
1117+
},
1118+
types = {
1119+
roblox_security_level = 'PluginSecurity',
1120+
},
1121+
sourcemap = {
1122+
enabled = true,
1123+
autogenerate = true, -- automatic generation when the server is initialized
1124+
rojo_project_file = 'default.project.json',
1125+
sourcemap_file = 'sourcemap.json',
1126+
},
1127+
}
1128+
1129+
require('luau-lsp').setup {
1130+
plugin = {
1131+
enabled = true,
1132+
port = 3667,
1133+
},
1134+
fflags = {
1135+
enable_new_solver = true, -- enables the fflags required for luau's new type solver
1136+
sync = true, -- sync currently enabled fflags with roblox's published fflags
1137+
override = { -- override fflags passed to luau
1138+
LuauTableTypeMaximumStringifierLength = '100',
1139+
},
1140+
},
1141+
}
1142+
1143+
1144+
1145+
10231146
-- The line beneath this is called `modeline`. See `:help modeline`
10241147
-- vim: ts=2 sts=2 sw=2 et

lua/custom/plugins/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
-- I promise not to create any merge conflicts in this directory :)
33
--
44
-- See the kickstart.nvim README for more information
5-
return {}
5+
6+
return {
7+
}

0 commit comments

Comments
 (0)