Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
adibhanna committed Apr 22, 2023
1 parent e5d1c75 commit 791bff3
Show file tree
Hide file tree
Showing 12 changed files with 276 additions and 63 deletions.
3 changes: 3 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

require("config.keymaps")
require("config.options")
require("config.lazy")
11 changes: 11 additions & 0 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
{
"LuaSnip": { "branch": "master", "commit": "8d6c0a93dec34900577ba725e91c44b8d3ca1f45" },
"alpha-nvim": { "branch": "main", "commit": "87c204040e3f5d4c1c95067b35905d8f8a2f2545" },
"bufferline.nvim": { "branch": "main", "commit": "8b32447f1ba00f71ec2ebb413249d1d84228d9fb" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
"gitsigns.nvim": { "branch": "main", "commit": "7dfe4be94b4f84a9931098f0f0f618d055e50bd5" },
"gruvbox-material": { "branch": "master", "commit": "5fd0f0e4133d2416b0d69c26c87189fced9060ec" },
"lazy.nvim": { "branch": "main", "commit": "fe28f4b73e0df887ec20196a00a1eddd12a2cf5f" },
"lsp-zero.nvim": { "branch": "v2.x", "commit": "28a9c8f6cdf562d41171349e874afa3b7bc02097" },
"lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "463e5e7441c17c0f9fba35b3016e7691a78983b9" },
"mason.nvim": { "branch": "main", "commit": "d76949e3b92a8a184bac683227c1024920fe763b" },
"mini.indentscope": { "branch": "main", "commit": "43f6761c9a3e397b7c12b3c72f678bcf61efcfcf" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "7a6b0d43d70636edfec183fb49c02f725765da73" },
"nui.nvim": { "branch": "main", "commit": "ecd9def93891b9260b15b5fcef542eaabf4145c9" },
"nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" },
"nvim-lspconfig": { "branch": "master", "commit": "cf95480e876ef7699bf08a1d02aa0ae3f4d5f353" },
"nvim-treesitter": { "branch": "master", "commit": "57d1a5843742a180be9a3a1d1c652a7d22709691" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "8673926519ea61069f9c1366d1ad1949316d250e" },
"nvim-web-devicons": { "branch": "master", "commit": "4ec26d67d419c12a4abaea02f1b6c57b40c08d7e" },
"plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
"telescope-project.nvim": { "branch": "master", "commit": "fa081e35ba7397e5147a51ece693aa3afda167fc" },
"telescope.nvim": { "branch": "master", "commit": "6258d50b09f9ae087317e392efe7c05a7323492d" },
"trouble.nvim": { "branch": "main", "commit": "d56bfc0c501ced4002a57cb60433362fb2ce9c4d" },
"vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" },
"which-key.nvim": { "branch": "main", "commit": "94cb020ff33a1e0e22fac1c41663d2c439741f17" }
}
3 changes: 0 additions & 3 deletions lua/config/keymaps.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
Expand Down
2 changes: 2 additions & 0 deletions lua/config/lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ require("lazy").setup({
},
},
})

require("telescope").load_extension("fzf")
73 changes: 62 additions & 11 deletions lua/config/which_key_defaults.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
-- -- function to reload config
-- local function reload_nvim_config()
-- print("Reloading config...")
-- vim.cmd("source $MYVIMRC")
-- end

