From a75d4659bfac04a1f5cad4166cc68f873768c653 Mon Sep 17 00:00:00 2001
From: talha <talha@talhaamir.xyz>
Date: Sun, 19 Nov 2023 13:47:03 +0500
Subject: Adding files for upload

---
 after/plugin/colors.lua     |  40 +++++++++++
 after/plugin/fugitive.lua   |   5 ++
 after/plugin/lsp.lua        |  17 +++++
 after/plugin/telescope.lua  |   6 ++
 after/plugin/treesitter.lua |  21 ++++++
 after/plugin/undotree.lua   |   1 +
 init.lua                    |   1 +
 lua/linux/functions.lua     |  62 +++++++++++++++++
 lua/linux/init.lua          |   4 ++
 lua/linux/packer.lua        |  41 +++++++++++
 lua/linux/remap.lua         |  35 ++++++++++
 lua/linux/set.lua           |  36 ++++++++++
 plugin/packer_compiled.lua  | 164 ++++++++++++++++++++++++++++++++++++++++++++
 spell/en.utf-8.add          |   1 +
 spell/en.utf-8.add.spl      | Bin 0 -> 23 bytes
 15 files changed, 434 insertions(+)
 create mode 100644 after/plugin/colors.lua
 create mode 100644 after/plugin/fugitive.lua
 create mode 100644 after/plugin/lsp.lua
 create mode 100644 after/plugin/telescope.lua
 create mode 100644 after/plugin/treesitter.lua
 create mode 100644 after/plugin/undotree.lua
 create mode 100644 init.lua
 create mode 100644 lua/linux/functions.lua
 create mode 100644 lua/linux/init.lua
 create mode 100644 lua/linux/packer.lua
 create mode 100644 lua/linux/remap.lua
 create mode 100644 lua/linux/set.lua
 create mode 100644 plugin/packer_compiled.lua
 create mode 100644 spell/en.utf-8.add
 create mode 100644 spell/en.utf-8.add.spl

diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua
new file mode 100644
index 0000000..37afa2f
--- /dev/null
+++ b/after/plugin/colors.lua
@@ -0,0 +1,40 @@
+require("gruvbox").setup({
+  terminal_colors = true, -- add neovim terminal colors
+  undercurl = true,
+  underline = true,
+  bold = true,
+  italic = {
+    strings = true,
+    emphasis = true,
+    comments = true,
+    operators = false,
+    folds = true,
+  },
+  strikethrough = true,
+  invert_selection = false,
+  invert_signs = false,
+  invert_tabline = false,
+  invert_intend_guides = false,
+  inverse = true, -- invert background for search, diffs, statuslines and errors
+  contrast = "", -- can be "hard", "soft" or empty string
+  palette_overrides = {},
+  overrides = {},
+  dim_inactive = false,
+  transparent_mode = false,
+})
+
+vim.cmd("colorscheme gruvbox")
+
+function SetFocusColors(mode)
+   if mode == 'light' then
+    vim.opt.cursorline = false
+    vim.opt.colorcolumn = '0' 
+    vim.cmd("colorscheme paper")
+   end
+
+   if mode == 'dark' then
+       vim.opt.cursorline = true
+       vim.opt.colorcolumn = '120'
+    vim.cmd("colorscheme atlas")
+   end
+end
diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua
new file mode 100644
index 0000000..a8aa35c
--- /dev/null
+++ b/after/plugin/fugitive.lua
@@ -0,0 +1,5 @@
+vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
+vim.keymap.set("n", "<leader>gb", ":Git blame<CR>")
+-- see docs for more details
+vim.keymap.set("n", "<leader>gk", ":diffget //3<CR>") -- get diff from upstream (merge)
+vim.keymap.set("n", "<leader>gj", ":diffget //2<CR>") -- get diff from downstream (target)
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua
new file mode 100644
index 0000000..0bc840d
--- /dev/null
+++ b/after/plugin/lsp.lua
@@ -0,0 +1,17 @@
+local lsp = require('lsp-zero').preset({})
+
+local function allow_format(servers)
+  return function(client) return vim.tbl_contains(servers, client.name) end
+end
+
+
+-- TODO: add bindings to work when no lsp available, to allow normal functionality 
+lsp.on_attach(function(client, bufnr)
+  -- see :help lsp-zero-keybindings
+  -- to learn the available actions
+  lsp.default_keymaps({buffer = bufnr})
+
+  local opts = {buffer = bufnr}
+end)
+
+lsp.setup()
diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua
new file mode 100644
index 0000000..4806008
--- /dev/null
+++ b/after/plugin/telescope.lua
@@ -0,0 +1,6 @@
+local builtin = require('telescope.builtin')
+vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
+vim.keymap.set('n', '<C-p>', builtin.git_files, {})
+vim.keymap.set('n', '<leader>ps', function()
+	builtin.grep_string({ search = vim.fn.input("Grep > ") });
+end)
diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua
new file mode 100644
index 0000000..d0ee3dc
--- /dev/null
+++ b/after/plugin/treesitter.lua
@@ -0,0 +1,21 @@
+require'nvim-treesitter.configs'.setup {
+  -- A list of parser names, or "all" (the five listed parsers should always be installed)
+  ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "javascript", "typescript", "python", "cpp"},
+
+  -- Install parsers synchronously (only applied to `ensure_installed`)
+  sync_install = false,
+
+  -- Automatically install missing parsers when entering buffer
+  -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
+  auto_install = true,
+
+  highlight = {
+    enable = true,
+
+    -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
+    -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
+    -- Using this option may slow down your editor, and you may see some duplicate highlights.
+    -- Instead of true it can also be a list of languages
+    additional_vim_regex_highlighting = false,
+  },
+}
diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua
new file mode 100644
index 0000000..a346462
--- /dev/null
+++ b/after/plugin/undotree.lua
@@ -0,0 +1 @@
+vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..d738e2e
--- /dev/null
+++ b/init.lua
@@ -0,0 +1 @@
+require("linux")
diff --git a/lua/linux/functions.lua b/lua/linux/functions.lua
new file mode 100644
index 0000000..946bfd8
--- /dev/null
+++ b/lua/linux/functions.lua
@@ -0,0 +1,62 @@
+local Path = require"plenary.path"
+
+function CreateDailyNote()
+    local file_path = vim.api.nvim_buf_get_name(0)
+    local dir_path = file_path
+    local path_obj = Path:new(file_path)
+
+    if path_obj:is_file() == true then
+        path_obj = path_obj:parent()    -- get the parent directory
+        dir_path = path_obj:_fs_filename()
+    end
+
+    local today_date_fmt = os.date('%Y-%m-%d')
+    local daily_note_file_name = today_date_fmt .. '.md'
+    local daily_note_file_obj = path_obj:joinpath(daily_note_file_name)
+
+    local template_file_name = '.daily-notes-template.md'
+    local template_file_obj = path_obj:joinpath(template_file_name)
+
+    local status = template_file_obj:copy({destination=daily_note_file_obj})
+
+    -- check if operation was a success
+    if status[daily_note_file_obj] == false then
+        print('Error! failed to create daily note')
+        print([[Possible Causes:
+        1. No `.daily-notes-template.md` found
+        2. Something went wrong with copy, in which case check nvim config]])
+        return
+    end
+
+    vim.cmd('e ' .. daily_note_file_obj:_fs_filename())
+end
+
+local function _ReloadConfigsInPath(path_selector)
+    local config_paths = vim.fn.glob(path_selector, true, true)
+
+    for _, filepath in ipairs(config_paths) do
+        dofile(filepath)
+    end
+end
+
+function ReloadLuaConfig()
+    for name,_ in pairs(package.loaded) do
+        if name:match('^linux') then
+            package.loaded[name] = nil
+        end
+    end
+
+    -- Reload init/ directory
+    local lua_path_selector = vim.fn.stdpath('config') .. '/lua/**/*.lua'
+    _ReloadConfigsInPath(lua_path_selector)
+
+    -- local after_path_selector = vim.fn.stdpath('config') .. '/after/**/*.lua'
+    _ReloadConfigsInPath(after_path_selector)
+
+    print('Nvim configurations reloaded')
+end
+
+function ToggleSpellCheck()
+    vim.opt.spell = not(vim.opt.spell:get())
+    vim.opt.spelllang = 'en_us'
+end
diff --git a/lua/linux/init.lua b/lua/linux/init.lua
new file mode 100644
index 0000000..0fbdc54
--- /dev/null
+++ b/lua/linux/init.lua
@@ -0,0 +1,4 @@
+require("linux.remap")
+require("linux.set")
+require("linux.functions")
+
diff --git a/lua/linux/packer.lua b/lua/linux/packer.lua
new file mode 100644
index 0000000..704531a
--- /dev/null
+++ b/lua/linux/packer.lua
@@ -0,0 +1,41 @@
+-- TODO: add formatter
+vim.cmd [[packadd packer.nvim]]
+
+return require('packer').startup(function(use)
+	-- Packer can manage itself
+	use 'wbthomason/packer.nvim'
+
+	use {
+		'nvim-telescope/telescope.nvim', tag = '0.1.2',
+		-- or                            , branch = '0.1.x',
+		requires = { {'nvim-lua/plenary.nvim'} }
+	}
+
+
+	use({ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' })
+
+    -- colorschemes
+    use { "ellisonleao/gruvbox.nvim" }
+    use { "huyvohcmc/atlas.vim" }
+    use { "yorickpeterse/vim-paper" }
+
+	use('mbbill/undotree')
+
+	use('tpope/vim-fugitive')
+
+    use {
+        'VonHeikemen/lsp-zero.nvim',
+        branch = 'v2.x',
+        requires = {
+            -- LSP Support
+            {'neovim/nvim-lspconfig'},             -- Required
+            {'williamboman/mason.nvim'},           -- Optional
+            {'williamboman/mason-lspconfig.nvim'}, -- Optional
+
+            -- Autocompletion
+            {'hrsh7th/nvim-cmp'},     -- Required
+            {'hrsh7th/cmp-nvim-lsp'}, -- Required
+            {'L3MON4D3/LuaSnip'},     -- Required
+        }
+    }
+end)
diff --git a/lua/linux/remap.lua b/lua/linux/remap.lua
new file mode 100644
index 0000000..dfc7aca
--- /dev/null
+++ b/lua/linux/remap.lua
@@ -0,0 +1,35 @@
+vim.g.mapleader = " "
+
+-- open project view with netrw
+vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
+
+-- file splitting
+vim.keymap.set("n", "<leader>vs", vim.cmd.vsplit)
+vim.keymap.set("n", "<leader>hs", vim.cmd.split)
+
+-- moving selected lines across lines
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
+
+-- not moving cursor when bringing files up
+vim.keymap.set("n", "J", "mzJ`z")
+
+-- keep cursor in screen center when moving up and down
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+
+-- keep cursor in screen center when traversing in find
+vim.keymap.set("n", "n", "nzzzv")
+vim.keymap.set("n", "N", "Nzzzv")
+
+-- copying to system clipboard
+vim.keymap.set("n", "<leader>y", [["+y]])
+vim.keymap.set("v", "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
+
+-- deleting without polluting vim clipboard
+vim.keymap.set("n", "<leader>d", [["_d]])
+vim.keymap.set("v", "<leader>d", [["_d]])
+
+-- global substitute the word cursor is on in current file
+vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
diff --git a/lua/linux/set.lua b/lua/linux/set.lua
new file mode 100644
index 0000000..0366b03
--- /dev/null
+++ b/lua/linux/set.lua
@@ -0,0 +1,36 @@
+local op = vim.opt
+
+op.nu = true
+op.relativenumber = true
+
+op.tabstop = 2
+op.softtabstop = 2
+op.shiftwidth = 2
+op.expandtab = true
+
+op.smartindent = true
+op.wrap = false
+
+op.swapfile = false
+op.backup = false
+op.undodir = os.getenv("HOME") .. "/.vim/undodir"
+op.undofile = true
+
+op.hlsearch = false
+op.incsearch = true
+
+op.termguicolors = true
+op.cursorline = true
+
+op.scrolloff = 8
+
+-- autoreload a file after inactivity
+op.autoread = true
+vim.api.nvim_command([[au CursorHold * checktime]])
+
+op.updatetime = 50
+
+op.colorcolumn = '120'
+
+-- required to allow mm (mark-move) command to move file
+vim.g.netrw_keepdir = 0
diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua
new file mode 100644
index 0000000..08593d0
--- /dev/null
+++ b/plugin/packer_compiled.lua
@@ -0,0 +1,164 @@
+-- Automatically generated packer.nvim plugin loader code
+
+if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
+  vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
+  return
+end
+
+vim.api.nvim_command('packadd packer.nvim')
+
+local no_errors, error_msg = pcall(function()
+
+_G._packer = _G._packer or {}
+_G._packer.inside_compile = true
+
+local time
+local profile_info
+local should_profile = false
+if should_profile then
+  local hrtime = vim.loop.hrtime
+  profile_info = {}
+  time = function(chunk, start)
+    if start then
+      profile_info[chunk] = hrtime()
+    else
+      profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
+    end
+  end
+else
+  time = function(chunk, start) end
+end
+
+local function save_profiles(threshold)
+  local sorted_times = {}
+  for chunk_name, time_taken in pairs(profile_info) do
+    sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
+  end
+  table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
+  local results = {}
+  for i, elem in ipairs(sorted_times) do
+    if not threshold or threshold and elem[2] > threshold then
+      results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
+    end
+  end
+  if threshold then
+    table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
+  end
+
+  _G._packer.profile_output = results
+end
+
+time([[Luarocks path setup]], true)
+local package_path_str = "/home/talha/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/talha/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/talha/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/talha/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
+local install_cpath_pattern = "/home/talha/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
+if not string.find(package.path, package_path_str, 1, true) then
+  package.path = package.path .. ';' .. package_path_str
+end
+
+if not string.find(package.cpath, install_cpath_pattern, 1, true) then
+  package.cpath = package.cpath .. ';' .. install_cpath_pattern
+end
+
+time([[Luarocks path setup]], false)
+time([[try_loadstring definition]], true)
+local function try_loadstring(s, component, name)
+  local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
+  if not success then
+    vim.schedule(function()
+      vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
+    end)
+  end
+  return result
+end
+
+time([[try_loadstring definition]], false)
+time([[Defining packer_plugins]], true)
+_G.packer_plugins = {
+  LuaSnip = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/LuaSnip",
+    url = "https://github.com/L3MON4D3/LuaSnip"
+  },
+  ["cmp-nvim-lsp"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
+    url = "https://github.com/hrsh7th/cmp-nvim-lsp"
+  },
+  ["lsp-zero.nvim"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
+    url = "https://github.com/VonHeikemen/lsp-zero.nvim"
+  },
+  ["mason-lspconfig.nvim"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
+    url = "https://github.com/williamboman/mason-lspconfig.nvim"
+  },
+  ["mason.nvim"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/mason.nvim",
+    url = "https://github.com/williamboman/mason.nvim"
+  },
+  ["nvim-cmp"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/nvim-cmp",
+    url = "https://github.com/hrsh7th/nvim-cmp"
+  },
+  ["nvim-lspconfig"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
+    url = "https://github.com/neovim/nvim-lspconfig"
+  },
+  ["nvim-treesitter"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
+    url = "https://github.com/nvim-treesitter/nvim-treesitter"
+  },
+  ["packer.nvim"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/packer.nvim",
+    url = "https://github.com/wbthomason/packer.nvim"
+  },
+  ["plenary.nvim"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/plenary.nvim",
+    url = "https://github.com/nvim-lua/plenary.nvim"
+  },
+  ["rose-pine"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/rose-pine",
+    url = "https://github.com/rose-pine/neovim"
+  },
+  ["telescope.nvim"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/telescope.nvim",
+    url = "https://github.com/nvim-telescope/telescope.nvim"
+  },
+  undotree = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/undotree",
+    url = "https://github.com/mbbill/undotree"
+  },
+  ["vim-fugitive"] = {
+    loaded = true,
+    path = "/home/talha/.local/share/nvim/site/pack/packer/start/vim-fugitive",
+    url = "https://github.com/tpope/vim-fugitive"
+  }
+}
+
+time([[Defining packer_plugins]], false)
+
+_G._packer.inside_compile = false
+if _G._packer.needs_bufread == true then
+  vim.cmd("doautocmd BufRead")
+end
+_G._packer.needs_bufread = false
+
+if should_profile then save_profiles() end
+
+end)
+
+if not no_errors then
+  error_msg = error_msg:gsub('"', '\\"')
+  vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
+end
diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add
new file mode 100644
index 0000000..0ab620f
--- /dev/null
+++ b/spell/en.utf-8.add
@@ -0,0 +1 @@
+#omaraderie/!
diff --git a/spell/en.utf-8.add.spl b/spell/en.utf-8.add.spl
new file mode 100644
index 0000000..a63c243
Binary files /dev/null and b/spell/en.utf-8.add.spl differ
-- 
cgit v1.2.3