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
91 changes: 74 additions & 17 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ vim.g.mapleader = ' '
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 Down Expand Up @@ -219,6 +219,8 @@ vim.api.nvim_create_autocmd('TextYankPost', {
end,
})

vim.lsp.enable 'tsgo'

-- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
Expand Down Expand Up @@ -427,15 +429,15 @@ require('lazy').setup({
-- See `:help telescope.builtin`
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
-- vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
-- vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
-- vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
-- vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
-- vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
-- vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
-- vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })

-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function()
Expand Down Expand Up @@ -655,6 +657,14 @@ require('lazy').setup({
},
}

vim.keymap.set('n', '[d', function()
vim.diagnostic.jump { count = -1, float = true }
end, { desc = 'Go to previous diagnostic with float' })

vim.keymap.set('n', ']d', function()
vim.diagnostic.jump { count = 1, float = true }
end, { desc = 'Go to next diagnostic with float' })

-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
Expand Down Expand Up @@ -682,7 +692,17 @@ require('lazy').setup({
--
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- ts_ls = {},
--
-- vtsls = {
-- settings = {
-- typescript = {
-- preferences = {
-- includeCompletionsForModuleExports = true,
-- includeCompletionsForImportStatements = true,
-- importModuleSpecifier = 'non-relative',
-- },
-- },
-- },
-- },

lua_ls = {
-- cmd = { ... },
Expand Down Expand Up @@ -768,6 +788,11 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
astro = { 'biome', 'prettierd' },
javascript = { 'biome', 'prettierd' },
typescript = { 'biome', 'prettierd' },
javascriptreact = { 'biome', 'prettierd' },
typescriptreact = { 'biome', 'prettierd' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
Expand Down Expand Up @@ -850,11 +875,24 @@ require('lazy').setup({
completion = {
-- By default, you may press `<c-space>` to show the documentation.
-- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = false, auto_show_delay_ms = 500 },
documentation = { auto_show = true, auto_show_delay_ms = 500 },
accept = {
auto_brackets = {
kind_resolution = {
blocked_filetypes = { 'typescriptreact', 'javascriptreact', 'vue', 'astro' },
},
semantic_token_resolution = {
blocked_filetypes = { 'java', 'astro' },
},
},
},
},

sources = {
default = { 'lsp', 'path', 'snippets', 'lazydev' },
default = { 'lsp', 'path', 'snippets' },
per_filetype = {
lua = { inherit_defaults = true, 'lazydev' },
},
providers = {
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
},
Expand All @@ -872,7 +910,7 @@ require('lazy').setup({
fuzzy = { implementation = 'lua' },

-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
signature = { enabled = true, window = { show_documentation = true } },
},
},

Expand Down Expand Up @@ -917,7 +955,20 @@ require('lazy').setup({
-- - 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 {
custom_surroundings = {
T = {
input = { '<(%w+)[^<>]->.-</%1>', '^<()%w+().*</()%w+()>$' },
output = function()
local tag_name = MiniSurround.user_input 'Tag name'
if tag_name == nil then
return nil
end
return { left = tag_name, right = tag_name }
end,
},
},
}

-- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
Expand All @@ -934,6 +985,10 @@ require('lazy').setup({
return '%2l:%-2v'
end

require('mini.pairs').setup()

require('mini.move').setup()

-- ... and there is more!
-- Check out: https://github.com/echasnovski/mini.nvim
end,
Expand All @@ -942,6 +997,8 @@ require('lazy').setup({
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
dependencies = { 'OXY2DEV/markview.nvim' },
lazy = false,
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
Expand Down Expand Up @@ -974,17 +1031,17 @@ require('lazy').setup({
-- 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.indent_line',
-- require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree',
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps

-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
Expand Down
5 changes: 5 additions & 0 deletions lsp/tsgo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
return {
cmd = { 'tsgo', '--lsp', '--stdio' },
filteypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' },
root_markers = { 'tsconfig.json', 'package.json', '.git' },
}
Loading