Merge 52b1207c11
into 3338d39206
This commit is contained in:
commit
efee778a97
6
init.lua
6
init.lua
|
@ -248,14 +248,12 @@ rtp:prepend(lazypath)
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||||
'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
|
'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
|
||||||
|
|
||||||
-- NOTE: Plugins can also be added by using a table,
|
-- NOTE: Plugins can also be added by using a table,
|
||||||
-- with the first argument being the link and the following
|
-- with the first argument being the link and the following
|
||||||
-- keys can be used to configure plugin behavior/loading/etc.
|
-- keys can be used to configure plugin behavior/loading/etc.
|
||||||
--
|
--
|
||||||
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
|
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
|
||||||
--
|
--
|
||||||
|
|
||||||
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
||||||
-- If you prefer to call `setup` explicitly, use:
|
-- If you prefer to call `setup` explicitly, use:
|
||||||
-- {
|
-- {
|
||||||
|
@ -984,7 +982,7 @@ require('lazy').setup({
|
||||||
-- This is the easiest way to modularize your config.
|
-- This is the easiest way to modularize your config.
|
||||||
--
|
--
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||||
-- { import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
--
|
--
|
||||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||||
-- Or use telescope!
|
-- Or use telescope!
|
||||||
|
@ -1012,5 +1010,7 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
pcall(require, 'custom.keymaps')
|
||||||
|
pcall(require, 'custom.lsp')
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
vim.keymap.set('n', '<C-t>', function()
|
||||||
|
-- Get the current file's directory (handles unsaved files too)
|
||||||
|
local cwd = vim.fn.expand '%:p:h'
|
||||||
|
if cwd == '' then
|
||||||
|
cwd = vim.fn.getcwd() -- fallback to current working dir
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Open a horizontal split and terminal
|
||||||
|
vim.cmd 'split'
|
||||||
|
vim.cmd 'terminal'
|
||||||
|
vim.cmd 'startinsert'
|
||||||
|
|
||||||
|
-- Safely cd into the folder, even if it has spaces
|
||||||
|
vim.fn.chansend(vim.b.terminal_job_id, 'cd "' .. cwd .. '"\n')
|
||||||
|
end, { desc = "Open terminal in current file's directory" })
|
||||||
|
|
||||||
|
local harpoon = require 'harpoon'
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>a', function()
|
||||||
|
harpoon:list():add()
|
||||||
|
end, { desc = 'Add file to Harpoon' })
|
||||||
|
vim.keymap.set('n', '<leader>h', function()
|
||||||
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||||
|
end, { desc = 'Toggle Harpoon menu' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>1', function()
|
||||||
|
harpoon:list():select(1)
|
||||||
|
end)
|
||||||
|
vim.keymap.set('n', '<leader>2', function()
|
||||||
|
harpoon:list():select(2)
|
||||||
|
end)
|
||||||
|
vim.keymap.set('n', '<leader>3', function()
|
||||||
|
harpoon:list():select(3)
|
||||||
|
end)
|
||||||
|
vim.keymap.set('n', '<leader>4', function()
|
||||||
|
harpoon:list():select(4)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- In your keybindings configuration (e.g., lua/config/keymaps.lua or init.lua)
|
||||||
|
vim.keymap.set('n', '<leader>w', '<cmd>NvimTreeToggle<CR>', { desc = 'Toggle NvimTree' })
|
||||||
|
|
||||||
|
vim.keymap.set({ 'n', 't' }, '<leader>rr', function()
|
||||||
|
local chan = vim.b.terminal_job_id
|
||||||
|
if not chan then
|
||||||
|
vim.notify('Not in a terminal buffer', vim.log.levels.ERROR)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.api.nvim_chan_send(chan, 'source venv/bin/activate\n')
|
||||||
|
end, { desc = 'Activating VENV virtual environment (if it exists LOL)' })
|
|
@ -0,0 +1,6 @@
|
||||||
|
local lspconfig = require 'lspconfig'
|
||||||
|
local servers = { 'pyright', 'lua_ls' }
|
||||||
|
|
||||||
|
for _, server in ipairs(servers) do
|
||||||
|
lspconfig[server].setup {}
|
||||||
|
end
|
|
@ -0,0 +1,88 @@
|
||||||
|
return {
|
||||||
|
-- Other plugins in here
|
||||||
|
{
|
||||||
|
'nvim-tree/nvim-web-devicons',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'stevearc/oil.nvim',
|
||||||
|
opts = {},
|
||||||
|
dependencies = { 'nvim-tree/nvim-web-devicons' }, -- optional icons
|
||||||
|
keys = {
|
||||||
|
{ '<leader>e', '<cmd>Oil<CR>', desc = 'Open file explorer (Oil)' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'ThePrimeagen/harpoon',
|
||||||
|
branch = 'harpoon2',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
config = function()
|
||||||
|
require('harpoon'):setup()
|
||||||
|
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'
|
||||||
|
local luasnip = require 'luasnip'
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm { select = true },
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
},
|
||||||
|
sources = cmp.config.sources {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{ name = 'path' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'nvim-tree/nvim-tree.lua',
|
||||||
|
version = '*', -- recommended
|
||||||
|
lazy = false,
|
||||||
|
dependencies = {
|
||||||
|
'nvim-tree/nvim-web-devicons', -- optional, for file icons
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
view = {
|
||||||
|
side = 'left',
|
||||||
|
width = 30,
|
||||||
|
float = { enable = false },
|
||||||
|
},
|
||||||
|
sync_root_with_cwd = true,
|
||||||
|
respect_buf_cwd = true,
|
||||||
|
update_focused_file = { enable = true, update_root = true },
|
||||||
|
renderer = {
|
||||||
|
group_empty = true,
|
||||||
|
indent_width = 2,
|
||||||
|
},
|
||||||
|
actions = { open_file = { resize_window = true } },
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
end,
|
||||||
|
-- Other nvim-tree options can go here
|
||||||
|
-- For example, to automatically close on file selection:
|
||||||
|
-- auto_close = true,
|
||||||
|
-- To show hidden files:
|
||||||
|
-- hide_dotfiles = false,
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue