Using Ghostty:
- v1.0.1
- Build 8696
- Commit 3f7c3afa
And NVim:
- v0.10.3
- LuaJIT 2.1.1734355927
-- ~/.config/nvim/init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = ","
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- add your plugins here
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
}
},
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
},
{
"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" },
},
},
{
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
-- use opts = {} for passing setup options
-- this is equivalent to setup({}) function
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup({})
end
},
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({})
end
},
{
"lewis6991/hover.nvim",
config = function()
require("hover").setup({
init = function()
-- Require providers
require("hover.providers.lsp")
require('hover.providers.gh')
require('hover.providers.gh_user')
-- require('hover.providers.jira')
-- require('hover.providers.dap')
require('hover.providers.fold_preview')
require('hover.providers.diagnostic')
require('hover.providers.man')
require('hover.providers.dictionary')
end,
preview_opts = {
border = 'single'
},
-- Whether the contents of a currently open hover window should be moved
-- to a :h preview-window when pressing the hover keymap.
preview_window = false,
title = true,
mouse_providers = {
'LSP'
},
mouse_delay = 300
})
-- Setup keymaps
vim.keymap.set("n", "K", require("hover").hover, {desc = "hover.nvim"})
vim.keymap.set("n", "gK", require("hover").hover_select, {desc = "hover.nvim (select)"})
vim.keymap.set("n", "<C-p>", function() require("hover").hover_switch("previous") end, {desc = "hover.nvim (previous source)"})
vim.keymap.set("n", "<C-n>", function() require("hover").hover_switch("next") end, {desc = "hover.nvim (next source)"})
-- Mouse support
-- vim.keymap.set('n', '<MouseMove>', require('hover').hover_mouse, { desc = "hover.nvim (mouse)" })
-- vim.o.mousemoveevent = true
end
},
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
lspconfig.elixirls.setup({
-- you need to specify the executable command mannualy for elixir-ls
cmd = { "elixir-ls" },
-- set default capabilities for cmp lsp completion source
capabilities = capabilities,
filetypes = { "elixir", "eelixir", "heex", "surface", "exs" },
})
lspconfig.tailwindcss.setup({
init_options = {
userLanguages = {
elixir = "html-eex",
eelixir = "html-eex",
heex = "html-eex",
},
},
validate = true
})
end,
},
{
"nvim-treesitter/nvim-treesitter",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "elixir", "eex", "heex", "erlang", "html" },
highlight = { enable = true },
indent = { enable = true },
})
end,
},
{
"hrsh7th/nvim-cmp",
dependencies = {
-- install different completion source
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
},
config = function()
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require("cmp")
cmp.setup({
-- add different completion source
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "path" },
}),
-- using default mapping preset
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
snippet = {
-- you must specify a snippet engine
expand = function(args)
-- using neovim v0.10 native snippet feature
-- you can also use other snippet engines
vim.snippet.expand(args.body)
end,
},
})
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
end,
},
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "catppuccin" } },
-- automatically check for plugin updates
checker = { enabled = true },
})
function custom_fold_text()
local line = vim.fn.getline(vim.v.foldstart)
local line_count = vim.v.foldend - vim.v.foldstart + 1
return " ā” " .. line .. ": " .. line_count .. " lines"
end
vim.opt.encoding = "utf-8"
vim.cmd.colorscheme "catppuccin-frappe"
vim.opt.updatetime = 100
vim.opt.number = true
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.listchars = {
tab = "tab",
trail = "Ā·",
nbsp = "Ā·"
}
vim.opt.list = true
vim.opt.foldcolumn = "0"
vim.opt.foldlevelstart = 99
vim.opt.foldnestmax = 4
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt.foldenable = true
vim.opt.foldtext = "v:lua.custom_fold_text()"
vim.api.nvim_create_autocmd({"BufWinLeave"}, {
pattern = {"*.*"},
desc = "save view (folds), when closing file",
command = "mkview",
})
vim.api.nvim_create_autocmd({"BufWinEnter"}, {
pattern = {"*.*"},
desc = "load view (folds), when opening file",
command = "silent! loadview"
})
vim.keymap.set("n", "<D-/>", "gcc", { remap = true })
vim.keymap.set("v", "<D-/>", "gc", { remap = true })
vim.keymap.set("n", "<space>fb", ":Telescope file_browser<CR>")
vim.g.python3_host_prog = "/opt/homebrew/bin/python3"
vim.api.nvim_set_option("clipboard", "unnamedplus")
vim.api.nvim_create_autocmd("FileType", {
pattern = "elixir",
callback = function()
vim.opt_local.commentstring = "# %s"
end,
})