1
0

Bunch of updates to NVIM setup for Windows

Updated Settings
* Added new keymaps in keys.lua
* improved LSP setup

Plugins Removed
* codellama
* hardtime

Additional Plugins added
* Added edgy
* Added neo-tree
* Added todo-comments
* Added which-key
This commit is contained in:
2024-07-15 21:58:28 +02:00
parent b7785d460d
commit 1bb7a56d5c
13 changed files with 144 additions and 82 deletions

View File

@ -1,15 +1,5 @@
--[[
-- Only setup for windows
-- Don't know if all this is actually necessary
-- TODO: FIX: Clean this mess up ~ 03/28/2024
--]]
if vim.loop.os_uname().sysname == 'Windows_NT' then
Cmd = 'c:/Users/nigel/Appdata/Local/nvim-data/mason/bin/jdtls.cmd'
JavaDebug = vim.fn.glob("C:/Users/nigel/AppData/Local/nvim-data/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.52.0.jar", 1)
else
Cmd = ''
JavaDebug = nil
end
Cmd = 'c:/Users/nigel/Appdata/Local/nvim-data/mason/bin/jdtls.cmd'
JavaDebug = vim.fn.glob("C:/Users/nigel/AppData/Local/nvim-data/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.52.0.jar", 1)
local config = {
cmd = {Cmd},
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),

View File

@ -7,13 +7,7 @@ vim.keymap.set('n', '<leader>fa', vim.lsp.buf.format)
vim.keymap.set('n', '<leader>m', ":Mason<CR>")
vim.keymap.set('n', '<leader>e',':Explore<CR>', {noremap = false, silent=true})
vim.keymap.set('n', '<leader>le',':Lexplore<CR>', {noremap = false, silent=true})
local osname = vim.loop.os_uname().sysname
if osname == "Windows_NT" then
vim.keymap.set('n', '<leader>x', function() print("sorry this is windows!") end)
elseif osname == "Linux" then
-- Linux only!!
vim.keymap.set('n', '<leader>x', "<cmd>!chmod +x %<CR>", { silent = true })
end
vim.keymap.set('n', '<leader>l', ':Neotree<CR>', {noremap = false, silent= true})
-- Move lines while in visual mode
vim.keymap.set('v', '<A-S-j>', ':m \'>+1<CR>gv=gv', {noremap = true})
vim.keymap.set('v', '<A-S-k>', ':m \'<-2<CR>gv=gv', {noremap = true})
@ -31,7 +25,7 @@ vim.keymap.set('n', '<C-T>', function() require('trouble').toggle() end )
vim.keymap.set('n', '<leader>d', function () vim.diagnostic.open_float() end )
vim.keymap.set('n', '<leader>dn', function () vim.diagnostic.goto_next() end )
vim.keymap.set('n', '<leader>dp', function () vim.diagnostic.goto_prev() end )
vim.keymap.set('n', '<C-d>', function () vim.lsp.buf.code_action() end)
-- Debugging
vim.keymap.set('n', '<leader>sb', function () require('dap').toggle_breakpoint() end )
vim.keymap.set('n', '<leader>db', function () require('dapui').toggle() end )

View File

@ -1,17 +0,0 @@
return {
{
'David-kunz/gen.nvim',
opts = {
model = "codellama:7b",
host = "localhost",
port = "11434",
quit_mape = "q",
init = function (options) pcall(io.popen("ollama serve > /dev/null 2>&1 &)")) end,
display_mode = "split",
command =function (options)
local body = {model = options.model, stream=true}
return "curl --silent --no-buffer -X POST http://" .. options.host .. ':' .. options.port .. "/api/chat -d $body"
end,
},
}
}

View File

@ -22,6 +22,18 @@ return {
},
config = function ()
local dap = require('dap')
dap.configurations.cpp = {
{
name = "Launch",
type= "codelldb",
request = "launch",
program = function ()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() , 'file')
end,
cwd = '${workspaceFolder}/Framework',
stopOnEntry = false,
}
}
dap.configurations.java = {
{
type = 'java';
@ -60,6 +72,14 @@ return {
args = {'dap', '-l', '127.0.0.1:${port}'},
}
}
dap.adapters.codelldb = {
type= 'server',
port = '${port}',
executable = {
command = 'C:/Users/Nigel/Appdata/Local/nvim-data/mason/bin/codelldb.cmd',
args = {"--port", "${port}"}
}
}
end
}
}

View File

@ -0,0 +1,9 @@
return {
"folke/edgy.nvim",
event = "VeryLazy",
opts = {},
init = function ()
vim.opt.laststatus = 3
vim.opt.splitkeep = "screen"
end
}

View File

@ -1,9 +0,0 @@
return {
{
'm4xshen/hardtime.nvim',
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim"},
opts = {
restriction_mode = "hint"
}
}
}

View File

@ -2,6 +2,10 @@ return
{
'neovim/nvim-lspconfig',
dependencies = {
{
"folke/neoconf.nvim",
opts = {}
},
"williamboman/mason-lspconfig",
"williamboman/mason.nvim",
"hrsh7th/cmp-nvim-lsp",
@ -111,6 +115,26 @@ return
require('lspconfig')['asm_lsp'].setup({
capabilities = capabilities
})
local root_files = {
'premake5.lua',
'.clang-tidy',
'.clang-format',
'compile_commands',
'compile_commands.json',
'compile_flags.txt',
'configure.ac',
'.git'
}
local util = require('lspconfig.util')
require('lspconfig')['clangd'].setup({
capabilities = capabilities,
filetypes= { 'c', 'cpp', 'objc', 'objcpp', 'cuda', 'proto' },
cmd = { 'clangd' },
single_file_support = true,
root_dir = function (fname)
return util.root_pattern(unpack(root_files))(fname)
end
})
require('lspconfig')['zls'].setup({
capabilities = capabilities
@ -131,6 +155,10 @@ return
require('lspconfig')['gopls'].setup({
capabilities = capabilities
})
require('lspconfig')['tsserver'].setup({
capabilities = capabilities
})
end
}

View File

@ -0,0 +1,9 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim"
},
}

View File

@ -6,15 +6,7 @@ return {
{'nvim-lua/plenary.nvim'},
{
'nvim-telescope/telescope-fzf-native.nvim',
build = function () if os == 'Windows_NT' then
print("You are on Windows, Idiot!!!")
return [[
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
&& cmake --build build --config Release
&& cmake --install build --prefix build
]] else
return 'make' end
end,
build ="cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
}
},
config = function()

View File

@ -0,0 +1,8 @@
return {
"folke/todo-comments.nvim",
dependencies = {
"nvim-lua/plenary.nvim"
},
opts = {
}
}

View File

@ -1,14 +1,33 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
dependencies = {
{
"nvim-treesitter/playground",
},
},
config = function()
require 'nvim-treesitter.install'.compilers = {'clang'}
local configs = require("nvim-treesitter.configs")
configs.setup({
playground = {
enable = true,
disable = {},
updatetime = 25,
keybindings = {
toggle_query_editor = 'o',
toggle_hl_groups = 'i',
update = 'R',
show_help = '?'
}
},
ensure_installed = { "c", "lua", "vim", "vimdoc", "bash" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end
}
},
}

View File

@ -0,0 +1,15 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
},
keys = {
{
"<leader>?",
function()
require("which-key").show({global = false})
end,
desc = "Buffer Local Keymaps (which-key)",
}
}
}