From 71d5792e458ebc6171fd8723343da07589dd04ea Mon Sep 17 00:00:00 2001 From: tsorabel-pc Date: Wed, 6 Mar 2024 21:42:29 +0100 Subject: [PATCH 1/8] feat: add base config --- init.lua | 27 +++++++++++++++++++-------- lua/custom/mappings.lua | 6 ++++++ 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 lua/custom/mappings.lua diff --git a/init.lua b/init.lua index 3bdb5e36..1fb972db 100644 --- a/init.lua +++ b/init.lua @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, for help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -254,7 +254,7 @@ require('lazy').setup({ }, }, }, - + -- -- NOTE: Plugins can also be configured to run lua code when they are loaded. -- -- This is often very useful to both group configuration, as well as handle @@ -269,7 +269,6 @@ require('lazy').setup({ -- Then, because we use the `config` key, the configuration only runs -- after the plugin has been loaded: -- config = function() ... end - { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' @@ -320,7 +319,7 @@ require('lazy').setup({ }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search + -- it can fuzzy find! It's more than just a --[[ "file finder" ]], it can search -- many different aspects of Neovim, your workspace, LSP, and more! -- -- The easiest way to use telescope, is to start by doing something like: @@ -535,14 +534,14 @@ require('lazy').setup({ -- clangd = {}, -- gopls = {}, -- pyright = {}, - -- rust_analyzer = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, + tsserver = {}, -- lua_ls = { @@ -613,13 +612,24 @@ require('lazy').setup({ lsp_fallback = true, }, formatters_by_ft = { - lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- -- You can use a sub-list to tell conform to run *until* a formatter -- is found. - -- javascript = { { "prettierd", "prettier" } }, + javascript = { 'prettier' }, + typescript = { 'prettier' }, + javascriptreact = { 'prettier' }, + typescriptreact = { 'prettier' }, + svelte = { 'prettier' }, + css = { 'prettier' }, + html = { 'prettier' }, + json = { 'prettier' }, + yaml = { 'prettier' }, + markdown = { 'prettier' }, + graphql = { 'prettier' }, + lua = { 'stylua' }, + rust = { 'rustfmt' }, }, }, }, @@ -712,6 +722,7 @@ require('lazy').setup({ { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, + { name = 'tsserver' }, }, } end, diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua new file mode 100644 index 00000000..ea64d673 --- /dev/null +++ b/lua/custom/mappings.lua @@ -0,0 +1,6 @@ +local map = vim.keymap.set + +map({ 'n' }, 'cw', ':%s/\\<\\>//gI', { desc = '[C]ut [W]orld' }) +map({ 'n' }, 'x', 'bd', { desc = 'Close buffer' }) +map('n', 'n', 'nzzzv') +map('n', 'N', 'Nzzzv') From 3a53db9eb0b49add6a913cddf1d2a169c257f47f Mon Sep 17 00:00:00 2001 From: tsorabel-pc Date: Wed, 6 Mar 2024 23:02:01 +0100 Subject: [PATCH 2/8] feat: add more mappings --- init.lua | 20 +++++++++++++++++++- lua/custom/mappings.lua | 6 ------ lua/kickstart/plugins/debug.lua | 3 +++ 3 files changed, 22 insertions(+), 7 deletions(-) delete mode 100644 lua/custom/mappings.lua diff --git a/init.lua b/init.lua index 1fb972db..b34b6575 100644 --- a/init.lua +++ b/init.lua @@ -722,7 +722,6 @@ require('lazy').setup({ { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, - { name = 'tsserver' }, }, } end, @@ -854,3 +853,22 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +-- +local map = vim.keymap.set + +-- Set current wordl +map({ 'n' }, 'cw', ':%s/\\<\\>//gI', { desc = '[C]ut [W]orld' }) + +-- Close buffer +map({ 'n' }, 'x', 'bd', { desc = 'Close buffer' }) + +-- misc mappings +map('n', 'n', 'nzzzv') +map('n', 'N', 'Nzzzv') + +-- Create new vertical buffer +map({ 'n' }, 'wb', 'vs', { desc = 'New [W]orkspace [B]uffer' }) + +-- Resize buffer (width) +map({ 'n' }, '', 'vertical res -5^M', { desc = 'Buffer - width' }) +map({ 'n' }, '', 'vertical res +5^M', { desc = 'Buffer + width' }) diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua deleted file mode 100644 index ea64d673..00000000 --- a/lua/custom/mappings.lua +++ /dev/null @@ -1,6 +0,0 @@ -local map = vim.keymap.set - -map({ 'n' }, 'cw', ':%s/\\<\\>//gI', { desc = '[C]ut [W]orld' }) -map({ 'n' }, 'x', 'bd', { desc = 'Close buffer' }) -map('n', 'n', 'nzzzv') -map('n', 'N', 'Nzzzv') diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7fc783fa..1bf4d07e 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -17,9 +17,11 @@ return { -- Installs the debug adapters for you 'williamboman/mason.nvim', 'jay-babu/mason-nvim-dap.nvim', + -- 'microsoft/vscode-js-debug', -- Add your own debuggers here 'leoluz/nvim-dap-go', + -- 'mxsdev/nvim-dap-vscode-js', }, config = function() local dap = require 'dap' @@ -83,5 +85,6 @@ return { -- Install golang specific config require('dap-go').setup() + -- require('nvim-dap-vscode-js').setup() end, } From 030f5546b611d19aabeba957f4ad3f27826d15ea Mon Sep 17 00:00:00 2001 From: tsorabel-pc Date: Thu, 7 Mar 2024 08:48:33 +0100 Subject: [PATCH 3/8] feat: add alias on top --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index b34b6575..920c84fa 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,7 @@ --[[ +alias nvi='NVIM_APPNAME="kickstart-tsorabel" nvim' + ===================================================================== ==================== READ THIS BEFORE CONTINUING ==================== ===================================================================== From 86e6746468890816cc21ca0f38d1fa145187a1a1 Mon Sep 17 00:00:00 2001 From: tsorabel-pc Date: Thu, 7 Mar 2024 23:18:24 +0100 Subject: [PATCH 4/8] feat: add harpoon --- init.lua | 14 ++--- lua/custom/plugins/init.lua | 62 ++++++++++++++++++- lua/kickstart/plugins/debug.lua | 103 +++++++++++++++++++++++++++++++- 3 files changed, 166 insertions(+), 13 deletions(-) diff --git a/init.lua b/init.lua index 920c84fa..5f11dc53 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,6 @@ --[[ + alias nvi='NVIM_APPNAME="kickstart-tsorabel" nvim' ===================================================================== @@ -823,14 +824,14 @@ 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', -- 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. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, { ui = { -- If you have a Nerd Font, set icons to an empty table which will use the @@ -855,7 +856,6 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et --- local map = vim.keymap.set -- Set current wordl @@ -864,13 +864,9 @@ map({ 'n' }, 'cw', ':%s/\\<\\>//gI -- Close buffer map({ 'n' }, 'x', 'bd', { desc = 'Close buffer' }) --- misc mappings -map('n', 'n', 'nzzzv') -map('n', 'N', 'Nzzzv') - -- Create new vertical buffer map({ 'n' }, 'wb', 'vs', { desc = 'New [W]orkspace [B]uffer' }) -- Resize buffer (width) -map({ 'n' }, '', 'vertical res -5^M', { desc = 'Buffer - width' }) -map({ 'n' }, '', 'vertical res +5^M', { desc = 'Buffer + width' }) +-- map({ 'n' }, '', 'vertical res -5^M', { desc = 'Buffer - width' }) +map({ 'n' }, '', 'vertical res +5^M', { desc = 'Buffer + width' }) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..78d42288 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,64 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + harpoon:setup() + vim.keymap.set({ 'n' }, 'a', function() + harpoon:list():append() + end, { desc = '[A]ppend File to harpoon' }) + vim.keymap.set('n', 'h', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = '[H]arpoon quick menu' }) + + vim.keymap.set('n', '', function() + harpoon:list():select(1) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(2) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(3) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(4) + end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set('n', '', function() + harpoon:list():next() + end) + vim.keymap.set('n', '', function() + harpoon:list():prev() + end) + local conf = require('telescope.config').values + local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Harpoon', + finder = require('telescope.finders').new_table { + results = file_paths, + }, + previewer = conf.file_previewer {}, + sorter = conf.generic_sorter {}, + }) + :find() + end + + vim.keymap.set('n', '', function() + toggle_telescope(harpoon:list()) + end, { desc = 'Open harpoon window' }) + end, + }, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 1bf4d07e..dfea13e2 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -5,6 +5,15 @@ -- Primarily focused on configuring the debugger for Go, but can -- be extended to other languages as well. That's why it's called -- kickstart.nvim and not kitchen-sink.nvim ;) +-- +-- +local js_based_languages = { + 'typescript', + 'javascript', + 'typescriptreact', + 'javascriptreact', + 'vue', +} return { -- NOTE: Yes, you can install new plugins here! @@ -17,11 +26,17 @@ return { -- Installs the debug adapters for you 'williamboman/mason.nvim', 'jay-babu/mason-nvim-dap.nvim', - -- 'microsoft/vscode-js-debug', + 'microsoft/vscode-js-debug', -- Add your own debuggers here 'leoluz/nvim-dap-go', - -- 'mxsdev/nvim-dap-vscode-js', + 'mxsdev/nvim-dap-vscode-js', + }, + { + 'microsoft/vscode-js-debug', + -- After install, build it and rename the dist directory to out + build = 'npm install --legacy-peer-deps --no-save && npx gulp vsDebugServerBundle && rm -rf out && mv dist out', + version = '1.*', }, config = function() local dap = require 'dap' @@ -46,7 +61,7 @@ return { -- Basic debugging keymaps, feel free to change to your liking! vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) - vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) @@ -76,6 +91,59 @@ return { }, } + for _, language in ipairs(js_based_languages) do + dap.configurations[language] = { + -- Debug single nodejs files + { + type = 'pwa-node', + request = 'launch', + name = 'Launch file', + program = '${file}', + cwd = vim.fn.getcwd(), + sourceMaps = true, + }, + -- Debug nodejs processes (make sure to add --inspect when you run the process) + { + type = 'pwa-node', + request = 'attach', + name = 'Attach', + processId = require('dap.utils').pick_process, + cwd = vim.fn.getcwd(), + sourceMaps = true, + }, + -- Debug web applications (client side) + { + type = 'pwa-chrome', + request = 'launch', + name = 'Launch & Debug Chrome', + url = function() + local co = coroutine.running() + return coroutine.create(function() + vim.ui.input({ + prompt = 'Enter URL: ', + default = 'http://localhost:3000', + }, function(url) + if url == nil or url == '' then + return + else + coroutine.resume(co, url) + end + end) + end) + end, + webRoot = vim.fn.getcwd(), + protocol = 'inspector', + sourceMaps = true, + userDataDir = false, + }, + -- Divider for the launch.json derived configs + { + name = '----- ↓ launch.json configs ↓ -----', + type = '', + request = 'launch', + }, + } + end -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. vim.keymap.set('n', '', dapui.toggle, { desc = 'Debug: See last session result.' }) @@ -86,5 +154,34 @@ return { -- Install golang specific config require('dap-go').setup() -- require('nvim-dap-vscode-js').setup() + require('dap-vscode-js').setup { + -- Path of node executable. Defaults to $NODE_PATH, and then "node" + -- node_path = "node", + + -- Path to vscode-js-debug installation. + debugger_path = vim.fn.resolve(vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug'), + + -- Command to use to launch the debug server. Takes precedence over "node_path" and "debugger_path" + -- debugger_cmd = { "js-debug-adapter" }, + + -- which adapters to register in nvim-dap + adapters = { + 'chrome', + 'pwa-node', + 'pwa-chrome', + 'pwa-msedge', + 'pwa-extensionHost', + 'node-terminal', + }, + + -- Path for file logging + -- log_file_path = "(stdpath cache)/dap_vscode_js.log", + + -- Logging level for output to file. Set to false to disable logging. + -- log_file_level = false, + + -- Logging level for output to console. Set to false to disable console output. + -- log_console_level = vim.log.levels.ERROR, + } end, } From b8ba854b768a0cb3e7554ee99cbbdc58c19b82b6 Mon Sep 17 00:00:00 2001 From: Tom Sorabella Date: Wed, 13 Mar 2024 11:51:31 -0400 Subject: [PATCH 5/8] feat: add carbon --- init.lua | 3 +++ lua/custom/plugins/init.lua | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/init.lua b/init.lua index 5f11dc53..aa848abe 100644 --- a/init.lua +++ b/init.lua @@ -870,3 +870,6 @@ map({ 'n' }, 'wb', 'vs', { desc = 'New [W]orkspace [B]uffer' }) -- Resize buffer (width) -- map({ 'n' }, '', 'vertical res -5^M', { desc = 'Buffer - width' }) map({ 'n' }, '', 'vertical res +5^M', { desc = 'Buffer + width' }) + +--CarbonNow Screenshot +map({ 'v' }, 's', ':CarbonNow', { desc = '[S]creenshoot with carbon now' }) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 78d42288..98ab5a06 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -62,4 +62,31 @@ return { end, { desc = 'Open harpoon window' }) end, }, + { + 'ellisonleao/carbon-now.nvim', + lazy = true, + cmd = 'CarbonNow', + -- @param opts cn.ConfigSchema + opts = { + base_url = 'https://carbon.now.sh/', + open_cmd = 'xdg-open', + options = { + bg = 'gray', + drop_shadow_blur = '68px', + drop_shadow = false, + drop_shadow_offset_y = '20px', + font_family = 'JetBrains Mono', + font_size = '16px', + line_height = '124%', + line_numbers = true, + theme = 'verminal', + titlebar = 'Made with carbon-now.nvim', + watermark = false, + width = '680', + window_theme = 'sharp', + padding_horizontal = '0px', + padding_vertical = '0px', + }, + }, + }, } From 537962d053eb10f61a5cb05e4f88e95c1b13e379 Mon Sep 17 00:00:00 2001 From: tsorabel-pc Date: Sun, 17 Mar 2024 16:17:06 +0100 Subject: [PATCH 6/8] feat: add git shortcut --- init.lua | 54 +++++++++++++++++++++++++++++++++++++ lua/custom/plugins/init.lua | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index b67d8f50..41663781 100644 --- a/init.lua +++ b/init.lua @@ -258,6 +258,59 @@ require('lazy').setup({ topdelete = { text = '‾' }, changedelete = { text = '~' }, }, + + on_attach = function(bufnr) + local gs = package.loaded.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', 'v' }, ']c', function() + if vim.wo.diff then + return ']c' + end + vim.schedule(function() + gs.next_hunk() + end) + return '' + end, { expr = true, desc = 'Jump to next git [c]hange' }) + map({ 'n', 'v' }, '[c', function() + if vim.wo.diff then + return '[c' + end + vim.schedule(function() + gs.prev_hunk() + end) + return '' + end, { expr = true, desc = 'Jump to previous git [c]hange' }) + -- Actions + -- visual mode + map('v', 'hs', function() + gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gs.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'hr', gs.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'hS', gs.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'hu', gs.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hR', gs.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'hp', gs.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'hb', function() + gs.blame_line { full = false } + end, { desc = 'git [b]lame line' }) + map('n', 'hd', gs.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'hD', function() + gs.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) + -- Toggles + map('n', 'tb', gs.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'td', gs.toggle_deleted, { desc = '[T]oggle git show [d]eleted' }) + end, }, }, -- @@ -288,6 +341,7 @@ require('lazy').setup({ ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + ['h'] = { name = '[H] Git', _ = 'which_key_ignore' }, } end, }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 98ab5a06..9f72f306 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -14,7 +14,7 @@ return { vim.keymap.set({ 'n' }, 'a', function() harpoon:list():append() end, { desc = '[A]ppend File to harpoon' }) - vim.keymap.set('n', 'h', function() + vim.keymap.set('n', '', function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, { desc = '[H]arpoon quick menu' }) From f34bb695e23d888826e901b2b62197bcf6557336 Mon Sep 17 00:00:00 2001 From: tsorabel-pc Date: Sun, 17 Mar 2024 18:19:33 +0100 Subject: [PATCH 7/8] feat: add some plugins --- init.lua | 10 ++-- lua/custom/plugins/carbon.lua | 27 ++++++++++ lua/custom/plugins/dashboard.lua | 84 +++++++++++++++++++++++++++++ lua/custom/plugins/harpoon.lua | 59 ++++++++++++++++++++ lua/custom/plugins/init.lua | 92 ++++---------------------------- 5 files changed, 185 insertions(+), 87 deletions(-) create mode 100644 lua/custom/plugins/carbon.lua create mode 100644 lua/custom/plugins/dashboard.lua create mode 100644 lua/custom/plugins/harpoon.lua diff --git a/init.lua b/init.lua index 41663781..643f6683 100644 --- a/init.lua +++ b/init.lua @@ -25,11 +25,11 @@ alias nvi='NVIM_APPNAME="kickstart-tsorabel" nvim' What is Kickstart? - Kickstart.nvim is *not* a distribution. + Kickstart.nvim is *not* a distribution. Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. + The gal is that you can read every line of code, top-to-bottom, understand + what our configuration is doing, and modify it to suit your needs. Once you've done that, you can start exploring, configuring and tinkering to make Neovim your own! That might mean leaving kickstart just the way it is for a while @@ -687,7 +687,7 @@ require('lazy').setup({ markdown = { 'prettier' }, graphql = { 'prettier' }, lua = { 'stylua' }, - rust = { 'rustfmt' }, + rust = { 'prettier' }, }, }, }, @@ -944,5 +944,5 @@ map({ 'n' }, 'wb', 'vs', { desc = 'New [W]orkspace [B]uffer' }) -- map({ 'n' }, '', 'vertical res -5^M', { desc = 'Buffer - width' }) map({ 'n' }, '', 'vertical res +5^M', { desc = 'Buffer + width' }) ---CarbonNow Screenshot +--Screenshot with carbon now map({ 'v' }, 's', ':CarbonNow', { desc = '[S]creenshoot with carbon now' }) diff --git a/lua/custom/plugins/carbon.lua b/lua/custom/plugins/carbon.lua new file mode 100644 index 00000000..a69f45c1 --- /dev/null +++ b/lua/custom/plugins/carbon.lua @@ -0,0 +1,27 @@ +return { + 'ellisonleao/carbon-now.nvim', + lazy = true, + cmd = 'CarbonNow', + -- @param opts cn.ConfigSchema + opts = { + base_url = 'https://carbon.now.sh/', + open_cmd = 'xdg-open', + options = { + bg = 'gray', + drop_shadow_blur = '68px', + drop_shadow = false, + drop_shadow_offset_y = '20px', + font_family = 'JetBrains Mono', + font_size = '16px', + line_height = '124%', + line_numbers = true, + theme = 'verminal', + titlebar = 'Made with carbon-now.nvim', + watermark = false, + width = '680', + window_theme = 'sharp', + padding_horizontal = '0px', + padding_vertical = '0px', + }, + }, +} diff --git a/lua/custom/plugins/dashboard.lua b/lua/custom/plugins/dashboard.lua new file mode 100644 index 00000000..4c63c56d --- /dev/null +++ b/lua/custom/plugins/dashboard.lua @@ -0,0 +1,84 @@ +return { + 'nvimdev/dashboard-nvim', + event = 'VimEnter', + config = function() + local harpoon = require 'harpoon' + require('dashboard').setup { + theme = 'doom', -- theme is doom and hyper default is hyper + disable_move = false, + config = { + week_header = { + enable = true, + }, + center = { + { + icon = '󰊳 ', + icon_hl = 'group', + desc = 'Open Harpoon', + desc_hl = 'group', + key = 'h', + key_hl = 'group', + key_format = ' [%s]', -- `%s` will be substituted with value of `key` + action = function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + }, + { + icon = '󰊳 ', + icon_hl = 'group', + desc = 'Telescope find files', + desc_hl = 'group', + key = 'f', + key_hl = 'group', + key_format = ' [%s]', -- `%s` will be substituted with value of `key` + action = ':Telescope find_files', + }, + { + icon = '󰊳 ', + icon_hl = 'group', + desc = 'Telescope find world', + desc_hl = 'group', + key = 'w', + key_hl = 'group', + key_format = ' [%s]', -- `%s` will be substituted with value of `key` + action = ':Telescope live_grep', + }, + { + icon = '󰊳 ', + icon_hl = 'group', + desc = 'Telescope commits', + desc_hl = 'group', + key = 'c', + key_hl = 'group', + key_format = ' [%s]', -- `%s` will be substituted with value of `key` + action = ':Telescope git_commits', + }, + }, + shortcut = { + { desc = '󰊳 Update', group = '@property', action = 'Lazy update', key = 'u' }, + { + icon = ' ', + icon_hl = '@variable', + desc = 'Files', + group = 'Label', + action = 'Telescope find_files', + key = 'f', + }, + { + desc = ' Apps', + group = 'DiagnosticHint', + action = 'Telescope app', + key = 'a', + }, + { + desc = ' dotfiles', + group = 'Number', + action = 'Telescope dotfiles', + key = 'd', + }, + }, + }, + } + end, + dependencies = { { 'nvim-tree/nvim-web-devicons' } }, +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..6ee227ca --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,59 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + harpoon:setup {} + vim.keymap.set({ 'n' }, 'a', function() + harpoon:list():append() + end, { desc = '[A]ppend File to harpoon' }) + vim.keymap.set('n', '', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = '[H]arpoon quick menu' }) + + vim.keymap.set('n', '', function() + harpoon:list():select(1) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(2) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(3) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(4) + end) + + -- Toggle previous & next buffers stored within Harpoon list + -- vim.keymap.set('n', '', function() + -- harpoon:list():next() + -- end) + -- vim.keymap.set('n', '', function() + -- harpoon:list():prev() + -- end) + local conf = require('telescope.config').values + local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Harpoon', + finder = require('telescope.finders').new_table { + results = file_paths, + }, + previewer = conf.file_previewer {}, + sorter = conf.generic_sorter {}, + }) + :find() + end + + vim.keymap.set('n', '', function() + toggle_telescope(harpoon:list()) + end, { desc = 'Open harpoon window' }) + end, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 9f72f306..11440bf4 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -3,90 +3,18 @@ -- -- See the kickstart.nvim README for more information return { + + -- multi line + { 'mg979/vim-visual-multi' }, + + --tag bar to se files content on side pannel { - 'ThePrimeagen/harpoon', - branch = 'harpoon2', - - dependencies = { 'nvim-lua/plenary.nvim' }, + 'preservim/tagbar', config = function() - local harpoon = require 'harpoon' - harpoon:setup() - vim.keymap.set({ 'n' }, 'a', function() - harpoon:list():append() - end, { desc = '[A]ppend File to harpoon' }) - vim.keymap.set('n', '', function() - harpoon.ui:toggle_quick_menu(harpoon:list()) - end, { desc = '[H]arpoon quick menu' }) - - vim.keymap.set('n', '', function() - harpoon:list():select(1) - end) - vim.keymap.set('n', '', function() - harpoon:list():select(2) - end) - vim.keymap.set('n', '', function() - harpoon:list():select(3) - end) - vim.keymap.set('n', '', function() - harpoon:list():select(4) - end) - - -- Toggle previous & next buffers stored within Harpoon list - vim.keymap.set('n', '', function() - harpoon:list():next() - end) - vim.keymap.set('n', '', function() - harpoon:list():prev() - end) - local conf = require('telescope.config').values - local function toggle_telescope(harpoon_files) - local file_paths = {} - for _, item in ipairs(harpoon_files.items) do - table.insert(file_paths, item.value) - end - - require('telescope.pickers') - .new({}, { - prompt_title = 'Harpoon', - finder = require('telescope.finders').new_table { - results = file_paths, - }, - previewer = conf.file_previewer {}, - sorter = conf.generic_sorter {}, - }) - :find() - end - - vim.keymap.set('n', '', function() - toggle_telescope(harpoon:list()) - end, { desc = 'Open harpoon window' }) + vim.keymap.set({ 'n' }, 'tt', 'Tagbar', { desc = '[T]oggle [T]agbar' }) end, }, - { - 'ellisonleao/carbon-now.nvim', - lazy = true, - cmd = 'CarbonNow', - -- @param opts cn.ConfigSchema - opts = { - base_url = 'https://carbon.now.sh/', - open_cmd = 'xdg-open', - options = { - bg = 'gray', - drop_shadow_blur = '68px', - drop_shadow = false, - drop_shadow_offset_y = '20px', - font_family = 'JetBrains Mono', - font_size = '16px', - line_height = '124%', - line_numbers = true, - theme = 'verminal', - titlebar = 'Made with carbon-now.nvim', - watermark = false, - width = '680', - window_theme = 'sharp', - padding_horizontal = '0px', - padding_vertical = '0px', - }, - }, - }, + + --Terminal + -- { 'akinsho/toggleterm.nvim', version = '*', config = true }, } From 6b6af7874e6cef1dcfae17bf89c4a8ce35e3a958 Mon Sep 17 00:00:00 2001 From: tsorabel Date: Wed, 27 Mar 2024 21:42:28 +0100 Subject: [PATCH 8/8] feat: carbon window rename --- lua/custom/plugins/carbon.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/carbon.lua b/lua/custom/plugins/carbon.lua index a69f45c1..89c75dfa 100644 --- a/lua/custom/plugins/carbon.lua +++ b/lua/custom/plugins/carbon.lua @@ -16,7 +16,7 @@ return { line_height = '124%', line_numbers = true, theme = 'verminal', - titlebar = 'Made with carbon-now.nvim', + titlebar = 'VIM 🚀', watermark = false, width = '680', window_theme = 'sharp',