return {
mode = { "n", "v" },
[";"] = { ":Alpha<CR>", "Dashboard" },
w = { ":w!<CR>", "Save" },
q = { ":confirm q<CR>", "Quit" },
c = { ":bd<CR>", "Close Buffer" },
h = { ":nohlsearch<CR>", "No Highlight" },
p = { ":Lazy<CR>", "Lazy" },
f = { ':Telescope find_files<CR>', "Find Files" },
b = {
name = "Buffers",
j = { "<cmd>BufferLinePick<cr>", "Jump" },
Expand Down Expand Up @@ -38,8 +34,63 @@ return {
p = { "<cmd>BufferLineTogglePin<CR>", "Toggle pin" },
P = { "<cmd>BufferLineGroupClose ungrouped<CR>", "Delete non-pinned buffers" },
},
-- n = {
-- name = "Neovimmmm",
-- r = { reload_nvim_config, "Reload Config" },
-- }
}
g = {
name = "+Git",
j = { "<cmd>lua require 'gitsigns'.next_hunk({navigation_message = false})<cr>", "Next Hunk" },
k = { "<cmd>lua require 'gitsigns'.prev_hunk({navigation_message = false})<cr>", "Prev Hunk" },
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
u = {
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
"Undo Stage Hunk",
},
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
C = {
"<cmd>Telescope git_bcommits<cr>",
"Checkout commit(for current file)",
},
d = {
"<cmd>Gitsigns diffthis HEAD<cr>",
"Git Diff",
},
},
l = {
name = "+LSP",
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
d = { "<cmd>lua vim.lsp.buf.definition()<cr>", "Definition" },
D = { "<cmd>lua vim.lsp.buf.declaration()<cr>", "Declaration" },
i = { "<cmd>lua vim.lsp.buf.implementation()<cr>", "Implementation" },
o = { "<cmd>lua vim.lsp.buf.type_definition()<cr>", "Type Definition" },
R = { "<cmd>lua vim.lsp.buf.references()<cr>", "References" },
s = { "<cmd>lua vim.lsp.buf.signature_help()<cr>", "Display Signature Information" },
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename all references" },
f = { "<cmd>lua vim.lsp.buf.format()<cr>", "Format" },
K = { "<cmd>lua vim.lsp.buf.hover()<cr>", "Hover" },
-- l = { "<cmd>lua vim.lsp.diagnostic.open_float()<cr>", "Show Line Diagnostics" },
l = { "<cmd>TroubleToggle document_diagnostics<cr>", "Document Diagnostics (Trouble)" },
L = { "<cmd>TroubleToggle workspace_diagnostics<cr>", "Workspace Diagnostics (Trouble)" },
w = { "<cmd>Telescope diagnostics<cr>", "Diagnostics" },
-- j = { "<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", "Previous Diagnostic" },
-- k = { "<cmd>lua vim.lsp.diagnostic.goto_next()<cr>", "Next Diagnostic" },
-- e = { "<cmd>Telescope quickfix<cr>", "Telescope Quickfix" },
},
s = {
name = "+Search",
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
f = { "<cmd>Telescope find_files<cr>", "Find File" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
H = { "<cmd>Telescope highlights<cr>", "Find highlight groups" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },
t = { "<cmd>Telescope live_grep<cr>", "Text" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
C = { "<cmd>Telescope commands<cr>", "Commands" },
l = { "<cmd>Telescope resume<cr>", "Resume last search" },
},
}
1 change: 0 additions & 1 deletion lua/plugins/alfa-nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ return -- dashboard
dashboard.button("r", "" .. " Recent files", ":Telescope oldfiles <CR>"),
dashboard.button("g", "" .. " Find text", ":Telescope live_grep <CR>"),
dashboard.button("c", "" .. " Config", ":e $MYVIMRC <CR>"),
dashboard.button("s", "" .. " Restore Session", [[:lua require("persistence").load() <cr>]]),
dashboard.button("l", "󰒲 " .. " Lazy", ":Lazy<CR>"),
dashboard.button("q", "" .. " Quit", ":qa<CR>"),
}
Expand Down
70 changes: 70 additions & 0 deletions lua/plugins/gitsigns.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
return {
"lewis6991/gitsigns.nvim",
config = function()
local icons = require("config.icons")
require("gitsigns").setup {
signs = {
add = {
hl = "GitSignsAdd",
text = icons.ui.BoldLineLeft,
numhl = "GitSignsAddNr",
linehl = "GitSignsAddLn",
},
change = {
hl = "GitSignsChange",
text = icons.ui.BoldLineLeft,
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
delete = {
hl = "GitSignsDelete",
text = icons.ui.Triangle,
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
topdelete = {
hl = "GitSignsDelete",
text = icons.ui.Triangle,
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
changedelete = {
hl = "GitSignsChange",
text = icons.ui.BoldLineLeft,
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
},
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
sign_priority = 6,
status_formatter = nil, -- Use default
update_debounce = 200,
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
border = "rounded",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
yadm = { enable = false },
}
end
}
2 changes: 1 addition & 1 deletion lua/plugins/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ return {
},
{ "filename", path = 1, symbols = { modified = "", readonly = "", unnamed = "" } },

-- { "diagnostics", sources = { "nvim_lsp" }, symbols = { error = " ", warn = " ", info = " " }
{ "diagnostics", sources = { "nvim_lsp" }, symbols = { error = "", warn = "", info = "" } },
},
lualine_x = { "encoding" },
lualine_y = { "progress" },
Expand Down
99 changes: 52 additions & 47 deletions lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
return {
'nvim-telescope/telescope.nvim',
cmd = 'Telescope',
version = false,
dependencies = {
'nvim-lua/plenary.nvim',
{'nvim-telescope/telescope-fzf-native.nvim', build = 'make'}
},
keys = {
{ '<leader>f', '<cmd>Telescope find_files<CR>', desc = "Find Files" }
},
opts = {
config = function()
require('telescope').setup {
defaults = {
file_ignore_patterns = { 'node_modules', 'package-lock.json' }
},
theme = 'dropdown',
initial_mode = 'insert',
select_strategy = 'reset',
sorting_strategy = nil,
layout_strategy = nil,
layout_config = {},
path_display = { "smart" },
winblend = 0,
border = {},
borderchars = nil,
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" },
pickers = {
find_files = {
hidden = true,
},
live_grep = {
--@usage don't include the filename in the search results
only_sort_text = true,
{
'nvim-telescope/telescope.nvim',
cmd = 'Telescope',
version = false,
lazy = true,
dependencies = {
'nvim-lua/plenary.nvim',
"nvim-tree/nvim-web-devicons",
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
},
opts = {
config = function()
require('telescope').setup({
defaults = {
file_ignore_patterns = { 'node_modules', 'package-lock.json' }
},
grep_string = {
only_sort_text = true,
theme = 'dropdown',
initial_mode = 'insert',
select_strategy = 'ascending',
sorting_strategy = nil,
layout_strategy = nil,
layout_config = {},
path_display = { "smart" },
winblend = 0,
border = {},
borderchars = nil,
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" },
pickers = {
find_files = {
hidden = true,
},
live_grep = {
--@usage don't include the filename in the search results
only_sort_text = true,
},
grep_string = {
only_sort_text = true,
},
},
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
},
},
},
}
})
end
},
config = function()
local telescope = require('telescope')
telescope.load_extension('fzf')
end
}
},
}
5 changes: 5 additions & 0 deletions lua/plugins/trouble.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
return {
"folke/trouble.nvim",
cmd = { "TroubleToggle", "Trouble" },
opts = { use_diagnostic_signs = true }
}
29 changes: 29 additions & 0 deletions lua/plugins/vim-illuminate.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
return {
"RRethy/vim-illuminate",
event = { "BufReadPost", "BufNewFile" },
opts = { delay = 200 },
config = function(_, opts)
require("illuminate").configure(opts)

local function map(key, dir, buffer)
vim.keymap.set("n", key, function()
require("illuminate")["goto_" .. dir .. "_reference"](false)
end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer })
end

map("]]", "next")
map("[[", "prev")

vim.api.nvim_create_autocmd("FileType", {
callback = function()
local buffer = vim.api.nvim_get_current_buf()
map("]]", "next", buffer)
map("[[", "prev", buffer)
end,
})
end,
keys = {
{ "]]", desc = "Next Reference" },
{ "[[", desc = "Prev Reference" },
},
}
Loading

0 comments on commit 791bff3

Please sign in to comment.