Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"typescript": {},
"json": {},
"markdown": {},
"toml": {},
"malva": {},
"markup": {},
"yaml": {},
"plugins": [
"https://plugins.dprint.dev/typescript-0.96.1.wasm",
"https://plugins.dprint.dev/json-0.23.0.wasm",
"https://plugins.dprint.dev/markdown-0.22.1.wasm",
"https://plugins.dprint.dev/toml-0.7.0.wasm",
"https://plugins.dprint.dev/g-plane/malva-v0.16.0.wasm",
"https://plugins.dprint.dev/g-plane/markup_fmt-v0.27.3.wasm",
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.6.0.wasm"
]
}
142 changes: 121 additions & 21 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ do
vim.g.maplocalleader = ' '

-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true

-- [[ Setting options ]]
-- See `:help vim.o`
Expand All @@ -122,7 +122,9 @@ do
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
vim.schedule(function()
-- vim.opt.clipboard = 'unnamedplus'
end)

-- Enable break indent
vim.o.breakindent = true
Expand Down Expand Up @@ -217,7 +219,7 @@ do
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })

-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
Expand Down Expand Up @@ -430,7 +432,17 @@ do
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup()
require('mini.surround').setup {
mappings = {
add = 'ra',
delete = 'rd',
find = 'rf',
find_left = 'rF',
highlight = 'rh',
replace = 'rr',
update_n_lines = 'rn',
},
}

-- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
Expand Down Expand Up @@ -494,12 +506,16 @@ do
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
-- pickers = {}
defaults = {
file_ignore_patterns = {
'node_modules',
'package-lock.json',
'yarn.lock',
'pnpm-lock.yaml',
'lazy-lock.json',
},
mappings = {},
},
extensions = {
['ui-select'] = { require('telescope.themes').get_dropdown() },
},
Expand Down Expand Up @@ -692,7 +708,9 @@ do
-- See `:help lsp-config` for information about keys and how to configure
---@type table<string, vim.lsp.Config>
local servers = {
-- clangd = {},
clangd = {
cmd = { 'clangd', '--background-index' },
},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
Expand All @@ -701,7 +719,7 @@ do
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- ts_ls = {},
vtsls = {},

stylua = {}, -- Used to format Lua code

Expand Down Expand Up @@ -760,6 +778,20 @@ do
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
-- You can add other tools here that you want Mason to install
'stylua',
'tailwindcss',
'html',
'intelephense',
'pretty-php',
'svelte',
'vtsls',
'gofumpt',
'gopls',
'shfmt',
'rust-analyzer',
'ruff',
'biome',
'clang-format',
})

require('mason-tool-installer').setup { ensure_installed = ensure_installed }
Expand All @@ -784,6 +816,22 @@ do
local enabled_filetypes = {
-- lua = true,
-- python = true,
javascript = true,
typescript = true,
javascriptreact = true,
typescriptreact = true,
scss = true,
pandoc = true,
markdown = true,
json = true,
css = true,
yml = true,
html = true,
php = true,
cpp = true,
sh = true,
go = true,
python = true,
}
if enabled_filetypes[vim.bo[bufnr].filetype] then
return { timeout_ms = 500 }
Expand All @@ -794,14 +842,41 @@ do
default_format_opts = {
lsp_format = 'fallback', -- Use external formatters if configured below, otherwise use LSP formatting. Set to `false` to disable LSP formatting entirely.
},
formatters = {
['pretty-php'] = {
prepend_args = { '-s2' },
},
},
-- You can also specify external formatters in here.
formatters_by_ft = {
-- rust = { 'rustfmt' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
javascript = { 'biome' },
typescript = { 'biome' },
javascriptreact = { 'biome' },
typescriptreact = { 'biome' },
scss = { 'biome' },
pandoc = { 'biome' },
markdown = { 'biome' },
json = { 'biome' },
css = { 'biome' },
yml = { 'biome' },
html = { 'biome' },
php = { 'pretty-php' },
cpp = { 'clang_format' },
sh = { 'shfmt' },
go = { 'gofumpt' },
python = {
-- To fix auto-fixable lint errors
'ruff_fix',
-- To run the Ruff formatter
'ruff_format',
-- To organize the imports
'ruff_organize_imports',
},
},
}

Expand All @@ -820,12 +895,20 @@ do
vim.pack.add { { src = gh 'L3MON4D3/LuaSnip', version = vim.version.range '2.*' } }
require('luasnip').setup {}

local ls = require 'luasnip'
ls.config.set_config {
store_selection_keys = '<tab>',
}
ls.filetype_extend('svelte', { 'typescript', 'html' })

-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
--
-- vim.pack.add { gh 'rafamadriz/friendly-snippets' }
-- require('luasnip.loaders.from_vscode').lazy_load()
require('luasnip.loaders.from_vscode').load {
paths = { '~/git/friendly-snippets' },
}

-- [[ Autocomplete Engine ]]
vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' } }
Expand All @@ -852,7 +935,13 @@ do
-- <c-k>: Toggle signature help
--
-- See `:help blink-cmp-config-keymap` for defining your own keymap
preset = 'default',
preset = 'enter',
['<C-x>'] = {
function(cmp) cmp.show() end,
'show',
'show_documentation',
'hide_documentation',
},

-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
Expand Down Expand Up @@ -888,6 +977,15 @@ do
-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
}

-- Luasnip choice node navigation
vim.keymap.set({ 'i', 's' }, '<C-l>', function()
if require('luasnip').choice_active() then require('luasnip').change_choice(1) end
end, { desc = 'LuaSnip: next choice' })

vim.keymap.set({ 'i', 's' }, '<C-h>', function()
if require('luasnip').choice_active() then require('luasnip').change_choice(-1) end
end, { desc = 'LuaSnip: previous choice' })
end

-- ============================================================
Expand All @@ -903,6 +1001,8 @@ do
-- NOTE: You can also specify a branch or a specific commit
vim.pack.add { { src = gh 'nvim-treesitter/nvim-treesitter', version = 'main' } }

require('nvim-treesitter.install').compilers = { 'clang', 'gcc', 'zig' }

-- Ensure basic parsers are installed
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
require('nvim-treesitter').install(parsers)
Expand Down Expand Up @@ -966,17 +1066,17 @@ do
-- Here are some example plugins that I've included in the Kickstart repository.
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
--
-- require 'kickstart.plugins.debug'
-- require 'kickstart.plugins.indent_line'
-- require 'kickstart.plugins.lint'
-- require 'kickstart.plugins.autopairs'
-- require 'kickstart.plugins.neo-tree'
require 'kickstart.plugins.debug'
require 'kickstart.plugins.indent_line'
require 'kickstart.plugins.lint'
require 'kickstart.plugins.autopairs'
require 'kickstart.plugins.neo-tree'
-- require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps

-- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- require 'custom.plugins'
require 'custom.plugins'
end

-- The line beneath this is called `modeline`. See `:help modeline`
Expand Down
Loading
Loading