161 lines
3.8 KiB
Lua
161 lines
3.8 KiB
Lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
if not vim.loop.fs_stat(lazypath) then
|
|
vim.fn.system({
|
|
"git",
|
|
"clone",
|
|
"--filter=blob:none",
|
|
"https://github.com/folke/lazy.nvim.git",
|
|
"--branch=stable", -- latest stable release
|
|
lazypath,
|
|
})
|
|
end
|
|
vim.opt.rtp:prepend(lazypath)
|
|
require("lazy").setup({
|
|
"nvim-treesitter/nvim-treesitter",
|
|
"morhetz/gruvbox",
|
|
{ "nvim-telescope/telescope.nvim", dependencies = {"nvim-lua/plenary.nvim"} },
|
|
"windwp/nvim-autopairs",
|
|
{"sheerun/vim-polyglot", enabled=false},
|
|
{"habamax/vim-godot", enabled=false },
|
|
"mfussenegger/nvim-dap",
|
|
})
|
|
require('statusline')
|
|
require('keybindings')
|
|
|
|
vim.opt.nu = true
|
|
vim.opt.relativenumber = true
|
|
|
|
vim.opt.tabstop = 4
|
|
vim.opt.softtabstop = 4
|
|
vim.opt.shiftwidth = 4
|
|
vim.opt.expandtab = true
|
|
|
|
vim.opt.smartindent = true
|
|
|
|
vim.opt.wrap = false
|
|
require('nvim-treesitter.configs').setup {
|
|
ensure_installed = { "c", "cpp", "lua", "go", "gdscript", "godot_resource", "gdshader", "odin", "python", "sql", "zig", "hlsl" },
|
|
sync_install = false,
|
|
auto_install = false,
|
|
highlight = {
|
|
enable = true,
|
|
additional_vim_regex_highlighting = false,
|
|
},
|
|
incremental_selection = {
|
|
},
|
|
indent = {
|
|
enable = true,
|
|
},
|
|
playground = {
|
|
enabled = false,
|
|
persist_queries = false,
|
|
}
|
|
}
|
|
|
|
require('nvim-autopairs').setup{}
|
|
require('telescope').setup{
|
|
defaults = {
|
|
file_ignore_patterns = {
|
|
"%.uid", "%.png", "%.gltf", "%.import", "%.glb"
|
|
},
|
|
},
|
|
pickers = {
|
|
find_files = {
|
|
--theme = "dropdown",
|
|
},
|
|
git_files = {
|
|
--theme = "dropdown",
|
|
}
|
|
},
|
|
extensions = {
|
|
},
|
|
}
|
|
vim.filetype.add({
|
|
extension = {
|
|
odin = "odin"
|
|
}
|
|
})
|
|
|
|
-- Server mode for godot
|
|
local paths_to_check = {'/', '/../'}
|
|
local is_godot_project = false
|
|
local godot_project_path = ''
|
|
local cwd = vim.fn.getcwd()
|
|
|
|
for key, value in pairs(paths_to_check) do
|
|
if vim.uv.fs_stat(cwd .. value .. 'project.godot') then
|
|
is_godot_project = true
|
|
godot_project_path = cwd .. value
|
|
break
|
|
end
|
|
end
|
|
|
|
local is_server_running = vim.uv.fs_stat(godot_project_path .. '/server.pipe')
|
|
if is_godot_project and not is_server_running then
|
|
vim.fn.serverstart(godot_project_path .. '/server.pipe')
|
|
end
|
|
|
|
local dap = require('dap')
|
|
dap.adapters.godot = {
|
|
type = "server",
|
|
host = "127.0.0.1",
|
|
port = 6006,
|
|
}
|
|
|
|
dap.adapters.gdb = {
|
|
type = "executable",
|
|
command = "gdb",
|
|
args = { "--interpreter=dap", "--eval-command", "set print pretty on" }
|
|
}
|
|
|
|
dap.configurations.gdscript = {
|
|
{
|
|
type = "godot",
|
|
request = "launch",
|
|
name = "Launch Scene",
|
|
project = "${workspaceFolder}",
|
|
scene = "main"
|
|
}
|
|
}
|
|
|
|
dap.configurations.c = {
|
|
{
|
|
name = "Launch",
|
|
type = "gdb",
|
|
request = "launch",
|
|
program = function()
|
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
|
end,
|
|
args = {}, -- provide arguments if needed
|
|
cwd = "${workspaceFolder}",
|
|
stopAtBeginningOfMainSubprogram = false,
|
|
},
|
|
{
|
|
name = "Select and attach to process",
|
|
type = "gdb",
|
|
request = "attach",
|
|
program = function()
|
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
|
end,
|
|
pid = function()
|
|
local name = vim.fn.input('Executable name (filter): ')
|
|
return require("dap.utils").pick_process({ filter = name })
|
|
end,
|
|
cwd = '${workspaceFolder}'
|
|
},
|
|
{
|
|
name = 'Attach to gdbserver :1234',
|
|
type = 'gdb',
|
|
request = 'attach',
|
|
target = 'localhost:1234',
|
|
program = function()
|
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
|
end,
|
|
cwd = '${workspaceFolder}'
|
|
}
|
|
}
|
|
|
|
dap.configurations.cpp = dap.configurations.c
|
|
-- TODO: could do rust, zig, odin, jai (?)
|
|
|