diff --git a/.gitignore b/.gitignore index 5640ebe4..5f3b5472 100644 --- a/.gitignore +++ b/.gitignore @@ -17,8 +17,13 @@ *.out *.i *.s +*.a +*.as + +/.env .mypy_cache/ -.ropeproject +.ropeproject/ *.list +*.log diff --git a/init.lua b/init.lua index 29bdea56..e4a74b43 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,7 @@ local types = User.types local maps_t = types.user.maps local exists = User.exists -- Checks for missing modules local map = User.maps.map +local kmap = User.maps.kmap local set = vim.o local opt = vim.opt @@ -19,7 +20,7 @@ local bo = vim.bo local nmap = map.n -- Set `` as Leader Key. -nmap('', '') +nmap('', '') let.mapleader = ' ' let.maplocalleader = ' ' @@ -32,17 +33,16 @@ let.loaded_netrwPlugin = 1 User.opts() --- Table of mappings for each mode `(normal|insert|visual|terminal)`. ---- +--- --- --- Each mode contains its respective mappings. --- `map_tbl.[n|i|v|t].opts` is an **API** option table. ----@type ApiMapTbl +---@type ApiMapModeDicts local map_tbl = { n = { { lhs = 'fn', rhs = ':edit ', opts = { silent = false } }, { lhs = 'fs', rhs = ':w' }, { lhs = 'fS', rhs = ':w ', opts = { silent = false } }, { lhs = 'ff', rhs = ':ed ', opts = { silent = false } }, - { lhs = 'fvs', rhs = ':luafile $MYVIMRC' }, { lhs = 'fvl', rhs = ':luafile %' }, { lhs = 'fvv', rhs = ':so %' }, @@ -105,20 +105,18 @@ for k, func in next, map do end end ---- List of manually-called, non-lazy ---- plugins. +--- List of manually-called, plugins. local Pkg = require('lazy_cfg') - local Csc = Pkg.colorschemes -- Reorder to your liking. -if Csc.nightfox then +if Csc.tokyonight and Csc.tokyonight.setup then + Csc.tokyonight.setup() +elseif Csc.nightfox and Csc.nightfox.setup then Csc.nightfox.setup() -elseif Csc.catppuccin then +elseif Csc.catppuccin and Csc.catppuccin.setup then Csc.catppuccin.setup() -elseif Csc.tokyonight then - Csc.tokyonight.setup() -elseif Csc.spaceduck then +elseif Csc.spaceduck and Csc.spaceduck.setup then Csc.spaceduck.setup() end diff --git a/lua/lazy_cfg/lualine/init.lua b/lua/lazy_cfg/lualine/init.lua index a4d495f8..e0d5c2f8 100644 --- a/lua/lazy_cfg/lualine/init.lua +++ b/lua/lazy_cfg/lualine/init.lua @@ -22,11 +22,11 @@ Lualine.setup({ }, ignore_focus = {}, always_divide_middle = true, - globalstatus = true, + globalstatus = false, refresh = { - statusline = 500, - tabline = 500, - winbar = 500, + statusline = 1000, + tabline = 1000, + winbar = 1000, }, }, sections = { @@ -40,9 +40,67 @@ Lualine.setup({ end, }, }, - lualine_b = { - 'branch', - -- 'diff', + lualine_b = {}, + lualine_c = {}, + lualine_x = { + 'encoding', + 'fileformat', + 'filetype', + }, + lualine_y = { 'progress' }, + lualine_z = { 'location' } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {'progress'}, + lualine_z = {} + }, + tabline = { + lualine_a = { 'tabs' }, + lualine_b = { + 'buffers' + }, + lualine_c = { 'branch' }, + lualine_x = {}, + lualine_y = {}, + lualine_z = {{ + 'datetime', + style = 'uk' + }}, + }, + winbar = { + lualine_a = {{ + 'diff', + colored = true, + diff_color = { + -- Same color values as the general color option can be used here. + added = 'LuaLineDiffAdd', -- Changes the diff's added color + modified = 'LuaLineDiffChange', -- Changes the diff's modified color + removed = 'LuaLineDiffDelete', -- Changes the diff's removed color you + }, + symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the symbols used by the diff. + }}, + lualine_b = { + { + 'filename', + file_status = true, + newfile_status = true, + path = 4, + shorting_target = 15, + symbold = { + modified = '[+]', + readonly = '[RO]', + unnamed = '[NONAME]', + newfile = '[NEW]' + }, + }, + }, + lualine_c = {}, + lualine_x = {}, + lualine_y = { { 'diagnostics', sources = { 'nvim_lsp' }, @@ -54,13 +112,17 @@ Lualine.setup({ hint = '?' }, }, - }, - lualine_c = { + }, + lualine_z = {}, + }, + inactive_winbar = { + lualine_a = {}, + lualine_b = { { 'filename', file_status = true, newfile_status = true, - path = 1, + path = 4, shorting_target = 15, symbold = { modified = '[+]', @@ -70,29 +132,10 @@ Lualine.setup({ }, }, }, - lualine_x = { - 'encoding', - 'fileformat', - { - 'filetype', - icon_only = false, - icon = { '', align = 'right' }, - } - }, - lualine_y = { - 'progress', - -- { 'searchcount', timeout = 10 } - }, - lualine_z = {'location'} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {}, - lualine_y = {'progress'}, - lualine_z = {'location'} + lualine_c = {}, + lualine_x = {}, + lualine_y = { 'progress' }, + lualine_z = {}, }, - inactive_winbar = {}, extensions = {} }) diff --git a/lua/lazy_cfg/treesitter/context.lua b/lua/lazy_cfg/treesitter/context.lua index 06af8543..4c281d63 100644 --- a/lua/lazy_cfg/treesitter/context.lua +++ b/lua/lazy_cfg/treesitter/context.lua @@ -1,28 +1,25 @@ ---@diagnostic disable:unused-local ---@diagnostic disable:unused-function -require('user.types.user.highlight') - local User = require('user') local exists = User.exists -local hl = User.highlight +local types = User.types.user.highlight +local hi = User.highlight.hl if not exists('treesitter-context') then return end -local hi = hl.hl - local Context = require('treesitter-context') local Config = require('treesitter-context.config') ---@type TSContext.UserConfig local Options = { - mode = 'cursor', + mode = 'topline', trim_scope = 'outer', - line_numbers = true, + line_numbers = false, min_window_height = 3, - zindex = 30, + zindex = 15, enable = true, max_lines = 4, } diff --git a/lua/lazy_cfg/which_key/init.lua b/lua/lazy_cfg/which_key/init.lua index ff55e318..17e4505b 100644 --- a/lua/lazy_cfg/which_key/init.lua +++ b/lua/lazy_cfg/which_key/init.lua @@ -72,7 +72,7 @@ WK.setup({ align = "center", -- align columns left, center or right }, ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label - hidden = { "", "", "", "", "^:", "^ ", "^call ", "^lua " }, -- hide mapping boilerplate + hidden = { "", "", "", "", '', "^:", "^ ", "^call ", "^lua " }, -- hide mapping boilerplate show_help = true, -- show a help message in the command line for using WhichKey show_keys = true, -- show the currently pressed key and its label as a message in the command line triggers = "auto", -- automatically setup triggers @@ -94,9 +94,9 @@ WK.setup({ triggers_blacklist = { -- list of mode / prefixes that should never be hooked by WhichKey -- this is mostly relevant for keymaps that start with a native binding - i = { "j", "k" }, - v = { "j", "k", "v", 'y', 'c', 'd' }, - n = { "j", "k", "v", 'y', 'c', 'd' }, + i = { "j", "k", '', '' }, + v = { "j", "k", "v" }, + n = { "j", "k", "v" }, }, -- disable the WhichKey popup for certain buf types and file types. -- Disabled by default for Telescope diff --git a/lua/user/types/user/maps.lua b/lua/user/types/user/maps.lua index 4471b4fa..ad6d47a4 100644 --- a/lua/user/types/user/maps.lua +++ b/lua/user/types/user/maps.lua @@ -1,5 +1,6 @@ ---@alias ApiMapOpts vim.api.keyset.keymap ---@alias KeyMapOpts vim.keymap.set.Opts +---@alias BufMapOpts ApiMapOpts ---@alias KeyRhs string|fun() ---@alias ApiRhs string @@ -7,18 +8,35 @@ ---@field [1] ApiRhs ---@field [2]? ApiMapOpts ----@class ApiMapRhsOptsDict ----@field rhs ApiRhs ----@field opts? ApiMapOpts - ---@class KeyMapRhsOptsArr: ApiMapRhsOptsArr ---@field [1] KeyRhs ---@field [2]? KeyMapOpts +---@class ApiMapRhsOptsDict +---@field rhs ApiRhs +---@field opts? ApiMapOpts + ---@class KeyMapRhsOptsDict: ApiMapRhsOptsDict ---@field rhs KeyRhs ---@field opts? KeyMapOpts +---@class ApiMapArr +---@field [1] string +---@field [2] string +---@field [3]? ApiMapOpts + +---@class BufMapArr: ApiMapArr + +---@class KeyMapArr: ApiMapArr +---@field [1] string +---@field [2] string +---@field [3]? KeyMapOpts + +---@alias ApiMapDict table +---@alias ApiMapDicts table +---@alias KeyMapDict table +---@alias KeyMapDicts table + ---@class ApiMapTbl ---@field lhs string ---@field rhs string @@ -30,46 +48,55 @@ ---@field rhs string|fun() ---@field opts? KeyMapOpts +--- The same as `ApiMapTbl`, just add `bufnr` as field. +---@class BufMapTbl: ApiMapTbl +---@field bufnr? integer + ---@alias ApiMapFunction fun(lhs: string, rhs: string, opts: ApiMapOpts?) ---@alias KeyMapFunction fun(lhs: string, rhs: string|fun(), opts: KeyMapOpts?) ---@alias BufMapFunction fun(b: integer, lhs: string, rhs: string, opts: ApiMapOpts?) +---@class ApiMapModeDicts +---@field n? ApiMapTbl[] +---@field i? ApiMapTbl[] +---@field v? ApiMapTbl[] +---@field t? ApiMapTbl[] +---@field o? ApiMapTbl[] +---@field x? ApiMapTbl[] + +---@class KeyMapModeDicts +---@field n? KeyMapTbl[] +---@field i? KeyMapTbl[] +---@field v? KeyMapTbl[] +---@field t? KeyMapTbl[] +---@field o? KeyMapTbl[] +---@field x? KeyMapTbl[] + +---@class BufMapModeDicts: ApiMapModeDicts +---@field n? BufMapTbl[] +---@field i? BufMapTbl[] +---@field v? BufMapTbl[] +---@field t? BufMapTbl[] +---@field o? BufMapTbl[] +---@field x? BufMapTbl[] + ---@class UserApiMaps ----@field n ApiMapFunction ----@field v ApiMapFunction ----@field t ApiMapFunction ----@field i ApiMapFunction ----@field o? ApiMapFunction ----@field x? ApiMapFunction +---@field n ApiMapFunction +---@field v ApiMapFunction +---@field t ApiMapFunction +---@field i ApiMapFunction +---@field o ApiMapFunction +---@field x ApiMapFunction ---@class UserKeyMaps: UserApiMaps ----@field n KeyMapFunction ----@field v KeyMapFunction ----@field t KeyMapFunction ----@field i KeyMapFunction ----@field o? KeyMapFunction ----@field x? KeyMapFunction +---@field n KeyMapFunction +---@field v KeyMapFunction +---@field t KeyMapFunction +---@field i KeyMapFunction +---@field o KeyMapFunction +---@field x KeyMapFunction ---@class UserBufMaps: UserApiMaps ----@field n BufMapFunction ----@field v BufMapFunction ----@field t BufMapFunction ----@field i BufMapFunction ----@field o? BufMapFunction ----@field x? BufMapFunction - ----@class UserBufModeKeys ----@field n ApiMapTbl[] ----@field i ApiMapTbl[] ----@field v ApiMapTbl[] ----@field t ApiMapTbl[] ----@field o? ApiMapTbl[] ----@field x? ApiMapTbl[] - ----@alias ApiMapDict table ----@alias ApiMapDicts table ----@alias KeyMapDict table ----@alias KeyMapDicts table ---@class UserMaps ---@field kmap UserKeyMaps