Skip to content

Commit

Permalink
Add rust, dap. Remove filetree for oil (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter-McKinney authored Jun 10, 2024
1 parent 0e9ca0c commit 3965a33
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 23 deletions.
20 changes: 12 additions & 8 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -623,12 +623,14 @@ require('lazy').setup({
require('mason-lspconfig').setup {
handlers = {
function(server_name)
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for tsserver)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
if server_name ~= 'rust_analyzer' then
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for tsserver)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end
end,
},
}
Expand Down Expand Up @@ -982,8 +984,6 @@ require('lazy').setup({

vim.keymap.set('n', '<leader>q', ':q<Enter>', { silent = true })
vim.keymap.set('n', '<leader>w', ':w<Enter>', { silent = true })
vim.keymap.set('n', '<leader>e', ':Neotree reveal=true toggle<Enter>', { silent = true })
vim.keymap.set('n', '<leader>fe', ':Neotree reveal=true <Enter>', { silent = true })

vim.keymap.set('n', '<leader>ns', ':source ~/.config/nvim/init.lua')

Expand Down Expand Up @@ -1069,6 +1069,10 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos
vim.keymap.set('n', '<leader>ld', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.o.shellcmdflag = '-ic'

vim.keymap.set('n', '<leader>h', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end)

-- toggle hidden file searching in telescope
function _G.toggle_hidden_file_searching()
_G.hidden_files = not _G.hidden_files
Expand Down
47 changes: 47 additions & 0 deletions lua/custom/plugins/dap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
return {
{
'mfussenegger/nvim-dap',
dependencies = {
'rcarriga/nvim-dap-ui',
'theHamsta/nvim-dap-virtual-text',
'nvim-neotest/nvim-nio',
'williamboman/mason.nvim',
},
config = function()
local dap = require 'dap'
local ui = require 'dapui'

require('dapui').setup()

require('nvim-dap-virtual-text').setup {}

vim.keymap.set('n', '<space>b', dap.toggle_breakpoint)
vim.keymap.set('n', '<space>dr', dap.run_to_cursor)

-- Eval var under cursor
vim.keymap.set('n', '<space>?', function()
require('dapui').eval(nil, { enter = true })
end)

vim.keymap.set('n', '<F1>', dap.continue)
vim.keymap.set('n', '<F2>', dap.step_into)
vim.keymap.set('n', '<F3>', dap.step_over)
vim.keymap.set('n', '<F4>', dap.step_out)
vim.keymap.set('n', '<F5>', dap.step_back)
vim.keymap.set('n', '<F6>', dap.restart)

dap.listeners.before.attach.dapui_config = function()
ui.open()
end
dap.listeners.before.launch.dapui_config = function()
ui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
ui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
ui.close()
end
end,
},
}
15 changes: 0 additions & 15 deletions lua/custom/plugins/filetree.lua

This file was deleted.

5 changes: 5 additions & 0 deletions lua/custom/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ return {
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
},
},
{
'mrcjkb/rustaceanvim',
version = '^4', -- Recommended
lazy = false, -- This plugin is already lazy
},
}
24 changes: 24 additions & 0 deletions lua/custom/plugins/oil.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
return {
{
'stevearc/oil.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('oil').setup {
columns = { 'icons' },
keymaps = {
['<C-h>'] = false,
['<C-v>'] = 'actions.select_vsplit',
},
view_options = {
show_hidden = true,
},
}

-- Open parent directory in current window
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })

-- Open parent directory in floating window
vim.keymap.set('n', '<space>--', require('oil').toggle_float)
end,
},
}

0 comments on commit 3965a33

Please sign in to comment.