refactor config to follow nvchad conventions
- Create separate config files for telescope and nvim-tree in lua/configs/ - Fix plugin syntax (requires -> dependencies for lazy.nvim) - Consolidate duplicate settings into appropriate files - Move plugin configs out of options.lua and mappings.lua - Clean up init.lua to only contain SQL autocmds Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fce7919f72
commit
9b578f964b
16
init.lua
16
init.lua
@ -37,6 +37,7 @@ vim.schedule(function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
------added------------
|
------added------------
|
||||||
|
-- SQL-specific settings
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "sql",
|
pattern = "sql",
|
||||||
callback = function()
|
callback = function()
|
||||||
@ -44,17 +45,8 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.opt.conceallevel = 1 -- or 0, or 2, depending on your preference
|
-- pgformatter for SQL files
|
||||||
|
|
||||||
-- pgformatter
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "sql",
|
pattern = "sql",
|
||||||
-- command = "setlocal formatprg=/usr/local/bin/pg_format\\ --comma-start\\ -",
|
command = "setlocal formatprg=/usr/local/bin/pg_format\\ -",
|
||||||
command = "setlocal formatprg=/usr/local/bin/pg_format\\ -",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- set tab spacing
|
|
||||||
vim.opt.expandtab = true -- Use spaces instead of tabs
|
|
||||||
vim.opt.shiftwidth = 4 -- Number of spaces for each indentation level
|
|
||||||
vim.opt.tabstop = 4 -- Number of spaces a tab counts for
|
|
||||||
vim.opt.softtabstop = 4 -- Number of spaces a tab feels like when editing
|
|
||||||
|
|||||||
43
lua/configs/nvimtree.lua
Normal file
43
lua/configs/nvimtree.lua
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
local options = {
|
||||||
|
filters = {
|
||||||
|
enable = true,
|
||||||
|
git_ignored = false,
|
||||||
|
dotfiles = false,
|
||||||
|
git_clean = false,
|
||||||
|
no_buffer = false,
|
||||||
|
no_bookmark = false,
|
||||||
|
custom = {},
|
||||||
|
exclude = {},
|
||||||
|
},
|
||||||
|
disable_netrw = true,
|
||||||
|
hijack_cursor = true,
|
||||||
|
sync_root_with_cwd = true,
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
update_root = false,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
width = 30,
|
||||||
|
preserve_window_proportions = true,
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
root_folder_label = false,
|
||||||
|
highlight_git = true,
|
||||||
|
indent_markers = { enable = true },
|
||||||
|
icons = {
|
||||||
|
glyphs = {
|
||||||
|
default = "",
|
||||||
|
folder = {
|
||||||
|
default = "",
|
||||||
|
empty = "",
|
||||||
|
empty_open = "",
|
||||||
|
open = "",
|
||||||
|
symlink = "",
|
||||||
|
},
|
||||||
|
git = { unmerged = "" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
15
lua/configs/telescope.lua
Normal file
15
lua/configs/telescope.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
local actions = require('telescope.actions')
|
||||||
|
|
||||||
|
require('telescope').setup {
|
||||||
|
defaults = {
|
||||||
|
layout_config = {
|
||||||
|
prompt_position = "top"
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -23,21 +23,6 @@ vim.api.nvim_set_keymap('v', '<leader>fl', ':ObsidianLink<CR>', { noremap = true
|
|||||||
vim.api.nvim_set_keymap("n", "<leader>p1", "A 🔼<Esc>", { noremap = true, silent = true })
|
vim.api.nvim_set_keymap("n", "<leader>p1", "A 🔼<Esc>", { noremap = true, silent = true })
|
||||||
vim.api.nvim_set_keymap("n", "<leader>p2", "A ⏫<Esc>", { noremap = true, silent = true })
|
vim.api.nvim_set_keymap("n", "<leader>p2", "A ⏫<Esc>", { noremap = true, silent = true })
|
||||||
|
|
||||||
-- Configure Telescope to scroll files with ctrl+j/k
|
|
||||||
local actions = require('telescope.actions')
|
|
||||||
-- local sorters = require('telescope.sorters')
|
|
||||||
|
|
||||||
require('telescope').setup {
|
|
||||||
defaults = {
|
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
["<C-j>"] = actions.move_selection_next,
|
|
||||||
["<C-k>"] = actions.move_selection_previous,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Live grep all files (including gitignored and hidden files)
|
-- Live grep all files (including gitignored and hidden files)
|
||||||
vim.keymap.set("n", "<leader>fW", function()
|
vim.keymap.set("n", "<leader>fW", function()
|
||||||
require('telescope.builtin').live_grep({
|
require('telescope.builtin').live_grep({
|
||||||
@ -61,13 +46,6 @@ vim.api.nvim_set_keymap('n', '<Down>', '5<C-w>-', { silent = true })
|
|||||||
vim.api.nvim_set_keymap('n', '<Right>', '10<C-w>>', { silent = true })
|
vim.api.nvim_set_keymap('n', '<Right>', '10<C-w>>', { silent = true })
|
||||||
vim.api.nvim_set_keymap('n', '<Left>', '10<C-w><', { silent = true })
|
vim.api.nvim_set_keymap('n', '<Left>', '10<C-w><', { silent = true })
|
||||||
|
|
||||||
-- Set the tab width to 4 spaces
|
|
||||||
vim.cmd('set tabstop=4')
|
|
||||||
vim.cmd('set shiftwidth=4')
|
|
||||||
vim.cmd('set expandtab')
|
|
||||||
|
|
||||||
vim.o.hidden = true
|
|
||||||
|
|
||||||
-- wrap selected text in single quotes
|
-- wrap selected text in single quotes
|
||||||
vim.keymap.set('x', "<leader>'", function()
|
vim.keymap.set('x', "<leader>'", function()
|
||||||
local text = vim.fn.getreg('"') -- Get the visually selected text
|
local text = vim.fn.getreg('"') -- Get the visually selected text
|
||||||
|
|||||||
@ -2,55 +2,14 @@ require "nvchad.options"
|
|||||||
|
|
||||||
-- add yours here!
|
-- add yours here!
|
||||||
|
|
||||||
-- local o = vim.o
|
local opt = vim.opt
|
||||||
-- o.cursorlineopt ='both' -- to enable cursorline!
|
|
||||||
require('telescope').setup{
|
|
||||||
defaults = {
|
|
||||||
layout_config = {
|
|
||||||
prompt_position = "top"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require('nvim-tree').setup{
|
-- Tab settings
|
||||||
filters = {
|
opt.expandtab = true -- Use spaces instead of tabs
|
||||||
enable = true,
|
opt.shiftwidth = 4 -- Number of spaces for each indentation level
|
||||||
git_ignored = false,
|
opt.tabstop = 4 -- Number of spaces a tab counts for
|
||||||
dotfiles = false,
|
opt.softtabstop = 4 -- Number of spaces a tab feels like when editing
|
||||||
git_clean = false,
|
|
||||||
no_buffer = false,
|
-- Other options
|
||||||
no_bookmark = false,
|
opt.conceallevel = 1 -- Conceal level for markdown, etc.
|
||||||
custom = {},
|
opt.hidden = true -- Allow hidden buffers
|
||||||
exclude = {},
|
|
||||||
},
|
|
||||||
-- filters = { dotfiles = false },
|
|
||||||
disable_netrw = true,
|
|
||||||
hijack_cursor = true,
|
|
||||||
sync_root_with_cwd = true,
|
|
||||||
update_focused_file = {
|
|
||||||
enable = true,
|
|
||||||
update_root = false,
|
|
||||||
},
|
|
||||||
view = {
|
|
||||||
width = 30,
|
|
||||||
preserve_window_proportions = true,
|
|
||||||
},
|
|
||||||
renderer = {
|
|
||||||
root_folder_label = false,
|
|
||||||
highlight_git = true,
|
|
||||||
indent_markers = { enable = true },
|
|
||||||
icons = {
|
|
||||||
glyphs = {
|
|
||||||
default = "",
|
|
||||||
folder = {
|
|
||||||
default = "",
|
|
||||||
empty = "",
|
|
||||||
empty_open = "",
|
|
||||||
open = "",
|
|
||||||
symlink = "",
|
|
||||||
},
|
|
||||||
git = { unmerged = "" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ return {
|
|||||||
opts = require "configs.conform",
|
opts = require "configs.conform",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- These are some examples, uncomment them if you want to see them work!
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
config = function()
|
config = function()
|
||||||
@ -13,16 +12,17 @@ return {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
'nvim-telescope/telescope.nvim',
|
"nvim-tree/nvim-tree.lua",
|
||||||
requires = { {'nvim-lua/plenary.nvim'} },
|
opts = require "configs.nvimtree",
|
||||||
config = function()
|
},
|
||||||
require('telescope').setup {
|
|
||||||
defaults = {
|
{
|
||||||
-- Your default configuration for Telescope (optional)
|
'nvim-telescope/telescope.nvim',
|
||||||
}
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
}
|
config = function()
|
||||||
end
|
require "configs.telescope"
|
||||||
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user