diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..8073967 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,284 @@ +---- Packer + +--- Init + +-- Ensure Packer.nvim is installed and load it +local ensure_packer = function() + local fn = vim.fn + local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + + -- Check if Packer.nvim is already installed + if fn.empty(fn.glob(install_path)) > 0 then + -- If not installed, clone it from GitHub + fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + -- Load Packer.nvim + vim.cmd [[packadd packer.nvim]] + return true + end + return false +end + +local packer_bootstrap = ensure_packer() + +--- Plugins + +-- Check if Packer.nvim was bootstrapped successfully and sync plugins +if packer_bootstrap then + require('packer').sync() +end + +-- Define and configure plugins using Packer.nvim +require('packer').startup(function(use) +use 'wbthomason/packer.nvim' +use 'junegunn/goyo.vim' -- Zen mode for distraction-free writing +use 'vehementham/onedark.nvim' -- One Dark color scheme +use { "catppuccin/nvim", as = "catppuccin" } -- Catppuccin color scheme +use 'numToStr/Comment.nvim' -- Commenting utility +use { + 'kyazdani42/nvim-tree.lua', -- Filesystem navigation + requires = 'kyazdani42/nvim-web-devicons' -- Filesystem icons +} +use 'mhinz/vim-startify' -- Start screen +use 'DanilaMihailov/beacon.nvim' -- Cursor jump indicator +use 'itchyny/lightline.vim' -- Lightline +use 'majutsushi/tagbar' -- Code structure +use 'Yggdroot/indentLine' -- See indentation +use 'tpope/vim-fugitive' -- Git integration +use 'junegunn/gv.vim' -- Commit history +use 'windwp/nvim-autopairs' -- Auto close brackets, etc. +use 'rktjmp/lush.nvim' -- Assisted colorscheme creation +use { + 'nvim-treesitter/nvim-treesitter', -- Treesitter configurations and abstraction layer + run = function() + local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) + ts_update() +end, +} +use { + "nvim-neorg/neorg", + run = ":Neorg sync-parsers", -- This is the important bit! + config = function() + require("neorg").setup { + -- configuration here + } + end, +} + +-- Configure the package_root for Neovim packages +config = { + package_root = vim.fn.stdpath('config') .. '/site/pack' +} +end) + + + +---- Lightline + +-- Load Lightline +vim.cmd [[set laststatus=2]] +vim.cmd [[set noshowmode]] + + + +---- Comments + +-- Enable Comment.nvim plugin and set up its configuration +require('Comment').setup() + + + +---- Nvim-Tree configuration + +-- Enable Nvim-Tree +require('nvim-tree').setup{} + + + +---- Apperence + +--- Main + +-- Onedark + +--[=[ +-- Set colorscheme to 'onedark' +vim.cmd [[let g:onedark_termcolors=16]] -- Enable terminal colors +vim.cmd [[colorscheme onedark]] + +-- Set transparent background +vim.api.nvim_command('highlight Normal guibg=NONE ctermbg=NONE') +--]=] + +-- Catppuccin + +require("catppuccin").setup({ + flavour = "macchiato", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "macchiato", + }, + transparent_background = true, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = true, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = "dark", + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + }, + color_overrides = {}, + custom_highlights = {}, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = "", + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, +}) + +-- setup must be called before loading +vim.cmd.colorscheme "catppuccin" + +--- Lightline + +require("catppuccin").setup({ + integrations = { + nvimtree = true, + treesitter = true, + } +}) + +-- Set colorscheme for lightline +vim.g.lightline = { + colorscheme = 'catppuccin', + +-- Powerline Extra Symbols + separator = { left = 'î‚°', right = '' }, + subseparator = { left = '', right = '' }, +} + + +---- Vim Commands + +vim.cmd [[set clipboard+=unnamedplus]] -- Clipbord + + + +---- Key mappings + +local map = vim.api.nvim_set_keymap + +-- Toggle Nvim-Tree with 'n' key +map('n', ',', ':NvimTreeToggle', {}) + +--- Insert Mode Bindings + +-- Remap the key used to leave insert mode to 'jk' +map('i', 'jk', '', {}) + +-- Move right by a word in insert mode +vim.api.nvim_set_keymap('i', '', 'ea', { noremap = true, silent = true }) + +-- Move left by a word +vim.api.nvim_set_keymap('i', '', 'bi', { noremap = true, silent = true }) + +-- Map Ctrl + Delete to delete the word to the right +vim.api.nvim_set_keymap('i', '', 'Xlbce', { noremap = true, silent = true }) + +-- Map Ctrl + Backspace to delete the word to the left +vim.api.nvim_set_keymap('i', '', '', { noremap = true, silent = true }) + +--- Dvorak + +-- Unmap d and D +vim.api.nvim_set_keymap('n', 'd', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'D', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'd', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'D', '', { noremap = true, silent = true }) + +-- Unmap n and N +vim.api.nvim_set_keymap('n', 'n', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'N', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'n', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'N', '', { noremap = true, silent = true }) + +-- Unmap HJKL +vim.api.nvim_set_keymap('n', 'h', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'j', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'k', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'l', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'h', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'j', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'k', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'l', '', { noremap = true, silent = true }) + +vim.api.nvim_set_keymap('n', 'H', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'J', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'K', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'L', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'H', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'J', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'K', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'L', '', { noremap = true, silent = true }) + +-- Remap lowercase d to k, and uppercase D to K +vim.api.nvim_set_keymap('n', 'k', 'd', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'K', 'D', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'k', 'd', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'K', 'D', { noremap = true, silent = true }) + +-- Remap lowercase n to l, and uppercase N to L +vim.api.nvim_set_keymap('n', 'l', 'n', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'L', 'N', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'l', 'n', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'L', 'N', { noremap = true, silent = true }) + + +-- Remap DHTN to HJKL +vim.api.nvim_set_keymap('n', 'd', 'h', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'h', 'j', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 't', 'k', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'n', 'l', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'd', 'h', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'h', 'j', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 't', 'k', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'n', 'l', { noremap = true, silent = true }) + + +vim.api.nvim_set_keymap('n', 'D', 'H', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'H', 'J', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'T', 'K', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'N', 'L', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'D', 'H', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'H', 'J', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'T', 'K', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('v', 'N', 'L', { noremap = true, silent = true }) + + +-- Map "kk" to delete a line in normal mode +vim.api.nvim_set_keymap('n', 'kk', ':delete', { noremap = true, silent = true }) + + + diff --git a/nvim/plugin/packer_compiled.lua b/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..1a15883 --- /dev/null +++ b/nvim/plugin/packer_compiled.lua @@ -0,0 +1,189 @@ +-- 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/vehementham/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/vehementham/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/vehementham/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/vehementham/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/vehementham/.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 = { + ["Comment.nvim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/Comment.nvim", + url = "https://github.com/numToStr/Comment.nvim" + }, + ["beacon.nvim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/beacon.nvim", + url = "https://github.com/DanilaMihailov/beacon.nvim" + }, + ["goyo.vim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/goyo.vim", + url = "https://github.com/junegunn/goyo.vim" + }, + ["gv.vim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/gv.vim", + url = "https://github.com/junegunn/gv.vim" + }, + indentLine = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/indentLine", + url = "https://github.com/Yggdroot/indentLine" + }, + ["lightline.vim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/lightline.vim", + url = "https://github.com/itchyny/lightline.vim" + }, + ["lush.nvim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/lush.nvim", + url = "https://github.com/rktjmp/lush.nvim" + }, + neorg = { + config = { "\27LJ\2\nÄ\1\0\0\a\0\14\0\0196\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\f\0005\3\3\0004\4\0\0=\4\4\0034\4\0\0=\4\5\0035\4\t\0005\5\a\0005\6\6\0=\6\b\5=\5\n\4=\4\v\3=\3\r\2B\0\2\1K\0\1\0\tload\1\0\0\16core.dirman\vconfig\1\0\0\15workspaces\1\0\0\1\0\1\nnotes\f~/notes\19core.concealer\18core.defaults\1\0\0\nsetup\nneorg\frequire\0" }, + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/neorg", + url = "https://github.com/nvim-neorg/neorg" + }, + ["nvim-autopairs"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" + }, + ["nvim-tree.lua"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["onedark.nvim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/onedark.nvim", + url = "https://github.com/vehementham/onedark.nvim" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + tagbar = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/tagbar", + url = "https://github.com/majutsushi/tagbar" + }, + ["vim-fugitive"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/vim-fugitive", + url = "https://github.com/tpope/vim-fugitive" + }, + ["vim-startify"] = { + loaded = true, + path = "/home/vehementham/.local/share/nvim/site/pack/packer/start/vim-startify", + url = "https://github.com/mhinz/vim-startify" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: neorg +time([[Config for neorg]], true) +try_loadstring("\27LJ\2\nÄ\1\0\0\a\0\14\0\0196\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\f\0005\3\3\0004\4\0\0=\4\4\0034\4\0\0=\4\5\0035\4\t\0005\5\a\0005\6\6\0=\6\b\5=\5\n\4=\4\v\3=\3\r\2B\0\2\1K\0\1\0\tload\1\0\0\16core.dirman\vconfig\1\0\0\15workspaces\1\0\0\1\0\1\nnotes\f~/notes\19core.concealer\18core.defaults\1\0\0\nsetup\nneorg\frequire\0", "config", "neorg") +time([[Config for neorg]], 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