diff --git a/nvim/.config/nvim/after/plugin/config.lua b/nvim/.config/nvim/after/plugin/config.lua deleted file mode 100644 index f6a47d2..0000000 --- a/nvim/.config/nvim/after/plugin/config.lua +++ /dev/null @@ -1,121 +0,0 @@ --- PLUGIN CONFIGURATION ---- bufdelete.nvim -vim.keymap.set("n", "bd", function() - require("bufdelete").bufdelete(0, true) -end) - ---- gitblame.nvim -vim.g.gitblame_use_blame_commit_file_urls = true -vim.g.gitblame_display_virtual_text = 0 - -require('gitblame').setup {enabled = true} - -vim.api.nvim_set_keymap('n', 'gbo', ':GitBlameOpenCommitURL', { - noremap = true, - silent = true, -}) - ---- gitlinker.nvim -require"gitlinker".setup({ - router = { - browse = { - ["^git%.atomaka%.com"] = "https://git.atomaka.com/" - .. "{_A.ORG}/" - .. "{_A.REPO}/commit/" - .. "{_A.REV}/" - }, - blame = { - ["^git%.atomaka%.com"] = "https://git.atomaka.com/" - .. "{_A.ORG}/" - .. "{_A.REPO}/blame/" - .. "branch/{_A.CURRENT_BRANCH}/" - .. "{_A.FILE}" - }, - }, -}) -vim.keymap.set( - {"n", 'v'}, - "gl", - function() - require("gitlinker").link({ action = require("gitlinker.actions").system }) - end, - { silent = true, noremap = true, desc = "GitLink!" } -) -vim.keymap.set( - {"n", 'v'}, - "glb", - function() - require("gitlinker").link({ - router_type = "blame", - action = require("gitlinker.actions").system, - }) - end, - { silent = true, noremap = true, desc = "GitLink! blame" } -) - ---- gitsigns.nvim -require("gitsigns").setup() -vim.keymap.set("n", "gb", require("gitsigns").toggle_current_line_blame) - ---- git-messanger.vim -vim.g["git_messenger_always_into_popup"] = 1 - ---- nvim-surround -require("nvim-surround").setup() - ---- telescope.nvim -vim.api.nvim_set_keymap('n', 't', ':Telescope', { - noremap = true, - silent = true, -}) -vim.keymap.set("n", "", function() - require("telescope.builtin").find_files({ - file_ignore_patterns = {".git/", "node_modules/"}, - hidden = true, - previewer = false, - }) -end) -vim.keymap.set('n', 'ff', function() - require("telescope.builtin").find_files({ - file_ignore_patterns = {".git/", "node_modules/"}, - hidden = true, - no_ignore = true, - previewer = false, - }) -end) -vim.keymap.set('n', 'fg', function() - require("telescope.builtin").live_grep({ - file_ignore_patterns = {".git/", "node_modules/"}, - hidden = true, - previewer = false, - }) -end) -vim.keymap.set('n', 'fb', function() - require("telescope.builtin").buffers() -end) - ---- whitespace.nvim -require("whitespace-nvim").setup({ - hightlight = "red" -}) -vim.keymap.set("n", "fw", function() - require("whitespace-nvim").trim() -end, { silent = true }) - ---- vim-zoom --- let g:zoom#statustext='Z' -vim.api.nvim_tabpage_set_var(0, "zoomed", 0) -vim.keymap.set("n", "", function() - local char = vim.fn.nr2char(vim.fn.getchar()) - - if vim.api.nvim_tabpage_get_var(0, "zoomed")== 1 then - if char == 'v' or char == 's' or char == '' or char == '' then - vim.notify("cannot split when zoomed", vim.log.levels.ERROR) - return "" - end - end - - return ""..char -end, {expr = true, replace_keycodes = true}) -vim.keymap.set("n", "z", "(zoom-toggle)") -vim.keymap.set("n", "", "(zoom-toggle)") diff --git a/nvim/.config/nvim/lua/plugins/bufdelete.lua b/nvim/.config/nvim/lua/plugins/bufdelete.lua new file mode 100644 index 0000000..b1e3e48 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/bufdelete.lua @@ -0,0 +1,6 @@ +return { + "famiu/bufdelete.nvim", + keys = { + { "bd", function() require("bufdelete").bufdelete(0, true) end } + }, +} diff --git a/nvim/.config/nvim/lua/plugins/git-blame.lua b/nvim/.config/nvim/lua/plugins/git-blame.lua new file mode 100644 index 0000000..c52778d --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/git-blame.lua @@ -0,0 +1,12 @@ +return { + "f-person/git-blame.nvim", + event = "VeryLazy", + keys = { + { "gbo", "GitBlameOpenCommitURL", desc = "Open Commit" } + }, + opts = { + enabled = true, + use_blame_commit_file_urls = true, + display_virtual_text = false + }, +} diff --git a/nvim/.config/nvim/lua/plugins/git-messenger.lua b/nvim/.config/nvim/lua/plugins/git-messenger.lua new file mode 100644 index 0000000..7f9a415 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/git-messenger.lua @@ -0,0 +1,5 @@ +vim.g["git_messenger_always_into_popup"] = 1 + +return { + "rhysd/git-messenger.vim" +} diff --git a/nvim/.config/nvim/lua/plugins/gitlinker.lua b/nvim/.config/nvim/lua/plugins/gitlinker.lua new file mode 100644 index 0000000..400d2be --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/gitlinker.lua @@ -0,0 +1,27 @@ +return { + { + "linrongbin16/gitlinker.nvim", + cmd = "GitLink", + opts = { + router = { + browse = { + ["^git%.atomaka%.com"] = "https://git.atomaka.com/" + .. "{_A.ORG}/" + .. "{_A.REPO}/commit/" + .. "{_A.REV}/" + }, + blame = { + ["^git%.atomaka%.com"] = "https://git.atomaka.com/" + .. "{_A.ORG}/" + .. "{_A.REPO}/blame/" + .. "branch/{_A.CURRENT_BRANCH}/" + .. "{_A.FILE}" + }, + }, + }, + keys = { + { "gl", "GitLink!", mode = { "n", "v" }, desc = "Gitlink!" }, + { "glb", "GitLink! blame", mode = { "n", "v" }, desc = "Gitlink! blame" }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/gitsigns.lua b/nvim/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..d62e242 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,11 @@ +return { + "lewis6991/gitsigns.nvim", + keys = { + { + "gb", + function() require("gitsigns").toggle_current_line_blame() end, + desc = "Toggle line blame" + } + }, + config = function() require("gitsigns").setup({}) end, +} diff --git a/nvim/.config/nvim/lua/plugins/init.lua b/nvim/.config/nvim/lua/plugins/init.lua index 3007c62..158b6c7 100644 --- a/nvim/.config/nvim/lua/plugins/init.lua +++ b/nvim/.config/nvim/lua/plugins/init.lua @@ -1,16 +1,9 @@ return { "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - "famiu/bufdelete.nvim", - "dhruvasagar/vim-zoom", "gpanders/editorconfig.nvim", - "johnfrankmorgan/whitespace.nvim", + "johnfrankmorgan/whitespace.nvim", -- not working "kylechui/nvim-surround", -- "FabijanZulj/blame.nvim", - "rhysd/git-messenger.vim", - "lewis6991/gitsigns.nvim", - "linrongbin16/gitlinker.nvim", - "f-person/git-blame.nvim", "tpope/vim-eunuch", "gruvbox-community/gruvbox", diff --git a/nvim/.config/nvim/lua/plugins/nvim-surround.lua b/nvim/.config/nvim/lua/plugins/nvim-surround.lua new file mode 100644 index 0000000..90f3eac --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/nvim-surround.lua @@ -0,0 +1,7 @@ +return { + "kylechui/nvim-surround", + event = "VeryLazy", + config = function() + require("nvim-surround").setup({}) + end +} diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..5cc91d2 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,36 @@ +local builtin = require('telescope.builtin') + +vim.api.nvim_set_keymap('n', 't', ':Telescope', { + noremap = true, + silent = true, +}) +vim.keymap.set("n", "", function() + builtin.find_files({ + file_ignore_patterns = {".git/", "node_modules/"}, + hidden = true, + previewer = false, + }) +end) +vim.keymap.set('n', 'ff', function() + builtin.find_files({ + file_ignore_patterns = {".git/", "node_modules/"}, + hidden = true, + no_ignore = true, + previewer = false, + }) +end) +vim.keymap.set('n', 'fg', function() + builtin.live_grep({ + file_ignore_patterns = {".git/", "node_modules/"}, + hidden = true, + previewer = false, + }) +end) +vim.keymap.set('n', 'fb', function() + builtin.buffers() +end) + +return { + 'nvim-telescope/telescope.nvim', + dependencies = { 'nvim-lua/plenary.nvim' } +} diff --git a/nvim/.config/nvim/lua/plugins/vim-zoom.lua b/nvim/.config/nvim/lua/plugins/vim-zoom.lua new file mode 100644 index 0000000..75e1e9f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/vim-zoom.lua @@ -0,0 +1,21 @@ +vim.api.nvim_tabpage_set_var(0, "zoomed", 0) +vim.keymap.set("n", "", function() + local char = vim.fn.nr2char(vim.fn.getchar()) + + if vim.api.nvim_tabpage_get_var(0, "zoomed")== 1 then + if char == 'v' or char == 's' or char == '' or char == '' then + vim.notify("cannot split when zoomed", vim.log.levels.ERROR) + return "" + end + end + + return ""..char +end, {expr = true, replace_keycodes = true}) + +return { + "dhruvasagar/vim-zoom", + keys = { + { "z", "(zoom-toggle)" }, + { "", "(zoom-toggle)" }, + } +}