Skip to content

Commit

Permalink
update nvim config
Browse files Browse the repository at this point in the history
  • Loading branch information
teddywaweru committed Jun 24, 2024
1 parent 62aba01 commit 06b75c3
Show file tree
Hide file tree
Showing 12 changed files with 671 additions and 704 deletions.
12 changes: 8 additions & 4 deletions nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ vim.opt.rtp:prepend(lazypath)

-- validate that lazy is available
if not pcall(require, "lazy") then
-- stylua: ignore
vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
vim.fn.getchar()
vim.cmd.quit()
Expand All @@ -19,7 +18,12 @@ end

vim.loader.enable()
local plugins = require("plugins")
require("lazy").setup(plugins)
require("lazy").setup(plugins, {
-- performance = {
-- rtp = {
-- disabled_plugins = {
-- }
-- }
-- }
})
require("after")
--require "lazy_setup"
--require "polish"
2 changes: 1 addition & 1 deletion nvim/lua/before/globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ P = function(v)
return v
end
RELOAD = function(...)
return require("plenary.relaod").reload_module(...)
return require("plenary.reload").reload_module(...)
end

R = function(name)
Expand Down
57 changes: 2 additions & 55 deletions nvim/lua/before/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require("before.config")
require("before.remap")
require("before.globals")


-- TODO
Expand Down Expand Up @@ -111,11 +112,6 @@ require("before.remap")
-- .nav(vim.v.count > 0 and vim.v.count or 1)
-- end, desc = "Move to next Buffer" },
--
--
-- -- Show neoclip Register List
-- ["<leader>f\""] = { "<cmd>Telescope neoclip<CR>", desc = "Open neoclip register List" },
--
--
-- -- ["<leader>r"] = { "<cmd>diffoff!<CR><cmd>windo diffthis<CR>", desc = "Diff two open window buffers" },
--
-- },
Expand All @@ -124,20 +120,9 @@ require("before.remap")


