commit aafd8f1b67b87478813f521e74e4a404b9a8bfd5 Author: Sylv Date: Tue Sep 23 19:56:08 2025 +0100 Initial Commit diff --git a/after/queries/markdown/injections.scm b/after/queries/markdown/injections.scm new file mode 100644 index 0000000..7a40399 --- /dev/null +++ b/after/queries/markdown/injections.scm @@ -0,0 +1,7 @@ +; extends +((inline) @injection.content + (#lua-match? @injection.content "^%s*import") + (#set! injection.language "typescript")) +((inline) @injection.content + (#lua-match? @injection.content "^%s*export") + (#set! injection.language "typescript")) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..d42d09b --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require('andr3') diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..636aaf5 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,36 @@ +{ + "base16-nvim": { "branch": "master", "commit": "965160025d0facbe9caa863e5beef2a7a488e9d1" }, + "cellular-automaton.nvim": { "branch": "main", "commit": "1606e9d5d04ff254023c3f3c62842d065708d6d3" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp-snippy": { "branch": "master", "commit": "6e39210aa3a74e2bf6462f492eaf0d436cd2b7d3" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "fidget": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "43b0c856ae5f32a195d83f4a27fe21d63e6c966c" }, + "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lsp_signature.nvim": { "branch": "master", "commit": "a4e3c15dfdce8783c074539b1835edae75fa63d5" }, + "luasnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lspconfig": { "branch": "master", "commit": "4bc481b6f0c0cf3671fc894debd0e00347089a4e" }, + "nvim-snippy": { "branch": "master", "commit": "93c329f7dad98565ad5db9634ced253d665c1760" }, + "nvim-tree.lua": { "branch": "master", "commit": "ea5097a1e2702b4827cb7380e7fa0bd6da87699c" }, + "nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" }, + "nvim-ufo": { "branch": "main", "commit": "cac999ec9f6302d2fd4ad8a846bf8f731af6e7cf" }, + "nvim-web-devicons": { "branch": "master", "commit": "2c2b4eafce6cdd0cb165036faa17396eff18f847" }, + "plenary": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "startup.nvim": { "branch": "master", "commit": "9ca3b9a55f2f2196ef90b39a52029b46fdde5226" }, + "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" }, + "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" } +} diff --git a/lua/andr3/init.lua b/lua/andr3/init.lua new file mode 100644 index 0000000..d8fe5ec --- /dev/null +++ b/lua/andr3/init.lua @@ -0,0 +1,6 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +require('andr3.lazy') +require('andr3.set') +require('andr3.keys') diff --git a/lua/andr3/keys.lua b/lua/andr3/keys.lua new file mode 100644 index 0000000..483bbf7 --- /dev/null +++ b/lua/andr3/keys.lua @@ -0,0 +1,7 @@ +-- Leader is set on init before lazy +-- vim.g.mapleader = " " +-- vim.g.maplocalleader = " " + +-- vim.keymap.set('v', 'J', ":m '>+1gv=gv") +-- vim.keymap.set('v', 'K', ":m '<-2gv=gv") + diff --git a/lua/andr3/lazy.lua b/lua/andr3/lazy.lua new file mode 100644 index 0000000..230b549 --- /dev/null +++ b/lua/andr3/lazy.lua @@ -0,0 +1,7 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +vim.opt.rtp:prepend(lazypath) + +require('lazy').setup({ + spec = "andr3.plugins", + change_detection = { notify = false } +}) diff --git a/lua/andr3/plugins/init.lua b/lua/andr3/plugins/init.lua new file mode 100644 index 0000000..1ffaa58 --- /dev/null +++ b/lua/andr3/plugins/init.lua @@ -0,0 +1,10 @@ +return { + "folke/lazy.nvim", + + { 'nvim-lua/plenary.nvim', name = "plenary" }, + + 'mbbill/undotree', + 'tpope/vim-fugitive', + + 'eandrju/cellular-automaton.nvim', +} diff --git a/lua/andr3/plugins/lsp.lua b/lua/andr3/plugins/lsp.lua new file mode 100644 index 0000000..ea25602 --- /dev/null +++ b/lua/andr3/plugins/lsp.lua @@ -0,0 +1,357 @@ +function setup_attach() + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function (ev) + -- local lspconfig = require('lspconfig') + -- + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "gf", function() + vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf(), async = false }) + end, { buffer = bufnr, desc = "[lsp] format" }) + -- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + -- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + -- vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + end, + }) +end + +function setup_cmp() + local cmp = require('cmp') + + local kind_icons = { + Text = "", + Method = "󰆧", + Function = "󰊕", + Constructor = "", + Field = "󰇽", + Variable = "󰂡", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "", + Event = "", + Operator = "󰆕", + TypeParameter = "󰅲", + } + + cmp.setup({ + snippet = { + expand = function(args) + -- require('luasnip').lsp_expand(args.body) + require('snippy').expand_snippet(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'snippy' }, + { name = 'path' }, + { name = 'emoji' }, + }, { + { name = 'buffer' }, + }), + formatting = { + format = function(entry, vim_item) + -- Kind icons + vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatenates the icons with the name of the item kind + -- vim_item.kind = kind_icons[vim_item.kind] + -- Source + vim_item.menu = ({ + buffer = "📝", + nvim_lsp = "🔎", + luasnip = "[LuaSnip]", + nvim_lua = "[Lua]", + latex_symbols = "[LaTeX]", + })[entry.source.name] + return vim_item + end + }, + }) + + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) +end + +return { + + { + "j-hui/fidget.nvim", + name = "fidget", + opts = {} + }, + + { + 'kevinhwang91/nvim-ufo', + dependencies = { + 'kevinhwang91/promise-async', + }, + }, + + { + "neovim/nvim-lspconfig", + dependencies = { + 'neovim/nvim-lspconfig', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/nvim-cmp', + 'saadparwaiz1/cmp_luasnip', + "ray-x/lsp_signature.nvim", + 'dcampos/nvim-snippy', + 'dcampos/cmp-snippy', + 'fidget', + 'kevinhwang91/nvim-ufo', + }, + config = function() + + local lspconfig = require('lspconfig') + + vim.diagnostic.config({ + virtual_text = { + prefix = "👈", + }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "🆒", + [vim.diagnostic.severity.WARN] = "😞", + [vim.diagnostic.severity.HINT] = "🆘", + [vim.diagnostic.severity.INFO] = "🆓", + CodeAction = "🈁", + } + }, + }) + + -- Check out trouble + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next) + + setup_attach() + setup_cmp() + + -- This is required by UFO + local pre_capabilities = vim.lsp.protocol.make_client_capabilities() + pre_capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } + + local capabilities = vim.tbl_deep_extend( + "force", + {}, + pre_capabilities, + require('cmp_nvim_lsp').default_capabilities() + ) + + local def_set_servers = { "ts_ls", "svelte", "zls", "gopls", "cssls", "pylsp", "rust_analyzer", "dartls", "ols", "jdtls", "biome", "ocamllsp" } + + for _, server_name in ipairs(def_set_servers) do + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end + + lspconfig.tailwindcss.setup({ + capabilities = capabilities, + init_options = { + userLanguages = { + elixir = "phoenix-heex", + heex = "phoenix-heex", + -- other languages + }, + }, + filetypes = { + "css", + "scss", + "sass", + "html", + "heex", + "elixir", + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "svelte", + "ocaml" + }, + }) + + lspconfig.elixirls.setup({ + cmd = { "elixir-ls" }, + capabilities = capabilities, + }) + + local jdk_home = "/usr/lib/jvm/java-17-openjdk" -- Your actual jdk path + local util = require('lspconfig/util') + -- lspconfig.kotlin_language_server.setup { + -- cmd_env = { + -- PATH = jdk_home .. "/bin:" .. vim.env.PATH, + -- JAVA_HOME = jdk_home, + -- }, + -- init_options = { + -- storagePath = util.path.join(vim.env.XDG_DATA_HOME, "nvim-data"), + -- }, + -- capabilities = capabilities, + -- } + + -- lspconfig.jdtls.setup { + -- cmd_env = { + -- PATH = jdk_home .. "/bin:" .. vim.env.PATH, + -- JAVA_HOME = jdk_home, + -- }, + -- init_options = { + -- storagePath = util.path.join(vim.env.XDG_DATA_HOME, "nvim-data"), + -- }, + -- capabilities = capabilities, + -- } + + -- + -- UFO stuff (folding) + -- + + local handler = function(virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local suffix = (' 󰁂 %d '):format(endLnum - lnum) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, {chunkText, hlGroup}) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + table.insert(newVirtText, {suffix, 'MoreMsg'}) + return newVirtText + end + + require('ufo').setup({ + fold_virt_text_handler = handler + }) + + + -- vim.keymap.set('n', 'zf', require('ufo').closeFoldsWith) + vim.keymap.set('n', 'zR', require('ufo').openAllFolds) + vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) + + -- + -- END UFO stuff (folding) + -- + + vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if not client then return end + + if client.supports_method('textDocument/formatting') then + -- Format the current buffer on save + -- vim.api.nvim_create_autocmd('BufWritePre', { + -- buffer = args.buf, + -- callback = function() + -- vim.lsp.buf.format({bufnr = args.buf, id = client.id}) + -- end, + -- }) + end + end, + }) + end, + }, + { + "ray-x/lsp_signature.nvim", + event = "InsertEnter", + opts = { + bind = true, + handler_opts = { + border = "rounded" + } + }, + config = function(_, opts) require'lsp_signature'.setup(opts) end + }, + { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, + } +} diff --git a/lua/andr3/plugins/luasnip.lua b/lua/andr3/plugins/luasnip.lua new file mode 100644 index 0000000..4b4fa9e --- /dev/null +++ b/lua/andr3/plugins/luasnip.lua @@ -0,0 +1,11 @@ + +return { + 'L3MON4D3/LuaSnip', + name = "luasnip", + dependencies = { + "rafamadriz/friendly-snippets" + }, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end +} diff --git a/lua/andr3/plugins/neogen.lua b/lua/andr3/plugins/neogen.lua new file mode 100644 index 0000000..4ec0051 --- /dev/null +++ b/lua/andr3/plugins/neogen.lua @@ -0,0 +1,8 @@ +return { + "danymat/neogen", + dependencies = {"nvim-treesitter/nvim-treesitter"}, + config = function() + require('neogen').setup({}) + vim.keymap.set("n", "cc", ":lua require('neogen').generate()", opts) + end, +} diff --git a/lua/andr3/plugins/telescope.lua b/lua/andr3/plugins/telescope.lua new file mode 100644 index 0000000..5f790f8 --- /dev/null +++ b/lua/andr3/plugins/telescope.lua @@ -0,0 +1,30 @@ +return { + 'nvim-telescope/telescope.nvim', + dependencies = { "plenary", "nvim-tree/nvim-web-devicons" }, + config = function() + require('telescope').setup({ + defaults = { + layout_strategy = "vertical", + layout_config = { + vertical = { width = 0.70, height = 0.9, preview_cutoff = 0, mirror = true, prompt_position = "top" } + } + } + }) + + local telescope = require('telescope.builtin') + + vim.keymap.set('n', 'f', telescope.find_files, {}) + vim.keymap.set('n', '/', telescope.live_grep, {}) + vim.keymap.set('n', 'b', telescope.buffers, {}) + vim.keymap.set('n', 'g', telescope.git_status, {}) + vim.keymap.set('n', '?', telescope.help_tags, {}) + vim.keymap.set('n', 'pws', function() + local word = vim.fn.expand("") + telescope.grep_string({search = word}) + end) + vim.keymap.set('n', 'pWs', function() + local word = vim.fn.expand("") + telescope.grep_string({search = word}) + end) + end, +} diff --git a/lua/andr3/plugins/themes.lua b/lua/andr3/plugins/themes.lua new file mode 100644 index 0000000..60b492b --- /dev/null +++ b/lua/andr3/plugins/themes.lua @@ -0,0 +1,102 @@ +return { + { + "startup-nvim/startup.nvim", + dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim", "nvim-telescope/telescope-file-browser.nvim" }, + config = function() + require "startup".setup({theme="evil"}) + end + }, + { + "roobert/tailwindcss-colorizer-cmp.nvim", + -- optionally, override the default options: + config = function() + require("tailwindcss-colorizer-cmp").setup({ + color_square_width = 2, + }) + end + }, +-- { +-- "git@git.andr3h3nriqu3s.com:andr3/bubblegum-theme.git", +-- config = function() +-- vim.cmd('colorscheme bubblegum-256-light') +-- end +-- }, +-- { +-- "ayu-theme/ayu-vim", +-- config = function() +-- vim.g.ayucolor="dark" +-- vim.g.indentLine_char = '' +-- vim.g.indentLine_first_char = '' +-- vim.g.indentLine_showFirstIndentLevel = 1 +-- vim.g.indentLine_setColors = 0 +-- vim.cmd('colorscheme ayu') +-- end +-- }, + -- { + -- "SWilson4/valerie", + -- config = function() + -- vim.cmd('colorscheme valerie') + -- end + -- }, +-- { +-- "sts10/vim-pink-moon", +-- config = function() +-- vim.cmd('colorscheme pink-moon') +-- end +-- }, +-- { +-- "rose-pine/neovim", +-- config = function() +-- vim.cmd('colorscheme rose-pine-moon') +-- end +-- }, +-- { +-- 'ribru17/bamboo.nvim', +-- lazy = false, +-- priority = 1000, +-- config = function() +-- vim.o.background = 'light' +-- require('bamboo').setup { +-- -- optional configuration here +-- } +-- require('bamboo').load() +-- end, +-- }, + -- { + -- "folke/tokyonight.nvim", + -- lazy = false, + -- priority = 1000, + -- config = function() + -- vim.cmd[[colorscheme tokyonight-day]] + -- end + -- } + -- { + -- "nyoom-engineering/oxocarbon.nvim", + -- config = function() + -- -- vim.opt.background = "light" -- set this to dark or light + -- vim.cmd.colorscheme "oxocarbon" + -- end + -- } +-- { +-- "0xhoussam/fleet.nvim", +-- config = function() vim.cmd("colorscheme fleet") end +-- } + { + "RRethy/base16-nvim", + config = function() vim.cmd("colorscheme base16-unikitty-light") end + } + -- { + -- "EdenEast/nightfox.nvim", + -- config = function() + -- -- vim.opt.background = "light" -- set this to dark or light + -- vim.cmd.colorscheme "dayfox" + -- end + -- } + -- { + -- "scottmckendry/cyberdream.nvim", + -- config = function() + -- vim.opt.background = "dark" -- set this to dark or light + -- vim.cmd.colorscheme "cyberdream" + -- end + -- } +} diff --git a/lua/andr3/plugins/utils.lua b/lua/andr3/plugins/utils.lua new file mode 100644 index 0000000..5c5efc9 --- /dev/null +++ b/lua/andr3/plugins/utils.lua @@ -0,0 +1,176 @@ +local function hexToRgb(hex_str) + local hex = '[abcdef0-9][abcdef0-9]' + local pat = '^#(' .. hex .. ')(' .. hex .. ')(' .. hex .. ')$' + hex_str = string.lower(hex_str) + + assert( + string.find(hex_str, pat) ~= nil, + 'hex_to_rgb: invalid hex_str: ' .. tostring(hex_str) + ) + + local r, g, b = string.match(hex_str, pat) + return { tonumber(r, 16), tonumber(g, 16), tonumber(b, 16) } +end + +function blend(fg, bg, alpha) + bg = hexToRgb(bg) + fg = hexToRgb(fg) + + local blendChannel = function(i) + local ret = (alpha * fg[i] + ((1 - alpha) * bg[i])) + return math.floor(math.min(math.max(0, ret), 255) + 0.5) + end + + return string.format( + '#%02X%02X%02X', + blendChannel(1), + blendChannel(2), + blendChannel(3) + ) +end + +return { + { + 'nvim-treesitter/nvim-treesitter', + config = function() + local ts_update = require('nvim-treesitter.install').update({ with_sync = true }); + require('nvim-treesitter.configs').setup({ + ensure_installed = { + "lua", "svelte", "javascript", "typescript", "html", "elixir", "vim", + "jsdoc", "go", "css", "scss", "markdown" + }, + + highlight = { + enable = true + } + }) + vim.treesitter.language.register('markdown', { 'mdx' }) + -- vim.wo.foldmethod = 'expr' + -- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' + end + }, + { + 'lewis6991/gitsigns.nvim', + config = function() + require('gitsigns').setup{ + on_attach = function(bufnr) + local gitsigns = require('gitsigns') + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal({']c', bang = true}) + else + gitsigns.nav_hunk('next') + end + end) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal({'[c', bang = true}) + else + gitsigns.nav_hunk('prev') + end + end) + + map('n', 'hd', gitsigns.diffthis) + end + } + end + }, + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + bigfile = { enabled = true }, + notifier = { enabled = true }, + -- quickfile = { enabled = true }, + -- statuscolumn = { enabled = true }, + -- words = { enabled = true }, + }, + }, + { + "nvim-tree/nvim-tree.lua", + config = function() + require("nvim-tree").setup({ + sort = { + sorter = "case_sensitive", + }, + view = { + width = 30, + side = "right", + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + update_focused_file = { + enable = true, + update_root = false, + ignore_list = {}, + }, + }) + + local api = require "nvim-tree.api" + vim.keymap.set('n', '', function() api.tree.toggle() end) + end + }, + -- { + -- 'wellle/context.vim', + -- } +-- { +-- 'luukvbaal/statuscol.nvim', +-- config = function() +-- local builtin = require('statuscol.builtin') +-- local c = require('statuscol.ffidef').C +-- for i = 0, 8, 1 do +-- vim.api.nvim_set_hl(0, 'FoldCol' .. i, { +-- bg = blend( +-- string.format( +-- '#%06x', +-- vim.api.nvim_get_hl(0, { name = 'Normal' }).fg +-- ), +-- string.format( +-- '#%06x', +-- vim.api.nvim_get_hl(0, { name = 'Normal' }).bg +-- ), +-- 0.125 * i +-- ), +-- }) +-- end +-- require('statuscol').setup { +-- relculright = true, +-- segments = { +-- { text = { '%s' }, click = 'v:lua.ScSa' }, +-- { text = { builtin.lnumfunc, ' ' }, click = 'v:lua.ScLa' }, +-- { +-- -- hl = 'FoldColumn', +-- text = { +-- function(args) +-- local fold_level = c.fold_info(args.wp, args.lnum).level +-- local hl = '%#FoldCol' .. fold_level .. '#' +-- if fold_level > 8 then +-- hl = '%#FoldCol8#' +-- end +-- return hl .. ' ' +-- end, +-- }, +-- click = 'v:lua.ScFa', +-- }, +-- }, +-- } +-- end, +-- }, +} diff --git a/lua/andr3/set.lua b/lua/andr3/set.lua new file mode 100644 index 0000000..96153d8 --- /dev/null +++ b/lua/andr3/set.lua @@ -0,0 +1,52 @@ +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.laststatus = 3 +vim.opt.expandtab = true +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.smartindent = true +vim.opt.wrap = true + +vim.opt.clipboard = "unnamedplus" +-- vim.opt.signcolumn = "number" +vim.opt.signcolumn = "yes" + +vim.opt.termguicolors = true +vim.opt.cursorline = true +vim.opt.colorcolumn= "100" + +vim.o.foldcolumn = '1' -- '0' is not bad +vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value +vim.o.foldlevelstart = 99 +vim.o.foldenable = true + +-- vim.opt.foldenable = true +-- vim.opt.foldmethod = "indent" + +vim.filetype.add({ + extension = { + mdx = 'mdx' + } +}) + +--vim.api.nvim_create_autocmd({"InsertEnter"}, { +-- callback = function(ev) +-- local handle = io.popen("kontroll set-layer --index 5") +-- local result = handle:read("*a") +-- handle:close() +-- os.execute("") +-- end +--}) + +--vim.api.nvim_create_autocmd({"InsertLeave"}, { +-- callback = function(ev) +-- local handle = io.popen("kontroll set-layer --index 0") +-- local result = handle:read("*a") +-- handle:close() +-- end +--})