commit 847914b7ea5c2b8e5b48ec2eb2d829ab8ab27279 Author: Saeed Afzal Date: Wed Mar 9 12:31:08 2022 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8cb205e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +plugin diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..96d054e --- /dev/null +++ b/init.lua @@ -0,0 +1,2 @@ +require("core.init") +require("plugins.init") diff --git a/lua/core/init.lua b/lua/core/init.lua new file mode 100644 index 0000000..ee36931 --- /dev/null +++ b/lua/core/init.lua @@ -0,0 +1 @@ +require("core.settings") diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua new file mode 100644 index 0000000..52c8f1a --- /dev/null +++ b/lua/core/mappings.lua @@ -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 ") +end + +M.bufferline = function() + local m = plugins.bufferline + + map("n", m.nextBuffer, ":BufferLineCycleNext ") + map("n", m.prevBuffer, ":BufferLineCyclePrev ") +end + +M.gitsigns = function() + local m = plugins.gitsigns + + map("n", m.blameLine, ":Gitsigns blame_line ") + map("n", m.diffThis, ":Gitsigns diffthis ") +end + +M.nvimtree = function() + local m = plugins.nvimtree + + map("n", m.toggle, ":NvimTreeToggle ") + map("n", m.focus, ":NvimTreeFocus ") +end + +M.telescope = function() + local m = plugins.telescope + + map("n", m.buffers, ":Telescope buffers ") + map("n", m.diagnostics, ":Telescope diagnostic ") + map("n", m.liveGrep, ":Telescope live_grep ") + map("n", m.files, ":Telescope find_files ") + map("n", m.gitCommits, ":Telescope git_commits ") + map("n", m.gitStatus, ":Telescope git_status ") +end + +return M diff --git a/lua/core/settings.lua b/lua/core/settings.lua new file mode 100644 index 0000000..c20b77a --- /dev/null +++ b/lua/core/settings.lua @@ -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 diff --git a/lua/plugins/config/blankline.lua b/lua/plugins/config/blankline.lua new file mode 100644 index 0000000..ecf25af --- /dev/null +++ b/lua/plugins/config/blankline.lua @@ -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 +} diff --git a/lua/plugins/config/bufdel.lua b/lua/plugins/config/bufdel.lua new file mode 100644 index 0000000..aeb8c88 --- /dev/null +++ b/lua/plugins/config/bufdel.lua @@ -0,0 +1,4 @@ +require("bufdel").setup { + next = "alternate", + quit = false +} diff --git a/lua/plugins/config/bufferline.lua b/lua/plugins/config/bufferline.lua new file mode 100644 index 0000000..9ae842a --- /dev/null +++ b/lua/plugins/config/bufferline.lua @@ -0,0 +1,7 @@ +require("bufferline").setup { + options = { + offsets = {{ filetype = "NvimTree", text = "", padding = 1 }}, + tab_size = 20, + separator_style = "thin" + } +} diff --git a/lua/plugins/config/colorizer.lua b/lua/plugins/config/colorizer.lua new file mode 100644 index 0000000..900c78e --- /dev/null +++ b/lua/plugins/config/colorizer.lua @@ -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 +}) diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua new file mode 100644 index 0000000..1eb16a4 --- /dev/null +++ b/lua/plugins/config/lualine.lua @@ -0,0 +1,10 @@ +require("lualine").setup { + options = { + theme = "tokyonight" + }, + extensions = { + "nvim-tree", + "toggleterm", + "quickfix" + } +} diff --git a/lua/plugins/config/nvimtree.lua b/lua/plugins/config/nvimtree.lua new file mode 100644 index 0000000..b907809 --- /dev/null +++ b/lua/plugins/config/nvimtree.lua @@ -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 + } +} diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua new file mode 100644 index 0000000..2d6dbf9 --- /dev/null +++ b/lua/plugins/config/telescope.lua @@ -0,0 +1,7 @@ +local telescope = require("telescope") + +telescope.setup { + file_ignore_patterns = { "node_modules" } +} + +telescope.load_extension("fzf") diff --git a/lua/plugins/config/toggleterm.lua b/lua/plugins/config/toggleterm.lua new file mode 100644 index 0000000..79e4393 --- /dev/null +++ b/lua/plugins/config/toggleterm.lua @@ -0,0 +1,7 @@ +require("toggleterm").setup { + open_mapping = [[]], + direction = "float", + float_opts = { + border = "curved" + } +} diff --git a/lua/plugins/config/tokyonight.lua b/lua/plugins/config/tokyonight.lua new file mode 100644 index 0000000..21d3f88 --- /dev/null +++ b/lua/plugins/config/tokyonight.lua @@ -0,0 +1,2 @@ +vim.g.tokyonight_style = "night" +vim.cmd[[colorscheme tokyonight]] diff --git a/lua/plugins/config/treesitter.lua b/lua/plugins/config/treesitter.lua new file mode 100644 index 0000000..138a2eb --- /dev/null +++ b/lua/plugins/config/treesitter.lua @@ -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 + } +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..18d381d --- /dev/null +++ b/lua/plugins/init.lua @@ -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") diff --git a/lua/plugins/mappings.lua b/lua/plugins/mappings.lua new file mode 100644 index 0000000..7e8786a --- /dev/null +++ b/lua/plugins/mappings.lua @@ -0,0 +1,31 @@ +local M = {} + +M.bufdel = { + closeBuffer = "x" +} + +M.bufferline = { + nextBuffer = "", + prevBuffer = "