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)
|
||||
|
||||
------added------------
|
||||
-- SQL-specific settings
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "sql",
|
||||
callback = function()
|
||||
@ -44,17 +45,8 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
vim.opt.conceallevel = 1 -- or 0, or 2, depending on your preference
|
||||
|
||||
-- pgformatter
|
||||
-- pgformatter for SQL files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "sql",
|
||||
-- command = "setlocal formatprg=/usr/local/bin/pg_format\\ --comma-start\\ -",
|
||||
command = "setlocal formatprg=/usr/local/bin/pg_format\\ -",
|
||||
pattern = "sql",
|
||||
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>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)
|
||||
vim.keymap.set("n", "<leader>fW", function()
|
||||
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', '<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
|
||||
vim.keymap.set('x', "<leader>'", function()
|
||||
local text = vim.fn.getreg('"') -- Get the visually selected text
|
||||
|
||||
@ -2,55 +2,14 @@ require "nvchad.options"
|
||||
|
||||
-- add yours here!
|
||||
|
||||
-- local o = vim.o
|
||||
-- o.cursorlineopt ='both' -- to enable cursorline!
|
||||
require('telescope').setup{
|
||||
defaults = {
|
||||
layout_config = {
|
||||
prompt_position = "top"
|
||||
}
|
||||
}
|
||||
}
|
||||
local opt = vim.opt
|
||||
|
||||
require('nvim-tree').setup{
|
||||
filters = {
|
||||
enable = true,
|
||||
git_ignored = false,
|
||||
dotfiles = false,
|
||||
git_clean = false,
|
||||
no_buffer = false,
|
||||
no_bookmark = false,
|
||||
custom = {},
|
||||
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 = "" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
-- Tab settings
|
||||
opt.expandtab = true -- Use spaces instead of tabs
|
||||
opt.shiftwidth = 4 -- Number of spaces for each indentation level
|
||||
opt.tabstop = 4 -- Number of spaces a tab counts for
|
||||
opt.softtabstop = 4 -- Number of spaces a tab feels like when editing
|
||||
|
||||
-- Other options
|
||||
opt.conceallevel = 1 -- Conceal level for markdown, etc.
|
||||
opt.hidden = true -- Allow hidden buffers
|
||||
|
||||
@ -5,7 +5,6 @@ return {
|
||||
opts = require "configs.conform",
|
||||
},
|
||||
|
||||
-- These are some examples, uncomment them if you want to see them work!
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
@ -13,16 +12,17 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { {'nvim-lua/plenary.nvim'} },
|
||||
config = function()
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
-- Your default configuration for Telescope (optional)
|
||||
}
|
||||
}
|
||||
end
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
opts = require "configs.nvimtree",
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
require "configs.telescope"
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user