├── lua ├── plugins │ ├── vim-commentary.lua │ ├── codeium.lua │ ├── vim-be-good.lua │ ├── auto-close-tag.lua │ ├── indent-blankline.lua │ ├── nvim-emmet.lua │ ├── lualine.lua │ ├── git-stuffs.lua │ ├── theme.lua │ ├── toggleterm.lua │ ├── none-ls.lua │ ├── nvim-scroll-bar.lua │ ├── treesitter.lua │ ├── neo-tree.lua │ ├── telescope.lua │ ├── trouble.lua │ ├── ts-context-commentstring.lua │ ├── completions.lua │ ├── lsp-config.lua │ └── harpoon.lua └── vim-option.lua ├── .luarc.json ├── init.lua └── lazy-lock.json /lua/plugins/vim-commentary.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "tpope/vim-commentary", 3 | } 4 | -------------------------------------------------------------------------------- /lua/plugins/codeium.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "Exafunction/codeium.vim", 4 | event = "BufEnter", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/vim-be-good.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "ThePrimeagen/vim-be-good", 4 | cmd = { 5 | "VimBeGood", 6 | }, 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/auto-close-tag.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "m4xshen/autoclose.nvim", 3 | config = function() 4 | require("autoclose").setup() 5 | end, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/indent-blankline.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "lukas-reineke/indent-blankline.nvim", 4 | main = "ibl", 5 | opts = {}, 6 | }, 7 | } 8 | -------------------------------------------------------------------------------- /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnostics.globals": [ 3 | "vim", 4 | "map" 5 | ], 6 | "diagnostics.disable": [ 7 | "redefined-local" 8 | ] 9 | } -------------------------------------------------------------------------------- /lua/plugins/nvim-emmet.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "olrtg/nvim-emmet", 3 | config = function() 4 | vim.keymap.set({ "n", "v" }, "xe", require("nvim-emmet").wrap_with_abbreviation) 5 | end, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/lualine.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-lualine/lualine.nvim", 3 | config = function() 4 | require("lualine").setup({ 5 | options = { 6 | theme = "onedark", 7 | }, 8 | }) 9 | end, 10 | } 11 | -------------------------------------------------------------------------------- /lua/vim-option.lua: -------------------------------------------------------------------------------- 1 | vim.cmd("set expandtab") 2 | vim.cmd("set tabstop=2") 3 | vim.cmd("set softtabstop=2") 4 | vim.cmd("set shiftwidth=2") 5 | vim.cmd("set relativenumber") 6 | vim.cmd("set nowrap") 7 | -- vim.cmd("set formatoptions-=cro") 8 | vim.g.mapleader = " " 9 | 10 | -------------------------------------------------------------------------------- /lua/plugins/git-stuffs.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "tpope/vim-fugitive", 4 | }, 5 | { 6 | "lewis6991/gitsigns.nvim", 7 | config = function() 8 | require("gitsigns").setup() 9 | 10 | vim.keymap.set("n", "gp", ":Gitsigns preview_hunk", {}) 11 | end, 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/theme.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "olimorris/onedarkpro.nvim", 3 | priority = 1000, 4 | config = function() 5 | vim.cmd("colorscheme onedark") 6 | end, 7 | } 8 | 9 | -- "catppuccin/nvim", 10 | -- priority = 1000, 11 | -- config = function() 12 | -- vim.cmd.colorscheme "catppuccin" 13 | -- end 14 | -- } 15 | 16 | -------------------------------------------------------------------------------- /lua/plugins/toggleterm.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "akinsho/toggleterm.nvim", 4 | version = "*", 5 | config = function() 6 | require("toggleterm").setup({ 7 | size = function(term) 8 | if term.direction == "horizontal" then 9 | return 15 10 | elseif term.direction == "vertical" then 11 | return vim.o.columns * 0.4 12 | end 13 | end, 14 | open_mapping = [[]], 15 | auto_scroll = true, 16 | }) 17 | end, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lua/plugins/none-ls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvimtools/none-ls.nvim", 3 | dependencies = { 4 | "nvimtools/none-ls-extras.nvim", 5 | }, 6 | config = function() 7 | local null_ls = require("null-ls") 8 | null_ls.setup({ 9 | sources = { 10 | null_ls.builtins.formatting.stylua, 11 | null_ls.builtins.formatting.prettier, 12 | null_ls.builtins.diagnostics.eslint_d, 13 | }, 14 | }) 15 | vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) 16 | end, 17 | } 18 | -------------------------------------------------------------------------------- /lua/plugins/nvim-scroll-bar.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "petertriho/nvim-scrollbar", 3 | config = function() 4 | require("scrollbar").setup({ 5 | marks = { 6 | Search = { color = "#FFA07A" }, -- Salmon 7 | Error = { color = "#FF6347" }, -- Tomato 8 | Warn = { color = "#FFD700" }, -- Gold 9 | Info = { color = "#87CEEB" }, -- SkyBlue 10 | Hint = { color = "#ADFF2F" }, -- GreenYellow 11 | Misc = { color = "#BA55D3" }, -- MediumOrchid 12 | }, 13 | }) 14 | end, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "windwp/nvim-ts-autotag", 4 | ft = { 5 | "javascript", 6 | "javascriptreact", 7 | "typescript", 8 | "typescriptreact", 9 | }, 10 | config = function() 11 | require("nvim-ts-autotag").setup() 12 | end, 13 | }, 14 | { 15 | "nvim-treesitter/nvim-treesitter", 16 | build = ":TSUpdate", 17 | config = function() 18 | local configs = require("nvim-treesitter.configs") 19 | configs.setup({ 20 | auto_install = true, 21 | highlight = { enable = true }, 22 | indent = { enable = true }, 23 | }) 24 | end, 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /lua/plugins/neo-tree.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-neo-tree/neo-tree.nvim", 3 | branch = "v3.x", 4 | dependencies = { 5 | "nvim-lua/plenary.nvim", 6 | "nvim-tree/nvim-web-devicons", 7 | "MunifTanjim/nui.nvim", 8 | }, 9 | config = function() 10 | require("neo-tree").setup({ 11 | filesystem = { 12 | filtered_items = { 13 | visible = true, -- this shows hidden files 14 | hide_dotfiles = false, -- this ensures dotfiles are not hidden 15 | hide_gitignored = false, -- this ensures gitignored files are not hidden 16 | }, 17 | }, 18 | }) 19 | 20 | vim.keymap.set("n", "", ":Neotree filesystem reveal left") 21 | vim.keymap.set("n", "", ":Neotree close") 22 | end, 23 | } 24 | -------------------------------------------------------------------------------- /lua/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | 'nvim-telescope/telescope.nvim', tag = '0.1.6', 4 | dependencies = { 'nvim-lua/plenary.nvim' }, 5 | config = function() 6 | local builtin = require("telescope.builtin") 7 | vim.keymap.set('n', '', builtin.find_files, {}) 8 | vim.keymap.set('n', 'fg', builtin.live_grep, {}) 9 | end 10 | }, 11 | { 12 | 'nvim-telescope/telescope-ui-select.nvim', 13 | config = function() 14 | require("telescope").setup { 15 | extensions = { 16 | ["ui-select"] = { 17 | require("telescope.themes").get_dropdown { 18 | } 19 | 20 | } 21 | } 22 | } 23 | require("telescope").load_extension("ui-select") 24 | end 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lua/plugins/trouble.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/trouble.nvim", 3 | keys = { 4 | { 5 | "xx", 6 | "Trouble diagnostics toggle", 7 | desc = "Diagnostics (Trouble)", 8 | }, 9 | { 10 | "xX", 11 | "Trouble diagnostics toggle filter.buf=0", 12 | desc = "Buffer Diagnostics (Trouble)", 13 | }, 14 | { 15 | "cs", 16 | "Trouble symbols toggle focus=false", 17 | desc = "Symbols (Trouble)", 18 | }, 19 | { 20 | "cl", 21 | "Trouble lsp toggle focus=false win.position=right", 22 | desc = "LSP Definitions / references / ... (Trouble)", 23 | }, 24 | { 25 | "xL", 26 | "Trouble loclist toggle", 27 | desc = "Location List (Trouble)", 28 | }, 29 | { 30 | "xQ", 31 | "Trouble qflist toggle", 32 | desc = "Quickfix List (Trouble)", 33 | }, 34 | }, 35 | opts = {}, -- for default options, refer to the configuration section for custom setup. 36 | } 37 | -------------------------------------------------------------------------------- /lua/plugins/ts-context-commentstring.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "JoosepAlviste/nvim-ts-context-commentstring", -- Context-aware commenting 4 | event = "BufReadPost", 5 | }, 6 | { 7 | "numToStr/Comment.nvim", -- Commenting plugin 8 | event = "BufReadPost", 9 | config = function() 10 | require("Comment").setup({ 11 | pre_hook = function(ctx) 12 | -- Use ts-context-commentstring for filetypes with Treesitter integration 13 | local U = require("Comment.utils") 14 | local ts_commentstring = require("ts_context_commentstring.internal") 15 | local location = nil 16 | 17 | if ctx.ctype == U.ctype.block then 18 | location = ts_commentstring.calculate_commentstring({ 19 | key = ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V and "multiline" or "singleline", 20 | }) 21 | else 22 | location = ts_commentstring.calculate_commentstring({ 23 | key = ctx.ctype == U.ctype.line and "singleline" or "multiline", 24 | }) 25 | end 26 | 27 | return location 28 | end, 29 | }) 30 | end, 31 | }, 32 | } 33 | 34 | -------------------------------------------------------------------------------- /lua/plugins/completions.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "hrsh7th/cmp-nvim-lsp", 4 | }, 5 | { 6 | "L3MON4D3/LuaSnip", 7 | dependencies = { 8 | "saadparwaiz1/cmp_luasnip", 9 | "rafamadriz/friendly-snippets", 10 | }, 11 | }, 12 | { 13 | "hrsh7th/nvim-cmp", 14 | config = function() 15 | local cmp = require("cmp") 16 | require("luasnip.loaders.from_vscode").lazy_load() 17 | 18 | cmp.setup({ 19 | snippet = { 20 | -- REQUIRED - you must specify a snippet engine 21 | expand = function(args) 22 | require("luasnip").lsp_expand(args.body) -- For `luasnip` users. 23 | end, 24 | }, 25 | window = { 26 | completion = cmp.config.window.bordered(), 27 | documentation = cmp.config.window.bordered(), 28 | }, 29 | mapping = cmp.mapping.preset.insert({ 30 | [""] = cmp.mapping.scroll_docs(-4), 31 | [""] = cmp.mapping.scroll_docs(4), 32 | [""] = cmp.mapping.complete(), 33 | [""] = cmp.mapping.abort(), 34 | 35 | -- Bind Enter for confirming selection 36 | [""] = cmp.mapping.confirm({ select = true }), 37 | 38 | -- Disable Tab key behavior 39 | [""] = function(fallback) 40 | fallback() -- Do nothing, let it fallback to default behavior 41 | end, 42 | 43 | [""] = function(fallback) 44 | fallback() -- Do nothing on Shift-Tab too 45 | end, 46 | }), 47 | sources = cmp.config.sources({ 48 | { name = "nvim_lsp" }, 49 | { name = "luasnip" }, -- For luasnip users. 50 | }, { 51 | { name = "buffer" }, 52 | }), 53 | }) 54 | end, 55 | }, 56 | } 57 | 58 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | if not (vim.uv or vim.loop).fs_stat(lazypath) then 3 | vim.fn.system({ 4 | "git", 5 | "clone", 6 | "--filter=blob:none", 7 | "https://github.com/folke/lazy.nvim.git", 8 | "--branch=stable", -- latest stable release 9 | lazypath, 10 | }) 11 | end 12 | vim.opt.rtp:prepend(lazypath) 13 | 14 | require("vim-option") 15 | require("lazy").setup("plugins") 16 | -- require("menu") 17 | 18 | -- -- Keyboard users 19 | -- vim.keymap.set("n", "", function() 20 | -- require("menu").open("default") 21 | -- end, {}) 22 | 23 | -- -- mouse users + nvimtree users! 24 | -- vim.keymap.set("n", "", function() 25 | -- vim.cmd.exec '"normal! \\"' 26 | 27 | -- local options = vim.bo.ft == "NvimTree" and "nvimtree" or "default" 28 | -- require("menu").open(options, { mouse = true }) 29 | -- end, {}) 30 | 31 | -- Encapsulate key mappings in a local scope 32 | local function setup_key_mappings() 33 | -- Map Ctrl + s to save in normal mode 34 | vim.api.nvim_set_keymap("n", "", ":w", { noremap = true, silent = true }) 35 | -- Map Ctrl + s to save in insert mode 36 | vim.api.nvim_set_keymap("i", "", ":wa", { noremap = true, silent = true }) 37 | 38 | vim.api.nvim_set_keymap("n", "", "zh", { noremap = true, silent = true }) 39 | vim.api.nvim_set_keymap("n", "", "zl", { noremap = true, silent = true }) 40 | end 41 | 42 | -- this is to disable auto commenting on new lines 43 | vim.api.nvim_create_autocmd("BufEnter", { 44 | pattern = "*", 45 | command = "set formatoptions-=cro", 46 | }) 47 | 48 | -- Call the function to set up key mappings 49 | setup_key_mappings() 50 | 51 | -- Enable mouse support 52 | vim.opt.mouse = "a" 53 | 54 | -- Adjust horizontal scrolling settings 55 | vim.opt.sidescroll = 1 56 | vim.opt.sidescrolloff = 5 57 | 58 | -------------------------------------------------------------------------------- /lua/plugins/lsp-config.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "williamboman/mason.nvim", 4 | config = function() 5 | require("mason").setup() 6 | end, 7 | }, 8 | { 9 | "williamboman/mason-lspconfig.nvim", 10 | config = function() 11 | require("mason-lspconfig").setup({ 12 | ensure_installed = { 13 | "lua_ls", 14 | "tsserver", 15 | "html", 16 | "tailwindcss", 17 | "cssls", 18 | "jsonls", 19 | "gopls", 20 | "pyright", 21 | }, 22 | automatic_installation = true, 23 | }) 24 | end, 25 | }, 26 | { 27 | "neovim/nvim-lspconfig", 28 | config = function() 29 | local capabilities = require("cmp_nvim_lsp").default_capabilities() 30 | local lspconfig = require("lspconfig") 31 | 32 | -- Function to filter out react/index.d.ts 33 | local function filterReactDTS(value) 34 | return string.match(value.filename, "react/index.d.ts") == nil 35 | end 36 | 37 | -- Custom on_list function 38 | local function on_list(options) 39 | local items = options.items 40 | if #items > 1 then 41 | items = vim.tbl_filter(filterReactDTS, items) 42 | end 43 | 44 | vim.fn.setqflist({}, " ", { title = options.title, items = items, context = options.context }) 45 | vim.api.nvim_command("cfirst") -- or maybe you want 'copen' instead of 'cfirst' 46 | end 47 | 48 | -- Common on_attach function 49 | local on_attach = function(client, bufnr) 50 | local bufopts = { noremap = true, silent = true, buffer = bufnr } 51 | vim.keymap.set("n", "gd", function() 52 | vim.lsp.buf.definition({ on_list = on_list }) 53 | end, bufopts) 54 | end 55 | 56 | -- Setup LSP servers with common configuration 57 | local servers = { 58 | emmet_language_server = {}, 59 | lua_ls = { capabilities = capabilities }, 60 | html = { capabilities = capabilities }, 61 | cssls = { capabilities = capabilities }, 62 | tailwindcss = { capabilities = capabilities }, 63 | tsserver = { capabilities = capabilities }, 64 | jsonls = { capabilities = capabilities }, 65 | gopls = { 66 | capabilities = capabilities, 67 | cmd = { "gopls" }, 68 | filetypes = { "go", "gomod", "gowork", "gotmpl" }, 69 | root_dir = lspconfig.util.root_pattern("go.work", "go.mod", ".git"), 70 | }, 71 | pyright = { capabilities = capabilities }, 72 | } 73 | 74 | for server, config in pairs(servers) do 75 | config.on_attach = on_attach 76 | lspconfig[server].setup(config) 77 | end 78 | 79 | vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) 80 | -- vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) 81 | vim.keymap.set("n", "gr", vim.lsp.buf.references, {}) 82 | vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) 83 | end, 84 | }, 85 | } 86 | -------------------------------------------------------------------------------- /lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, 3 | "LuaSnip": { "branch": "master", "commit": "878ace11983444d865a72e1759dbcc331d1ace4c" }, 4 | "autoclose.nvim": { "branch": "main", "commit": "dc42806540dcf448ecb2bad6b67204410cfbe629" }, 5 | "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, 6 | "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, 7 | "codeium.vim": { "branch": "main", "commit": "289eb724e5d6fab2263e94a1ad6e54afebefafb2" }, 8 | "friendly-snippets": { "branch": "main", "commit": "d0610077b6129cf9f7f78afbe3a1425d60f6e2f1" }, 9 | "gitsigns.nvim": { "branch": "main", "commit": "75dc649106827183547d3bedd4602442340d2f7f" }, 10 | "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, 11 | "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, 12 | "lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" }, 13 | "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, 14 | "mason-lspconfig.nvim": { "branch": "main", "commit": "a4caa0d083aab56f6cd5acf2d42331b74614a585" }, 15 | "mason.nvim": { "branch": "main", "commit": "49ff59aded1047a773670651cfa40e76e63c6377" }, 16 | "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, 17 | "none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" }, 18 | "none-ls.nvim": { "branch": "main", "commit": "f5b960a73418249aebcdae3455de320360509253" }, 19 | "nui.nvim": { "branch": "main", "commit": "b1b3dcd6ed8f355c78bad3d395ff645be5f8b6ae" }, 20 | "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, 21 | "nvim-emmet": { "branch": "main", "commit": "cde4fb2968704aae5c18b7f8a9bc2508767bb78d" }, 22 | "nvim-lspconfig": { "branch": "master", "commit": "7cb90cf656139dc59cf86206946ec85571671b5b" }, 23 | "nvim-scrollbar": { "branch": "main", "commit": "d09f14aa16c9f2748e77008f9da7b1f76e4e7b85" }, 24 | "nvim-treesitter": { "branch": "master", "commit": "f770df9c8cd56c05b878cdf35115ad872c822bc0" }, 25 | "nvim-ts-autotag": { "branch": "main", "commit": "bcf3146864262ef2d3c877beba3e222b5c73780d" }, 26 | "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, 27 | "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, 28 | "onedarkpro.nvim": { "branch": "main", "commit": "13c3244b2520a832989d797d69436df7d27e20b9" }, 29 | "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, 30 | "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, 31 | "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, 32 | "toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" }, 33 | "trouble.nvim": { "branch": "main", "commit": "a6f1af567fc987306f0f328e78651bab1bfe874e" }, 34 | "vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" }, 35 | "vim-commentary": { "branch": "master", "commit": "c4b8f52cbb7142ec239494e5a2c4a512f92c4d07" }, 36 | "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" } 37 | } -------------------------------------------------------------------------------- /lua/plugins/harpoon.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "theprimeagen/harpoon", 3 | branch = "harpoon2", 4 | dependencies = { "nvim-lua/plenary.nvim" }, 5 | config = function() 6 | require("harpoon"):setup() 7 | end, 8 | 9 | keys = function() 10 | local harpoon = require("harpoon") 11 | 12 | local conf = require("telescope.config").values 13 | 14 | local function toggle_telescope(harpoon_files) 15 | local file_paths = {} 16 | for _, item in ipairs(harpoon_files.items) do 17 | table.insert(file_paths, item.value) 18 | end 19 | 20 | local make_finder = function() 21 | local paths = {} 22 | 23 | for _, item in ipairs(harpoon_files.items) do 24 | table.insert(paths, item.value) 25 | end 26 | 27 | return require("telescope.finders").new_table({ 28 | results = paths, 29 | }) 30 | end 31 | 32 | require("telescope.pickers") 33 | .new({}, { 34 | prompt_title = "Harpoon", 35 | finder = require("telescope.finders").new_table({ 36 | results = file_paths, 37 | }), 38 | previewer = false, 39 | sorter = conf.generic_sorter({}), 40 | layout_strategy = "center", 41 | layout_config = { 42 | preview_cutoff = 1, -- Preview should always show (unless previewer = false) 43 | 44 | width = function(_, max_columns, _) 45 | return math.min(max_columns, 80) 46 | end, 47 | 48 | height = function(_, _, max_lines) 49 | return math.min(max_lines, 15) 50 | end, 51 | }, 52 | borderchars = { 53 | prompt = { "─", "│", " ", "│", "╭", "╮", "│", "│" }, 54 | results = { "─", "│", "─", "│", "├", "┤", "╯", "╰" }, 55 | preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, 56 | }, 57 | attach_mappings = function(prompt_buffer_number, map) 58 | map("i", "", function() 59 | local state = require("telescope.actions.state") 60 | local selected_entry = state.get_selected_entry() 61 | local current_picker = state.get_current_picker(prompt_buffer_number) 62 | 63 | harpoon:list():remove(selected_entry) 64 | current_picker:refresh(make_finder()) 65 | end) 66 | 67 | return true 68 | end, 69 | }) 70 | :find() 71 | end 72 | return { 73 | { 74 | "ft", 75 | function() 76 | toggle_telescope(harpoon:list()) 77 | end, 78 | desc = "Harpoon (Telescope)", 79 | }, 80 | { 81 | "a", 82 | function() 83 | require("harpoon"):list():add() 84 | end, 85 | desc = "harpoon file", 86 | }, 87 | { 88 | "h", 89 | function() 90 | local harpoon = require("harpoon") 91 | harpoon.ui:toggle_quick_menu(harpoon:list()) 92 | end, 93 | desc = "harpoon quick menu", 94 | }, 95 | { 96 | "1", 97 | function() 98 | require("harpoon"):list():select(1) 99 | end, 100 | desc = "harpoon to file 1", 101 | }, 102 | { 103 | "2", 104 | function() 105 | require("harpoon"):list():select(2) 106 | end, 107 | desc = "harpoon to file 2", 108 | }, 109 | { 110 | "3", 111 | function() 112 | require("harpoon"):list():select(3) 113 | end, 114 | desc = "harpoon to file 3", 115 | }, 116 | { 117 | "4", 118 | function() 119 | require("harpoon"):list():select(4) 120 | end, 121 | desc = "harpoon to file 4", 122 | }, 123 | { 124 | "5", 125 | function() 126 | require("harpoon"):list():select(5) 127 | end, 128 | desc = "harpoon to file 5", 129 | }, 130 | } 131 | end, 132 | } 133 | --------------------------------------------------------------------------------