Split out plugins and extra config
This commit is contained in:
parent
162b44a00a
commit
25a94d9353
97
init.lua
97
init.lua
|
@ -43,6 +43,7 @@ P.S. You can delete this when you're done too. It's your config now :)
|
||||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
vim.g.python3_host_prog = '/usr/bin/python3.11'
|
||||||
|
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
-- https://github.com/folke/lazy.nvim
|
-- https://github.com/folke/lazy.nvim
|
||||||
|
@ -216,62 +217,6 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
-- File Browser
|
|
||||||
'nvim-tree/nvim-tree.lua',
|
|
||||||
opts = {
|
|
||||||
sort_by = "case_sensitive",
|
|
||||||
view = { width = 30, },
|
|
||||||
renderer = { group_empty = true, },
|
|
||||||
filters = { dotfiles = true, },
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'kylechui/nvim-surround',
|
|
||||||
opts = {
|
|
||||||
version = "*",
|
|
||||||
config = {},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'akinsho/toggleterm.nvim',
|
|
||||||
opts = {
|
|
||||||
version = "*",
|
|
||||||
size = 20,
|
|
||||||
open_mapping = [[c-\]],
|
|
||||||
hide_numbers = true,
|
|
||||||
shading_factor = 2,
|
|
||||||
start_in_insert = true,
|
|
||||||
insert_mappings = true,
|
|
||||||
persist_size = true,
|
|
||||||
direction = "float",
|
|
||||||
close_on_exit = true,
|
|
||||||
shell = vim.o.shell,
|
|
||||||
float_opts = {
|
|
||||||
border = "curved",
|
|
||||||
winblend = 0,
|
|
||||||
highlights = {
|
|
||||||
border = "Normal",
|
|
||||||
background = "Normal",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'windwp/nvim-autopairs',
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'Wansmer/treesj',
|
|
||||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'nvim-treesitter/nvim-treesitter-context',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'mg979/vim-visual-multi',
|
|
||||||
},
|
|
||||||
|
|
||||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||||
-- These are some example plugins that I've included in the kickstart repository.
|
-- These are some example plugins that I've included in the kickstart repository.
|
||||||
|
@ -285,7 +230,7 @@ require('lazy').setup({
|
||||||
-- 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.
|
||||||
--
|
--
|
||||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||||
-- { import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
|
@ -297,6 +242,10 @@ vim.o.hlsearch = false
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
|
vim.wo.relativenumber = true
|
||||||
|
vim.bo.tabstop = 4
|
||||||
|
vim.bo.shiftwidth = 4
|
||||||
|
vim.bo.expandtab = true
|
||||||
|
|
||||||
-- Enable mouse mode
|
-- Enable mouse mode
|
||||||
vim.o.mouse = 'a'
|
vim.o.mouse = 'a'
|
||||||
|
@ -553,16 +502,6 @@ require('which-key').register {
|
||||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||||
--Toggle Term
|
|
||||||
['<leader>t'] = {
|
|
||||||
name = "[T]erminal",
|
|
||||||
p = { "<cmd>lua _PYTHON_TOGGLE()<cr>", "Python" }, -- Python Terminal
|
|
||||||
f = { "<cmd>ToggleTerm direction=float<cr>", "Float" }, -- Floating Terminal
|
|
||||||
|
|
||||||
-- Play with size according to your needs.
|
|
||||||
h = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", "Horizontal" }, -- Horizontal Terminal,
|
|
||||||
v = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", "Vertical" }, -- Vertical Terminal
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- mason-lspconfig requires that these setup functions are called in this order
|
-- mason-lspconfig requires that these setup functions are called in this order
|
||||||
|
@ -672,25 +611,9 @@ cmp.setup {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- configure toggleterm
|
|
||||||
function _G.set_terminal_keymaps()
|
|
||||||
local opts = { noremap = true }
|
|
||||||
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-\><C-n>]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
|
||||||
|
|
||||||
local Terminal = require("toggleterm.terminal").Terminal
|
|
||||||
local python = Terminal:new({ cmd = "python3", hidden = true })
|
|
||||||
|
|
||||||
function _PYTHON_TOGGLE()
|
|
||||||
python:toggle()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 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
|
||||||
|
|
||||||
|
require "custom.config.treesj-config"
|
||||||
|
require "custom.config.toggleterm-config"
|
||||||
|
-- require "custom.config"
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
function _G.set_terminal_keymaps()
|
||||||
|
local opts = { noremap = true }
|
||||||
|
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-\><C-n>]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||||
|
|
||||||
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
|
local python = Terminal:new({ cmd = "python3", hidden = true })
|
||||||
|
|
||||||
|
function _PYTHON_TOGGLE()
|
||||||
|
python:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
require('which-key').register {
|
||||||
|
['<leader>t'] = {
|
||||||
|
name = "[T]erminal",
|
||||||
|
p = { "<cmd>lua _PYTHON_TOGGLE()<cr>", "Python" }, -- Python Terminal
|
||||||
|
f = { "<cmd>ToggleTerm direction=float<cr>", "Float" }, -- Floating Terminal
|
||||||
|
|
||||||
|
-- Play with size according to your needs.
|
||||||
|
h = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", "Horizontal" }, -- Horizontal Terminal,
|
||||||
|
v = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", "Vertical" }, -- Vertical Terminal
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
-- Set up the treesitter nodes for the Python language.
|
||||||
|
local lang_utils = require("treesj.langs.utils")
|
||||||
|
local options = {
|
||||||
|
join = { space_in_brackets = false },
|
||||||
|
split = { last_separator = true },
|
||||||
|
}
|
||||||
|
|
||||||
|
require("treesj").setup(
|
||||||
|
{
|
||||||
|
use_default_keymaps = false,
|
||||||
|
langs = {
|
||||||
|
python = {
|
||||||
|
argument_list = lang_utils.set_preset_for_args(options),
|
||||||
|
assignment = { target_nodes = { "list", "set", "tuple", "dictionary" } },
|
||||||
|
call = { target_nodes = { "argument_list" } },
|
||||||
|
dictionary = lang_utils.set_preset_for_dict(options),
|
||||||
|
list = lang_utils.set_preset_for_list(options),
|
||||||
|
parameters = lang_utils.set_preset_for_args(options),
|
||||||
|
set = lang_utils.set_preset_for_list(options),
|
||||||
|
tuple = lang_utils.set_preset_for_list(options),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
|
@ -2,4 +2,7 @@
|
||||||
-- I promise not to create any merge conflicts in this directory :)
|
-- I promise not to create any merge conflicts in this directory :)
|
||||||
--
|
--
|
||||||
-- See the kickstart.nvim README for more information
|
-- See the kickstart.nvim README for more information
|
||||||
return {}
|
return {
|
||||||
|
'mg979/vim-visual-multi',
|
||||||
|
'nvim-treesitter/nvim-treesitter-context',
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
opts = {}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'kylechui/nvim-surround',
|
||||||
|
opts = { config = {} }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'nvim-tree/nvim-tree.lua',
|
||||||
|
opts = {
|
||||||
|
sort_by = "case_sensitive",
|
||||||
|
view = { width = 30, },
|
||||||
|
renderer = { group_empty = true, },
|
||||||
|
filters = { dotfiles = true, },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'akinsho/toggleterm.nvim',
|
||||||
|
opts = {
|
||||||
|
version = "*",
|
||||||
|
size = 20,
|
||||||
|
open_mapping = [[c-\]],
|
||||||
|
hide_numbers = true,
|
||||||
|
shading_factor = 2,
|
||||||
|
start_in_insert = true,
|
||||||
|
insert_mappings = true,
|
||||||
|
persist_size = true,
|
||||||
|
direction = "float",
|
||||||
|
close_on_exit = true,
|
||||||
|
shel = vim.o.shell,
|
||||||
|
float_opts = {
|
||||||
|
border = "curved",
|
||||||
|
winblend = 0,
|
||||||
|
highlights = {
|
||||||
|
border = "Normal",
|
||||||
|
background = "Normal",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'Wansmer/treesj',
|
||||||
|
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue