Browse Source

feat: add flash.nvim

master
Tovi Jaeschke-Rogers 4 months ago
parent
commit
c86e696728
3 changed files with 29 additions and 5 deletions
  1. +1
    -0
      .config/nvim/lua/tovi/core/options.lua
  2. +14
    -0
      .config/nvim/lua/tovi/plugins/flash.lua
  3. +14
    -5
      .config/nvim/lua/tovi/plugins/lsp/lspconfig.lua

+ 1
- 0
.config/nvim/lua/tovi/core/options.lua View File

@ -44,3 +44,4 @@ vim.opt.splitright = true
vim.opt.termguicolors = true
vim.opt.cursorline = true

+ 14
- 0
.config/nvim/lua/tovi/plugins/flash.lua View File

@ -0,0 +1,14 @@
return {
"folke/flash.nvim",
event = "VeryLazy",
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
}

+ 14
- 5
.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua View File

@ -88,6 +88,7 @@ return {
-- override default floating window border if not set
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
---@diagnostic disable-next-line: duplicate-set-field
function vim.lsp.util.open_floating_preview(contents, syntax, options, ...)
options = options or {}
options.border = options.border or "rounded"
@ -112,6 +113,9 @@ return {
-- Function to detect the operating system
local function get_os()
local handle = io.popen('uname')
if not handle then
return error("Failed to detect operating system")
end
local result = handle:read("*a")
handle:close()
return result:lower():gsub("%s+", "")
@ -165,7 +169,11 @@ return {
lspconfig.volar.setup({
-- capabilities = capabilities,
on_attach = on_attach,
filetypes = { "vue" },
filetypes = {
"javascript",
"typescript",
"vue",
},
on_new_config = function(new_config, new_root_dir)
new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir)
end,
@ -180,11 +188,12 @@ return {
-- configure php server
lspconfig["intelephense"].setup({
root_dir = function(pattern)
local cwd = vim.loop.cwd()
local root = util.root_pattern('composer.json')(pattern)
---@diagnostic disable-next-line: undefined-field
local cwd = vim.loop.cwd()
local root = util.root_pattern('composer.json')(pattern)
-- prefer cwd if root is a descendant
return util.path.is_descendant(cwd, root) and cwd or root
-- prefer cwd if root is a descendant
return util.path.is_descendant(cwd, root) and cwd or root
end,
capabilities = capabilities,
on_attach = on_attach,


Loading…
Cancel
Save