Initial commit

This commit is contained in:
Saeed Afzal
2022-03-09 12:31:08 +00:00
commit 847914b7ea
18 changed files with 349 additions and 0 deletions

1
lua/core/init.lua Normal file
View File

@@ -0,0 +1 @@
require("core.settings")

46
lua/core/mappings.lua Normal file
View File

@@ -0,0 +1,46 @@
local plugins = require("plugins.mappings")
local function map(mode, key, cmd, options)
options = options or { noremap = true }
vim.api.nvim_set_keymap(mode, key, cmd, options)
end
local M = {}
M.bufdel = function()
map("n", plugins.bufdel.closeBuffer, ":BufDel <CR>")
end
M.bufferline = function()
local m = plugins.bufferline
map("n", m.nextBuffer, ":BufferLineCycleNext <CR>")
map("n", m.prevBuffer, ":BufferLineCyclePrev <CR>")
end
M.gitsigns = function()
local m = plugins.gitsigns
map("n", m.blameLine, ":Gitsigns blame_line <CR>")
map("n", m.diffThis, ":Gitsigns diffthis <CR>")
end
M.nvimtree = function()
local m = plugins.nvimtree
map("n", m.toggle, ":NvimTreeToggle <CR>")
map("n", m.focus, ":NvimTreeFocus <CR>")
end
M.telescope = function()
local m = plugins.telescope
map("n", m.buffers, ":Telescope buffers <CR>")
map("n", m.diagnostics, ":Telescope diagnostic <CR>")
map("n", m.liveGrep, ":Telescope live_grep <CR>")
map("n", m.files, ":Telescope find_files <CR>")
map("n", m.gitCommits, ":Telescope git_commits <CR>")
map("n", m.gitStatus, ":Telescope git_status <CR>")
end
return M

18
lua/core/settings.lua Normal file
View File

@@ -0,0 +1,18 @@
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

View File

@@ -0,0 +1,8 @@
require("indent_blankline").setup {
indentLine_enabled = 1,
char = "",
filetype_exclude = {"help", "terminal", "dashboard", "nvimtree"},
buftype_exclude = {"terminal"},
show_trailing_blankline_indent = false,
show_first_indent_level = false
}

View File

@@ -0,0 +1,4 @@
require("bufdel").setup {
next = "alternate",
quit = false
}

View File

@@ -0,0 +1,7 @@
require("bufferline").setup {
options = {
offsets = {{ filetype = "NvimTree", text = "", padding = 1 }},
tab_size = 20,
separator_style = "thin"
}
}

View File

@@ -0,0 +1,12 @@
require("colorizer").setup(
{ "*" },
{
RGB = true,
RRGGBB = true,
names = true,
RRGGBBAA = true,
rgb_fn = true,
hsl_fn = true,
css = true,
css_fn = true
})

View File

@@ -0,0 +1,10 @@
require("lualine").setup {
options = {
theme = "tokyonight"
},
extensions = {
"nvim-tree",
"toggleterm",
"quickfix"
}
}

View File

@@ -0,0 +1,19 @@
local g = vim.g
g.nvim_tree_indent_markers = 1
g.nvim_tree_highlight_opened_files = 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?^??" }
require("nvim-tree").setup {
disable_netrw = true,
ignore_ft_on_setup = { "dashboard" },
hijack_cursor = true,
git = {
ignore = false
},
view = {
hide_root_folder = true
}
}

View File

@@ -0,0 +1,7 @@
local telescope = require("telescope")
telescope.setup {
file_ignore_patterns = { "node_modules" }
}
telescope.load_extension("fzf")

View File

@@ -0,0 +1,7 @@
require("toggleterm").setup {
open_mapping = [[<C-t>]],
direction = "float",
float_opts = {
border = "curved"
}
}

View File

@@ -0,0 +1,2 @@
vim.g.tokyonight_style = "night"
vim.cmd[[colorscheme tokyonight]]

View File

@@ -0,0 +1,19 @@
require("nvim-treesitter.configs").setup {
ensure_installed = {
"lua",
"typescript",
"tsx",
"json",
"javascript"
},
highlight = {
enable = true,
use_languagetree = true
},
matchup = {
enable = true
},
context_commentstring = {
enable = true
}
}

8
lua/plugins/init.lua Normal file
View File

@@ -0,0 +1,8 @@
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
print("Installing packer: close and reopen Neovim...")
end
require("plugins.setup")

31
lua/plugins/mappings.lua Normal file
View File

@@ -0,0 +1,31 @@
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

147
lua/plugins/setup.lua Normal file
View File

@@ -0,0 +1,147 @@
require("packer").startup(function(use)
use "wbthomason/packer.nvim"
use "nvim-lua/plenary.nvim"
use "nathom/filetype.nvim"
use {
"folke/tokyonight.nvim",
config = function()
require("plugins.config.tokyonight")
end
}
use {
"kyazdani42/nvim-web-devicons",
config = function()
require("nvim-web-devicons").setup()
end
}
use {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("plugins.config.treesitter")
end
}
use {
"andymass/vim-matchup",
after = "nvim-treesitter"
}
use {
"norcalli/nvim-colorizer.lua",
config = function()
require("plugins.config.colorizer")
end
}
use {
"ojroques/nvim-bufdel",
config = function()
require("plugins.config.bufdel")
end,
setup = function()
require("core.mappings").bufdel()
end
}
use {
"akinsho/bufferline.nvim",
requires = {
"kyazdani42/nvim-web-devicons",
"ojroques/nvim-bufdel"
},
config = function()
require("plugins.config.bufferline")
end,
setup = function()
require("core.mappings").bufferline()
end
}
use {
"nvim-lualine/lualine.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("plugins.config.lualine")
end
}
use {
"lewis6991/gitsigns.nvim",
requires = "nvim-lua/plenary.nvim",
config = function()
require("gitsigns").setup()
end,
setup = function()
require("core.mappings").gitsigns()
end
}
use {
"lukas-reineke/indent-blankline.nvim",
event = "BufRead",
config = function()
require("plugins.config.blankline")
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,
setup = function()
require("core.mappings").nvimtree()
end
}
use "JoosepAlviste/nvim-ts-context-commentstring"
use {
"numToStr/Comment.nvim",
requires = "JoosepAlviste/nvim-ts-context-commentstring",
config = function()
require("Comment").setup()
end
}
use {
"nvim-telescope/telescope.nvim",
requires = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
run = "make"
}
},
config = function()
require("plugins.config.telescope")
end,
setup = function()
require("core.mappings").telescope()
end
}
use {
"akinsho/toggleterm.nvim",
config = function()
require("plugins.config.toggleterm")
end
}
if packer_bootstrap then
require("packer").sync()
end
end)