Modularized all my plugins
This commit is contained in:
parent
a467ba4a69
commit
86b269d5f9
|
@ -0,0 +1,3 @@
|
|||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
|
@ -1,4 +1,4 @@
|
|||
column_width = 100
|
||||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
|
|
14
init.lua
14
init.lua
|
@ -24,7 +24,7 @@ If you experience any errors while trying to install kickstart, run `:checkhealt
|
|||
--]]
|
||||
|
||||
-- The file rakshit/core/options.lua will be storing all the options that we want to save n our file
|
||||
require 'rakshit.core'
|
||||
require('rakshit.core')
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = true
|
||||
|
@ -43,8 +43,18 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
end,
|
||||
})
|
||||
|
||||
require('rakshit.lazy')
|
||||
-- Configure Neovim tab settings for Go files
|
||||
-- vim.api.nvim_create_autocmd('FileType', {
|
||||
-- pattern = 'go',
|
||||
-- callback = function()
|
||||
-- vim.bo.expandtab = true -- Use spaces instead of tabs
|
||||
-- vim.bo.tabstop = 4 -- Display each tab as 4 spaces
|
||||
-- vim.bo.shiftwidth = 4 -- Indentation size of 4 spaces
|
||||
-- vim.bo.softtabstop = 4 -- <Tab> key inserts 4 spaces
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
require('rakshit.lazy')
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
|
@ -1,105 +1 @@
|
|||
-- debug.lua
|
||||
--
|
||||
-- Shows how to use the DAP plugin to debug your code.
|
||||
--
|
||||
-- Primarily focused on configuring the debugger for Go, but can
|
||||
-- be extended to other languages as well. That's why it's called
|
||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||
|
||||
return {
|
||||
-- NOTE: Yes, you can install new plugins here!
|
||||
'mfussenegger/nvim-dap',
|
||||
-- NOTE: And you can specify dependencies as well
|
||||
dependencies = {
|
||||
-- Creates a beautiful debugger UI
|
||||
'rcarriga/nvim-dap-ui',
|
||||
|
||||
-- Required dependency for nvim-dap-ui
|
||||
'nvim-neotest/nvim-nio',
|
||||
|
||||
-- Installs the debug adapters for you
|
||||
'williamboman/mason.nvim',
|
||||
'jay-babu/mason-nvim-dap.nvim',
|
||||
|
||||
-- Add your own debuggers here
|
||||
'leoluz/nvim-dap-go',
|
||||
},
|
||||
keys = function(_, keys)
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
return {
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
{ '<F5>', dap.continue, desc = 'Debug: Start/Continue' },
|
||||
{ '<F1>', dap.step_into, desc = 'Debug: Step Into' },
|
||||
{ '<F2>', dap.step_over, desc = 'Debug: Step Over' },
|
||||
{ '<F3>', dap.step_out, desc = 'Debug: Step Out' },
|
||||
{ '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
|
||||
{
|
||||
'<leader>B',
|
||||
function()
|
||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||
end,
|
||||
desc = 'Debug: Set Breakpoint',
|
||||
},
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
{ '<F7>', dapui.toggle, desc = 'Debug: See last session result.' },
|
||||
unpack(keys),
|
||||
}
|
||||
end,
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
|
||||
require('mason-nvim-dap').setup {
|
||||
-- Makes a best effort to setup the various debuggers with
|
||||
-- reasonable debug configurations
|
||||
automatic_installation = true,
|
||||
|
||||
-- You can provide additional configuration to the handlers,
|
||||
-- see mason-nvim-dap README for more information
|
||||
handlers = {},
|
||||
|
||||
-- You'll need to check that you have the required things installed
|
||||
-- online, please don't ask me how to install them :)
|
||||
ensure_installed = {
|
||||
-- Update this to ensure that you have the debuggers for the langs you want
|
||||
'delve',
|
||||
},
|
||||
}
|
||||
|
||||
-- Dap UI setup
|
||||
-- For more information, see |:help nvim-dap-ui|
|
||||
dapui.setup {
|
||||
-- Set icons to characters that are more likely to work in every terminal.
|
||||
-- Feel free to remove or use ones that you like more! :)
|
||||
-- Don't feel like these are good choices.
|
||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||
controls = {
|
||||
icons = {
|
||||
pause = '⏸',
|
||||
play = '▶',
|
||||
step_into = '⏎',
|
||||
step_over = '⏭',
|
||||
step_out = '⏮',
|
||||
step_back = 'b',
|
||||
run_last = '▶▶',
|
||||
terminate = '⏹',
|
||||
disconnect = '⏏',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
|
||||
-- Install golang specific config
|
||||
require('dap-go').setup {
|
||||
delve = {
|
||||
-- On Windows delve must be run attached or it crashes.
|
||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||
detached = vim.fn.has 'win32' == 0,
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
return {}
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
-- debug.lua
|
||||
--
|
||||
-- Shows how to use the DAP plugin to debug your code.
|
||||
--
|
||||
-- Primarily focused on configuring the debugger for Go, but can
|
||||
-- be extended to other languages as well. That's why it's called
|
||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||
|
||||
return {}
|
||||
-- -- NOTE: Yes, you can install new plugins here!
|
||||
-- 'mfussenegger/nvim-dap',
|
||||
-- -- NOTE: And you can specify dependencies as well
|
||||
-- dependencies = {
|
||||
-- -- Creates a beautiful debugger UI
|
||||
-- 'rcarriga/nvim-dap-ui',
|
||||
--
|
||||
-- -- Required dependency for nvim-dap-ui
|
||||
-- 'nvim-neotest/nvim-nio',
|
||||
--
|
||||
-- -- Installs the debug adapters for you
|
||||
-- 'williamboman/mason.nvim',
|
||||
-- 'jay-babu/mason-nvim-dap.nvim',
|
||||
--
|
||||
-- -- Add your own debuggers here
|
||||
-- 'leoluz/nvim-dap-go',
|
||||
-- },
|
||||
-- keys = function(_, keys)
|
||||
-- local dap = require('dap')
|
||||
-- local dapui = require('dapui')
|
||||
-- return {
|
||||
-- -- Basic debugging keymaps, feel free to change to your liking!
|
||||
-- { '<F5>', dap.continue, desc = 'Debug: Start/Continue' },
|
||||
-- { '<F1>', dap.step_into, desc = 'Debug: Step Into' },
|
||||
-- { '<F2>', dap.step_over, desc = 'Debug: Step Over' },
|
||||
-- { '<F3>', dap.step_out, desc = 'Debug: Step Out' },
|
||||
-- { '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
|
||||
-- {
|
||||
-- '<leader>B',
|
||||
-- function()
|
||||
-- dap.set_breakpoint(vim.fn.input('Breakpoint condition: '))
|
||||
-- end,
|
||||
-- desc = 'Debug: Set Breakpoint',
|
||||
-- },
|
||||
-- -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
-- { '<F7>', dapui.toggle, desc = 'Debug: See last session result.' },
|
||||
-- unpack(keys),
|
||||
-- }
|
||||
-- end,
|
||||
-- config = function()
|
||||
-- local dap = require('dap')
|
||||
-- local dapui = require('dapui')
|
||||
--
|
||||
-- require('mason-nvim-dap').setup({
|
||||
-- -- Makes a best effort to setup the various debuggers with
|
||||
-- -- reasonable debug configurations
|
||||
-- automatic_installation = true,
|
||||
--
|
||||
-- -- You can provide additional configuration to the handlers,
|
||||
-- -- see mason-nvim-dap README for more information
|
||||
-- handlers = {},
|
||||
--
|
||||
-- -- You'll need to check that you have the required things installed
|
||||
-- -- online, please don't ask me how to install them :)
|
||||
-- ensure_installed = {
|
||||
-- -- Update this to ensure that you have the debuggers for the langs you want
|
||||
-- 'delve',
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- -- Dap UI setup
|
||||
-- -- For more information, see |:help nvim-dap-ui|
|
||||
-- dapui.setup({
|
||||
-- -- Set icons to characters that are more likely to work in every terminal.
|
||||
-- -- Feel free to remove or use ones that you like more! :)
|
||||
-- -- Don't feel like these are good choices.
|
||||
-- icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||
-- controls = {
|
||||
-- icons = {
|
||||
-- pause = '⏸',
|
||||
-- play = '▶',
|
||||
-- step_into = '⏎',
|
||||
-- step_over = '⏭',
|
||||
-- step_out = '⏮',
|
||||
-- step_back = 'b',
|
||||
-- run_last = '▶▶',
|
||||
-- terminate = '⏹',
|
||||
-- disconnect = '⏏',
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||
-- dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
-- dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
--
|
||||
-- -- Install golang specific config
|
||||
-- require('dap-go').setup({
|
||||
-- delve = {
|
||||
-- -- On Windows delve must be run attached or it crashes.
|
||||
-- -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||
-- detached = vim.fn.has('win32') == 0,
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- }
|
|
@ -17,9 +17,11 @@ return { -- Autoformat
|
|||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 500,
|
||||
timeout_ms = 5000,
|
||||
},
|
||||
formatters_by_ft = {
|
||||
go = { 'goimports', 'gofmt' },
|
||||
terraform = { 'terraform_fmt' },
|
||||
lua = { 'stylua' },
|
||||
javascript = { 'prettier' },
|
||||
typescript = { 'prettier' },
|
||||
|
@ -33,7 +35,20 @@ return { -- Autoformat
|
|||
markdown = { 'prettier' },
|
||||
graphql = { 'prettier' },
|
||||
liquid = { 'prettier' },
|
||||
python = { 'isort', 'black' },
|
||||
-- python = { 'isort', 'black' },
|
||||
-- You can use a function here to determine the formatters dynamically
|
||||
python = function(bufnr)
|
||||
if require('conform').get_formatter_info('ruff_format', bufnr).available then
|
||||
return { 'ruff_format' }
|
||||
else
|
||||
return { 'isort', 'black' }
|
||||
end
|
||||
end,
|
||||
-- Use the "*" filetype to run formatters on all filetypes.
|
||||
['*'] = { 'codespell' },
|
||||
-- Use the "_" filetype to run formatters on filetypes that don't
|
||||
-- have other formatters configured.
|
||||
['_'] = { 'trim_whitespace' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
|
@ -41,4 +56,14 @@ return { -- Autoformat
|
|||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
},
|
||||
-- Configure Neovim tab settings for Go files
|
||||
-- vim.api.nvim_create_autocmd('FileType', {
|
||||
-- pattern = 'go',
|
||||
-- callback = function()
|
||||
-- -- vim.bo.expandtab = true -- Use spaces instead of tabs
|
||||
-- vim.bo.tabstop = 4 -- Display each tab as 4 spaces
|
||||
-- vim.bo.shiftwidth = 4 -- Indentation size of 4 spaces
|
||||
-- vim.bo.softtabstop = 4 -- <Tab> key inserts 4 spaces
|
||||
-- end,
|
||||
-- }),
|
||||
}
|
||||
|
|
|
@ -107,6 +107,17 @@ return {
|
|||
end,
|
||||
})
|
||||
|
||||
-- Configure Neovim tab settings for Go files [Go indendation]
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'go',
|
||||
callback = function()
|
||||
vim.bo.expandtab = true -- Use spaces instead of tabs
|
||||
vim.bo.tabstop = 4 -- Display each tab as 4 spaces
|
||||
vim.bo.shiftwidth = 4 -- Indentation size of 4 spaces
|
||||
vim.bo.softtabstop = 4 -- <Tab> key inserts 4 spaces
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
-- (not in youtube nvim video)
|
||||
|
|
|
@ -9,7 +9,7 @@ return { -- Autocompletion
|
|||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
-- Remove the below condition to re-enable on windows.
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
if vim.fn.has('win32') == 1 or vim.fn.executable('make') == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
|
@ -39,15 +39,15 @@ return { -- Autocompletion
|
|||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
local lspkind = require 'lspkind'
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
-- loads vscode style snippets from the installed plugins (e.g. friendly-snippets)
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
luasnip.config.setup {}
|
||||
luasnip.config.setup({})
|
||||
|
||||
cmp.setup {
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
|
@ -59,7 +59,7 @@ return { -- Autocompletion
|
|||
-- chosen, you will need to read `:help ins-completion`
|
||||
--
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- Select the [n]ext item
|
||||
-- ['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
-- Select the [p]revious item
|
||||
|
@ -77,12 +77,12 @@ return { -- Autocompletion
|
|||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
['<CR>'] = cmp.mapping.confirm { select = false },
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<C-Space>'] = cmp.mapping.complete({}),
|
||||
['<C-e>'] = cmp.mapping.abort(), -- close completion window
|
||||
|
||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
||||
|
@ -106,13 +106,13 @@ return { -- Autocompletion
|
|||
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
},
|
||||
}),
|
||||
sources = {
|
||||
{
|
||||
name = 'lazydev',
|
||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
group_index = 0,
|
||||
},
|
||||
-- {
|
||||
-- name = 'lazydev',
|
||||
-- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
-- group_index = 0,
|
||||
-- },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'buffer' },
|
||||
|
@ -121,11 +121,13 @@ return { -- Autocompletion
|
|||
|
||||
-- configure lspkind for VSCode like pictograms in completion menu
|
||||
-- formatting = {
|
||||
-- fields = cmp.ItemField.Abbr,
|
||||
-- expandable_indicator = true,
|
||||
-- format = lspkind.cmp_format({
|
||||
-- maxwidth = 50,
|
||||
-- ellipsis_char = '...',
|
||||
-- }),
|
||||
-- },
|
||||
}
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -2,22 +2,25 @@ return {
|
|||
'nvim-tree/nvim-tree.lua',
|
||||
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||
config = function()
|
||||
local nvimtree = require 'nvim-tree'
|
||||
local nvimtree = require('nvim-tree')
|
||||
|
||||
-- recommended settings from nvim-tree documentation
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
nvimtree.setup {
|
||||
nvimtree.setup({
|
||||
view = {
|
||||
width = 35,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
centralize_selection = true,
|
||||
},
|
||||
-- change folder arrow icons
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
add_trailing = true,
|
||||
icons = {
|
||||
glyphs = {
|
||||
folder = {
|
||||
|
@ -43,15 +46,23 @@ return {
|
|||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
-- set keymaps
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
keymap.set('n', '<leader>ee', '<cmd>NvimTreeToggle<CR>', { desc = 'Toggle file explorer' }) -- toggle file explorer
|
||||
keymap.set('n', '<leader>ef', '<cmd>NvimTreeFindFileToggle<CR>', { desc = 'Toggle file explorer on current file' }) -- toggle file explorer on current file
|
||||
keymap.set(
|
||||
'n',
|
||||
'<leader>ef',
|
||||
'<cmd>NvimTreeFindFileToggle<CR>',
|
||||
{ desc = 'Toggle file explorer on current file' }
|
||||
) -- toggle file explorer on current file
|
||||
-- keymap.set('n', '<C>)', '<cmd>NvimTreeFindFileToggle<CR>', { desc = 'Toggle file explorer on current file' }) -- toggle file explorer on current file
|
||||
keymap.set('n', '<leader>ec', '<cmd>NvimTreeCollapse<CR>', { desc = 'Collapse file explorer' }) -- collapse file explorer
|
||||
keymap.set('n', '<leader>er', '<cmd>NvimTreeRefresh<CR>', { desc = 'Refresh file explorer' }) -- refresh file explorer
|
||||
|
||||
-- New ones I'm adding just for testing and hopefully that works
|
||||
-- keymap.set('n', 'h', '<cmd>NvimTreeCollapse<CR>', { desc = 'Collapse file explorer' }) -- collapse file explorer
|
||||
end,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue