Compare commits
2 Commits
fce7919f72
...
59e9fe7923
| Author | SHA1 | Date | |
|---|---|---|---|
| 59e9fe7923 | |||
| 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
|
||||
|
||||
@ -1,15 +1,25 @@
|
||||
local options = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
sql = { "pg_format", "sqlfluff" }, -- pg_format first, fallback to sqlfluff
|
||||
json = { "jq" },
|
||||
markdown = { "mdformat" },
|
||||
-- css = { "prettier" },
|
||||
-- html = { "prettier" },
|
||||
},
|
||||
|
||||
-- format_on_save = {
|
||||
-- -- These options will be passed to conform.format()
|
||||
-- timeout_ms = 500,
|
||||
-- lsp_fallback = true,
|
||||
-- },
|
||||
-- no format_on_save (manual-only)
|
||||
formatters = {
|
||||
pg_format = {
|
||||
prepend_args = {
|
||||
"--keyword-case", "2", -- 1 = UPPER, 2 = lower
|
||||
"--function-case", "2", -- 2 = lower
|
||||
"--spaces", "4",
|
||||
},
|
||||
},
|
||||
sqlfluff = {
|
||||
args = { "fix", "--force", "--dialect", "postgres", "-" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return options
|
||||
|
||||
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
|
||||
@ -79,3 +57,6 @@ vim.keymap.set('x', '<leader>"', function()
|
||||
local text = vim.fn.getreg('"') -- Get the visually selected text
|
||||
vim.cmd('normal! c"' .. text .. '"')
|
||||
end, { desc = "Wrap selected text in double quotes" })
|
||||
|
||||
-- Gitsigns blame current line
|
||||
vim.keymap.set("n", "<leader>gb", ":Gitsigns blame_line<CR>", { noremap = true, silent = true, desc = "Git blame line" })
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,11 +1,25 @@
|
||||
return {
|
||||
-- Conform (formatter)
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
-- event = 'BufWritePre', -- uncomment for format on save
|
||||
opts = require "configs.conform",
|
||||
lazy = false,
|
||||
cmd = { "ConformInfo", "ConformFormat" }, -- enables :ConformInfo before load
|
||||
keys = {
|
||||
{
|
||||
"g+w",
|
||||
function()
|
||||
require("conform").format({ async = false, lsp_fallback = true })
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Format file (Conform)",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("conform").setup(require "configs.conform")
|
||||
end,
|
||||
},
|
||||
|
||||
-- These are some examples, uncomment them if you want to see them work!
|
||||
-- LSP
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
@ -13,25 +27,28 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { {'nvim-lua/plenary.nvim'} },
|
||||
config = function()
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
-- Your default configuration for Telescope (optional)
|
||||
}
|
||||
}
|
||||
end
|
||||
-- File explorer
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
opts = require "configs.nvimtree",
|
||||
},
|
||||
|
||||
-- Telescope
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
require "configs.telescope"
|
||||
end
|
||||
},
|
||||
|
||||
-- Treesitter
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- Enable Treesitter syntax highlighting
|
||||
ensure_installed = { "markdown", "sql","vim",
|
||||
"lua", "vimdoc", "html", "css" }, -- add other languages if needed
|
||||
ensure_installed = { "markdown", "sql", "vim", "lua", "vimdoc", "html", "css" },
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { "markdown" },
|
||||
@ -39,10 +56,21 @@ return {
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Transparent
|
||||
{
|
||||
'xiyaowong/transparent.nvim',
|
||||
lazy = false
|
||||
}
|
||||
'xiyaowong/transparent.nvim',
|
||||
lazy = false
|
||||
},
|
||||
|
||||
-- Mason (to install formatters like pgformatter/sqlfluff)
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = { "Mason", "MasonInstall", "MasonUpdate" },
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end,
|
||||
},
|
||||
-- {
|
||||
-- "nvim-treesitter/nvim-treesitter",
|
||||
-- opts = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user