-- ---Plugins to Consider
-- -- treesitter-context, nvim-bqf, treesj, trouble
-- -- nvim-bqf,
--
-- },
-- ,
-- ,
-- ,
-- {
-- "AckslD/nvim-neoclip.lua",
-- event = "VeryLazy",
-- config = function()
-- require('neoclip').setup()
-- require('telescope').load_extension('neoclip')
-- end
-- },
-- {
-- "nvim-telescope/telescope.nvim",
-- event = "VeryLazy",
Expand Down Expand Up @@ -169,41 +154,3 @@ require("before.remap")
-- end
--
-- },
-- {
-- "akinsho/toggleterm.nvim",
-- cmd = { "ToggleTerm", "TermExec" },
-- event = "VeryLazy",
-- config = function (_,opts)
-- -- load init options for the plugin
-- require("toggleterm").setup(opts)
-- -- make alterations
-- require("toggleterm").setup({
-- autochdir = true,
-- open_mappings = true,
-- insert_mappings = true
-- })
-- end
-- },
--
-- {
-- "chentoast/marks.nvim",
-- event = "VeryLazy",
-- config = function()
-- require("marks").setup({
-- default_mappings = true,
-- builtin_marks = { ".", "<", ">", "z", "m", "p" },
-- cyclic = true,
-- refresh_interval = 250,
-- sign_priority = { lower = 10, upper = 15, builtin = 8, bookmark = 20 },
-- excluded_filetypes = {
-- "neo-tree",
-- "nui",
-- },
-- bookmark_0 = {
-- sign = "⚑",
-- virt_text = "BookMark",
-- },
-- mappings = {},
-- })
-- end
-- },
12 changes: 6 additions & 6 deletions nvim/lua/before/remap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ vim.keymap.set("n", "n", "nzzzv", { desc = "Center Search result and open fold"
vim.keymap.set("n", "<leader>e", "<cmd>e %:h<CR>", { desc = "Open Current Buffer Location in netrw" })

-- Organization
vim.keymap.set("n", "<leader>bD", "<cmd>%bd|e#<CR>",{ desc = "Close all other buffers?" } )
vim.keymap.set("n", "<leader>bd", ":b#|bd#<CR>", { desc = "Close current buffer and navigate to previoius" })
vim.keymap.set("n", "<leader>bD", "<cmd>%bd|e#<CR>", { desc = "Close all other buffers?" })
vim.keymap.set("n", "<leader>bd", ":bp|bd#<CR>", { desc = "Close current buffer and navigate to previoius" })
vim.keymap.set("n", "<leader>W", "<cmd>wall<CR>", { desc = "Save all files changes" })

vim.keymap.set("t", "<C-k>", "<cmd>ToggleTerm<CR>", { desc = "Toggle Floating terminal" })
Expand All @@ -52,7 +52,7 @@ vim.keymap.set("n", "<leader>Tm", "<cmd>tabm<CR>", { desc = "Move Current Tab to
vim.keymap.set("n", "<leader>Ta", "<cmd>Telescope telescope-tabs list_tabs<CR>h", { desc = "List of all Tabs" })

-- Hop
vim.keymap.set("n", "gj", "<cmd>HopChar1<CR>", { desc = "hop-char" })
vim.keymap.set("n", "gl", "<cmd>HopChar1<CR>", { desc = "hop-char" })


-- LSP
Expand All @@ -69,14 +69,14 @@ vim.api.nvim_create_autocmd("LspAttach", {
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", "<leader>bs", vim.lsp.buf.format, {desc = "Format buffer depending on LSP server attached"})
vim.keymap.set("n", "<leader>lr", vim.lsp.buf.rename, {desc = "Rename all instances of the variable?"})
vim.keymap.set("n", "<leader>bs", vim.lsp.buf.format, { desc = "Format buffer depending on LSP server attached" })
vim.keymap.set("n", "<leader>lr", vim.lsp.buf.rename, { desc = "Rename all instances of the variable?" })
end
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("format.rs", {}),
pattern = ".rs",
callback = function ()
callback = function()
local curr_file = vim.api.nvim_get_current_buf()
vim.cmd("rustfmt" .. curr_file)
end
Expand Down
214 changes: 214 additions & 0 deletions nvim/lua/plugins/functional.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@

return {

{
"vifm/vifm.vim",
lazy = true,
event = "VeryLazy",
},
{
'christoomey/vim-tmux-navigator',
event = "VeryLazy"
},
{
"nvim-lua/plenary.nvim",
name = "plenary",
lazy = true,
event = "VeryLazy",
config = function()
require("plenary")
end
},
{
-- Save sessions
"rmagatti/auto-session",
Lazy = true,
event = "TabEnter"
},
{
-- Scoped Tabs
"tiagovla/scope.nvim",
Lazy = true,
event = "TabEnter"
},
{
"chentoast/marks.nvim",
lazy = true,
event = "BufEnter",
config = function()
require("marks").setup({
default_mappings = false,
builtin_marks = { ".", "<", ">", "#", "@", "$" },
-- whether movements cycle back to the beginning/end of buffer. default true
cyclic = true,
-- whether the shada file is updated after modifying uppercase marks. default false
force_write_shada = true,
-- how often (in ms) to redraw signs/recompute mark positions.
refresh_interval = 250,
-- sign priorities for each type of mark - builtin marks, uppercase marks, lowercase
-- marks, and bookmarks.
-- can be either a table with all/none of the keys, or a single number, in which case
-- the priority applies to all marks.
-- default 10.
sign_priority = { lower = 10, upper = 15, builtin = 8, bookmark = 20 },
mappings = {
toggle = "m'",
set_next = "m,",
next = "m]",
preview = "m:",
prev = "m[",
delete = "dm",
delete_line = "dm;",
delete_buf = "dm<space>"
}
})
end
},
{
"folke/which-key.nvim",
lazy = true,
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeout = 50
end,
opts = {}
},
{
"rcarriga/nvim-notify",
lazy = true,
event = "VeryLazy",
config = function(_, opts)
-- vim.opt.termguicolors = true
local notify = require("notify")
notify.setup()
opts.top_down = false
opts.background_colour = "#000000"
notify.setup(opts)
vim.notify = notify
end,
},
{
"f-person/git-blame.nvim",
lazy = true,
event = "BufEnter",
config = function()
require("gitblame").setup()
end
},
{
"kdheepak/lazygit.nvim",
lazy = true,
event = "VeryLazy",
dependencies = {
"plenary"
},
config = function()
vim.keymap.set("n", "<leader>lg", "<cmd>LazyGit<CR>", { desc = "Toggle LazyGit" })
end,
opts = function()
vim.g.lazygit_floating_window_scaling_factor = 0.9
end
},
{
"AckslD/nvim-neoclip.lua",
lazy = true,
event = "VeryLazy",
config = function()
require('neoclip').setup()
require('telescope').load_extension('neoclip')
vim.keymap.set("n", "<leader>f/", "<cmd>Telescope neoclip<CR>", { desc = "Search in texts" })
end
},
{
"smoka7/hop.nvim",
lazy = true,
event = "VeryLazy",
-- branch = 'v2', -- optional but strongly recommended
cmd = { "HopChar1", "HopLine" },
config = function()
-- you can configure Hop the way you like here; see :h hop-config
require("hop").setup {
keys = 'etovxqpdygfblzhckisuran',
case_insensitive = false }
end,
opts = {
}
},
-- Splitting/Joining blocks of code arrays, hashes, statements, objects
{
"Wansmer/treesj",
lazy = true,
event = "VeryLazy",
config = function()
require("treesj").setup({
max_join_length = 1500,
use_default_keymaps = false

})
vim.keymap.set('n', '<leader>lT', '<cmd>TSJToggle<CR>', { desc = "Toggle Split/Join code blocks " })
end
},
{
"kylechui/nvim-surround",
lazy = true,
event = "VeryLazy",
version = "*",
opts = {}
},
{
"akinsho/toggleterm.nvim",
lazy = true,
event = "VeryLazy",
config = function()
require("toggleterm").setup({
open_mapping = [[<c-\>]],
-- insert_mapping = false,
-- terminal_mapping = false,
autochdir = true,
direction = "float",
float_opts = {
border = "curved",
width = 150,
height = 30,
title_pos = "center"
}
})
end,
opts = function()
vim.keymap.set("n", "<leader>tt", "<cmd>ToggleTerm<CR>", { desc = "Toggle Floating terminal" })
end

},
{
"mbbill/undotree",
lazy = true,
event = "VeryLazy",
},
{
'ThePrimeagen/harpoon',
event = "VeryLazy",
config = function()
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>aa", mark.add_file)
vim.keymap.set("n", "<leader>au", ui.toggle_quick_menu)
vim.keymap.set("n", "H", ui.nav_prev)
vim.keymap.set("n", "L", ui.nav_next)
vim.cmd('highlight! HarpoonInactive guibg=NONE guifg=#63698c')
vim.cmd('highlight! HarpoonActive guibg=NONE guifg=white')
vim.cmd('highlight! HarpoonNumberActive guibg=NONE guifg=#7aa2f7')
vim.cmd('highlight! HarpoonNumberInactive guibg=NONE guifg=#7aa2f7')
vim.cmd('highlight! TabLineFill guibg=NONE guifg=white')
require("harpoon").setup({
save_on_change = true,
tabline = false,
menu = {
-- width = vim.api.nvim_win_get_width(0) - 20,
width = 60,
height = vim.api.nvim_win_get_height(0) - 30
}
})
end
},
}
14 changes: 11 additions & 3 deletions nvim/lua/plugins/init.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
local plugins = {}

local telescope = require("plugins.telescope")
local others = require("plugins.others")
table.insert(plugins, telescope)
local nvim_config = require("plugins.nvim_lspconfig")
local vim_vsnip = require("plugins.vim_vsnip")
local theming = require("plugins.theming")
local functional = require("plugins.functional")
local programming = require("plugins.programming")
local pedantic_btw = require("plugins.pedantic_btw")

table.insert(plugins, others)
local custom_plugins = { telescope, nvim_config, vim_vsnip, theming, programming, functional, pedantic_btw}

for k,v in pairs({ custom_plugins }) do
plugins[k] = v
end

return plugins
Loading

0 comments on commit 06b75c3

Please sign in to comment.