Simplify + add whichkey mappings
This commit is contained in:
@@ -3,3 +3,4 @@
|
||||
## Requirements:
|
||||
* Git
|
||||
* [ripgrep](https://github.com/BurntSushi/ripgrep)
|
||||
* [fd](https://github.com/sharkdp/fd)
|
||||
|
||||
@@ -1 +1,18 @@
|
||||
require("core.settings")
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
g.mapleader = " "
|
||||
|
||||
opt.backup = false
|
||||
opt.swapfile = false
|
||||
opt.termguicolors = true
|
||||
opt.number = true
|
||||
opt.mouse = "a"
|
||||
opt.cursorline = true
|
||||
opt.hidden = true
|
||||
|
||||
-- Indentation
|
||||
opt.expandtab = true
|
||||
opt.smartindent = true
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
g.mapleader = " "
|
||||
|
||||
opt.backup = false
|
||||
opt.swapfile = false
|
||||
opt.termguicolors = true
|
||||
opt.number = true
|
||||
opt.mouse = "a"
|
||||
opt.cursorline = true
|
||||
opt.hidden = true
|
||||
|
||||
-- Indentation
|
||||
opt.expandtab = true
|
||||
opt.smartindent = true
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
10
lua/plugins/barbar_nvimtree.lua
Normal file
10
lua/plugins/barbar_nvimtree.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
local nvim_tree_events = require("nvim-tree.events")
|
||||
local bufferline_state = require("bufferline.state")
|
||||
|
||||
nvim_tree_events.on_tree_open(function ()
|
||||
bufferline_state.set_offset(31, "File Tree")
|
||||
end)
|
||||
|
||||
nvim_tree_events.on_tree_close(function ()
|
||||
bufferline_state.set_offset(0)
|
||||
end)
|
||||
@@ -1,4 +0,0 @@
|
||||
require("bufdel").setup {
|
||||
next = "alternate",
|
||||
quit = false
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
require("bufferline").setup {
|
||||
options = {
|
||||
offsets = {{ filetype = "NvimTree", text = "File Explorer" }},
|
||||
tab_size = 20,
|
||||
separator_style = "thin"
|
||||
}
|
||||
}
|
||||
9
lua/plugins/config/catppuccin.lua
Normal file
9
lua/plugins/config/catppuccin.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
require("catppuccin").setup {
|
||||
integrations = {
|
||||
lsp_trouble = true,
|
||||
which_key = true,
|
||||
barbar = true
|
||||
}
|
||||
}
|
||||
|
||||
vim.cmd[[colorscheme catppuccin]]
|
||||
@@ -1,46 +0,0 @@
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" }
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@ require("lualine").setup {
|
||||
options = {
|
||||
theme = "catppuccin"
|
||||
},
|
||||
|
||||
extensions = {
|
||||
"nvim-tree",
|
||||
"toggleterm",
|
||||
"quickfix"
|
||||
"toggleterm"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
luasnip.config.set_config {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI"
|
||||
}
|
||||
|
||||
require("luasnip/loaders/from_vscode").load()
|
||||
@@ -1,25 +1,24 @@
|
||||
local g = vim.g
|
||||
|
||||
g.nvim_tree_highlight_opened_files = 1
|
||||
g.nvim_tree_git_hl = 1
|
||||
g.nvim_tree_highlight_opened_files = 1
|
||||
g.nvim_tree_group_empty = 1
|
||||
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
|
||||
g.nvim_tree_create_in_closed_folder = 1
|
||||
|
||||
require("nvim-tree").setup {
|
||||
disable_netrw = true,
|
||||
ignore_ft_on_setup = { "dashboard" },
|
||||
hijack_cursor = true,
|
||||
update_cwd = true,
|
||||
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true
|
||||
},
|
||||
git = {
|
||||
ignore = false
|
||||
},
|
||||
|
||||
view = {
|
||||
hide_root_folder = true
|
||||
},
|
||||
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"json",
|
||||
"javascript"
|
||||
},
|
||||
ensure_installed = { "lua", "bash", "cpp", "css", "go", "gomod", "html", "javascript", "json", "make", "python", "typescript" },
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true
|
||||
enable = true
|
||||
},
|
||||
|
||||
matchup = {
|
||||
enable = true
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,46 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup {
|
||||
ignore_missing = true
|
||||
ignore_missing = false
|
||||
}
|
||||
|
||||
wk.register({
|
||||
["<leader>"] = {
|
||||
f = {
|
||||
name = "Files",
|
||||
f = { "<cmd>Telescope find_files<CR>", "Find File" },
|
||||
g = { "<cmd>Telescope live_grep<CR>", "Live Grep" }
|
||||
},
|
||||
-- Barbar
|
||||
b = {
|
||||
name = "Buffers",
|
||||
b = { "<cmd>Telescope buffers<CR>", "Find Buffers" },
|
||||
x = { "<cmd>BufDel<CR>", "Close Buffer" }
|
||||
},
|
||||
t = {
|
||||
name = "NvimTree",
|
||||
t = { "<cmd>NvimTreeToggle<CR>", "NvimTree Toggle" },
|
||||
f = { "<cmd>NvimTreeFocus<CR>", "NvimTree Focus" }
|
||||
name = "Barbar",
|
||||
x = { "<cmd>BufferClose<CR>", "Close Buffer" },
|
||||
n = { "<cmd>BufferMoveNext<CR>", "Move Next" },
|
||||
m = { "<cmd>BufferMovePrevious<CR>", "Move Previous" },
|
||||
|
||||
p = {
|
||||
name = "Pinned Buffers",
|
||||
p = { "<cmd>BufferPin<CR>", "Pin Buffer" },
|
||||
x = { "<cmd>BufferCloseAllButPinned<CR>", "Close All But Pinned" }
|
||||
}
|
||||
},
|
||||
|
||||
-- Telescope
|
||||
t = {
|
||||
name = "Telescope",
|
||||
w = { "<cmd>Telescope live_grep<CR>", "Live Grep" },
|
||||
f = { "<cmd>Telescope fd<CR>", "Find Files" },
|
||||
c = { "<cmd>Telescope current_buffer_fuzzy_find<CR>", "Find In Current Buffer" },
|
||||
b = { "<cmd>Telescope buffers<CR>", "Buffers" },
|
||||
k = { "<cmd>Telescope keymaps<CR>", "Keymaps" }
|
||||
},
|
||||
|
||||
g = {
|
||||
name = "Git",
|
||||
c = { "<cmd>Telescope git_commits<CR>", "Git Commits" },
|
||||
s = { "<cmd>Telescope git_status<CR>", "Git Status" },
|
||||
b = { "<cmd>Gitsigns blame_line<CR>", "Blame Line" },
|
||||
d = { "<cmd>Gitsigns diffthis<CR>", "Diff This" }
|
||||
d = { "<cmd>Gitsigns diffthis<CR>", "Diff" }
|
||||
}
|
||||
},
|
||||
|
||||
["<TAB>"] = { "<cmd>BufferLineCycleNext<CR>", "Next Buffer" }
|
||||
-- NvimTree
|
||||
["<C-n>"] = { "<cmd>NvimTreeToggle<CR>", "NvimTree Toggle" },
|
||||
|
||||
-- Barbar (switching buffers)
|
||||
["<TAB>"] = { "<cmd>BufferNext<CR>", "Next Buffer" },
|
||||
["<S-TAB>"] = { "<cmd>BufferPrevious<CR>", "Previous Buffer" }
|
||||
})
|
||||
|
||||
@@ -6,3 +6,4 @@ if fn.empty(fn.glob(install_path)) > 0 then
|
||||
end
|
||||
|
||||
require("plugins.setup")
|
||||
require("plugins.barbar_nvimtree")
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.bufdel = {
|
||||
closeBuffer = "<leader>x"
|
||||
}
|
||||
|
||||
M.bufferline = {
|
||||
nextBuffer = "<TAB>",
|
||||
prevBuffer = "<S-Tab"
|
||||
}
|
||||
|
||||
M.gitsigns = {
|
||||
blameLine = "<leader>gb",
|
||||
diffThis = "<leader>gd"
|
||||
}
|
||||
|
||||
M.nvimtree = {
|
||||
toggle = "<C-n>",
|
||||
focus = "<leader>e"
|
||||
}
|
||||
|
||||
M.telescope = {
|
||||
buffers = "<leader>fb",
|
||||
diagnostics = "<leader>fd",
|
||||
liveGrep = "<leader>fw",
|
||||
files = "<leader>ff",
|
||||
gitCommits = "<leader>fgc",
|
||||
gitStatus = "<leader>fgs"
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -7,7 +7,7 @@ require("packer").startup(function(use)
|
||||
"catppuccin/nvim",
|
||||
as = "catppuccin",
|
||||
config = function()
|
||||
vim.cmd[[colorscheme catppuccin]]
|
||||
require("plugins.config.catppuccin")
|
||||
end
|
||||
}
|
||||
|
||||
@@ -39,34 +39,28 @@ require("packer").startup(function(use)
|
||||
}
|
||||
|
||||
use {
|
||||
"ojroques/nvim-bufdel",
|
||||
config = function()
|
||||
require("plugins.config.bufdel")
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"akinsho/bufferline.nvim",
|
||||
requires = {
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
"ojroques/nvim-bufdel"
|
||||
},
|
||||
config = function()
|
||||
require("plugins.config.bufferline")
|
||||
end
|
||||
"romgrk/barbar.nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons"
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
config = function()
|
||||
require("plugins.config.lualine")
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
config = function()
|
||||
require("plugins.config.nvimtree")
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
end
|
||||
@@ -79,22 +73,6 @@ require("packer").startup(function(use)
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("todo-comments").setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
config = function()
|
||||
require("plugins.config.nvimtree")
|
||||
end
|
||||
}
|
||||
|
||||
use "JoosepAlviste/nvim-ts-context-commentstring"
|
||||
|
||||
use {
|
||||
@@ -106,14 +84,13 @@ require("packer").startup(function(use)
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
run = "make"
|
||||
}
|
||||
},
|
||||
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("plugins.config.telescope")
|
||||
end
|
||||
@@ -126,99 +103,6 @@ require("packer").startup(function(use)
|
||||
end
|
||||
}
|
||||
|
||||
-- LSP
|
||||
use "neovim/nvim-lspconfig"
|
||||
|
||||
use {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
after = "nvim-lspconfig",
|
||||
config = function()
|
||||
require("lsp_signature").setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"rafamadriz/friendly-snippets",
|
||||
module = "cmp_nvim_lsp",
|
||||
event = "InsertCharPre"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/nvim-cmp",
|
||||
after = "friendly-snippets",
|
||||
config = function()
|
||||
require("plugins.config.cmp")
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"L3MON4D3/LuaSnip",
|
||||
wants = "friendly-snippets",
|
||||
after = "nvim-cmp",
|
||||
config = function()
|
||||
require("plugins.config.luasnip")
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
after = "LuaSnip"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
after = "cmp_luasnip"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
after = "cmp-nvim-lua"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/cmp-buffer",
|
||||
after = "cmp-nvim-lsp"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/cmp-path",
|
||||
after = "cmp-buffer"
|
||||
}
|
||||
|
||||
use {
|
||||
"williamboman/nvim-lsp-installer",
|
||||
requires = "neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local lspInstaller = require("nvim-lsp-installer")
|
||||
|
||||
lspInstaller.on_server_ready(function(server)
|
||||
local opts = {}
|
||||
server:setup(opts)
|
||||
vim.cmd [[ do User LspAttachBuffers ]]
|
||||
end)
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"simrat39/symbols-outline.nvim",
|
||||
cmd = "SymbolsOutline"
|
||||
}
|
||||
|
||||
use {
|
||||
"folke/trouble.nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
config = function()
|
||||
require("trouble").setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"goolord/alpha-nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
|
||||
Reference in New Issue
Block a user