general updates to nvim config

This commit is contained in:
Solomon Laing 2022-08-19 18:29:54 +09:30
parent 0501e5d57f
commit 731917422d
10 changed files with 199 additions and 637 deletions

View File

@ -4,8 +4,8 @@ require("user.colorscheme")
require("user.autocommands") require("user.autocommands")
require("user.cmp") require("user.cmp")
require("user.navic") require("user.navic")
-- require("user.lsp-inlayhints") require("user.lsp-inlayhints")
-- require("user.lsp") require("user.lsp")
require("user.telescope") require("user.telescope")
require("user.treesitter") require("user.treesitter")
require("user.autopairs") require("user.autopairs")
@ -29,9 +29,11 @@ require("user.todo-comments")
require("user.symbol-outline") require("user.symbol-outline")
require("user.notify") require("user.notify")
require("user.ts-context") require("user.ts-context")
require("user.functions")
require("user.illuminate") require("user.illuminate")
require("user.dap") require("user.dap")
require("user.lir") require("user.lir")
require "user.winbar"
require("user.options") require("user.options")
require("user.nvim-webdev-icons") require("user.nvim-webdev-icons")
require("user.fidget") require("user.fidget")
@ -39,3 +41,4 @@ require("user.browse")
require("user.surround") require("user.surround")
require("user.harpoon") require("user.harpoon")
require("user.vim-slash") require("user.vim-slash")
require("user.lualine")

View File

@ -27,8 +27,6 @@ dashboard.section.buttons.val = {
button("p", icons.git.Repo .. " Find project", ":lua require('telescope').extensions.projects.projects()<CR>"), button("p", icons.git.Repo .. " Find project", ":lua require('telescope').extensions.projects.projects()<CR>"),
button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"), button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"),
button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"), button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"),
-- dashboard.button("s", icons.ui.SignIn .. " Find Session", ":silent Autosession search <CR>"),
button("s", icons.ui.SignIn .. " Find Session", ":SearchSession<CR>"),
button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"), button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"),
button("u", icons.ui.CloudDownload .. " Update", ":PackerSync<CR>"), button("u", icons.ui.CloudDownload .. " Update", ":PackerSync<CR>"),
button("q", icons.ui.SignOut .. " Quit", ":qa<CR>"), button("q", icons.ui.SignOut .. " Quit", ":qa<CR>"),
@ -39,7 +37,7 @@ local function footer()
-- local fortune = handle:read("*a") -- local fortune = handle:read("*a")
-- handle:close() -- handle:close()
-- return fortune -- return fortune
return "chrisatmachine.com" return "inkletblot.com"
end end
dashboard.section.footer.val = footer() dashboard.section.footer.val = footer()

View File

@ -187,3 +187,19 @@ vim.api.nvim_create_autocmd({ "BufWritePost" }, {
vim.lsp.buf.format { async = true } vim.lsp.buf.format { async = true }
end, end,
}) })
vim.cmd [[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o]]
vim.cmd [[autocmd BufRead,BufNewFile *.tex set filetype=tex]]
vim.cmd [[
autocmd BufWritePre * let currPos = getpos(".")
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritePre * %s/\n\+\%$//e
autocmd BufWritePre *.[ch] %s/\%$/\r/e
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
]]
vim.cmd [[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]]
vim.cmd [[autocmd VimLeave *.tex !texclear %]]

View File

@ -1,4 +1,4 @@
local colorscheme = "tokyonight" local colorscheme = "gruvbox-material"
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not status_ok then if not status_ok then

View File

@ -2,9 +2,6 @@
-- go to the above and then enter <c-v>u<unicode> and the symbold should appear -- go to the above and then enter <c-v>u<unicode> and the symbold should appear
-- or go here and upload the font file: https://mathew-kurian.github.io/CharacterMap/ -- or go here and upload the font file: https://mathew-kurian.github.io/CharacterMap/
-- find more here: https://www.nerdfonts.com/cheat-sheet -- find more here: https://www.nerdfonts.com/cheat-sheet
vim.g.use_nerd_icons = false
if vim.fn.has "mac" == 1 or vim.g.use_nerd_icons then
-- elseif vim.fn.has "mac" == 1 then
return { return {
kind = { kind = {
Text = "", Text = "",
@ -114,109 +111,3 @@ if vim.fn.has "mac" == 1 or vim.g.use_nerd_icons then
CircuitBoard = "", CircuitBoard = "",
}, },
} }
else
--   פּ ﯟ   蘒練 some other good icons
return {
kind = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
Misc = "",
},
type = {
Array = "",
Number = "",
String = "",
Boolean = "",
Object = "",
},
documents = {
File = "",
Files = "",
Folder = "",
OpenFolder = "",
},
git = {
Add = "",
Mod = "",
Remove = "",
Ignore = "",
Rename = "",
Diff = "",
Repo = "",
Octoface = "",
},
ui = {
ArrowClosed = "",
ArrowOpen = "",
Lock = "",
Circle = "",
BigCircle = "",
BigUnfilledCircle = "",
Close = "",
NewFile = " ",
Search = "",
Lightbulb = "",
Project = "",
Dashboard = "",
History = "",
Comment = "",
Bug = "",
Code = "",
Telescope = "",
Gear = "",
Package = "",
List = "",
SignIn = "",
SignOut = "",
NoteBook = "",
Check = "",
Fire = "",
Note = "",
BookMark = "",
Pencil = "",
ChevronRight = "",
Table = "",
Calendar = "",
CloudDownload = "",
},
diagnostics = {
Error = "",
Warning = "",
Information = "",
Question = "",
Hint = "",
},
misc = {
Robot = "",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}
end

View File

@ -1,90 +1,97 @@
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
local term_opts = { silent = true } local term_opts = { silent = true }
-- Shorten function name -- Shorten function name
local keymap = vim.api.nvim_set_keymap local keymap = vim.api.nvim_set_keymap
--Remap space as leader key --Remap space as leader key
keymap("n", "<Space>", "", opts) keymap('n', '<Space>', '', opts)
vim.g.mapleader = " " vim.g.mapleader = ' '
vim.g.maplocalleader = " " vim.g.maplocalleader = ' '
-- Modes -- Modes
-- normal_mode = "n", -- normal_mode = 'n',
-- insert_mode = "i", -- insert_mode = 'i',
-- visual_mode = "v", -- visual_mode = 'v',
-- visual_block_mode = "x", -- visual_block_mode = 'x',
-- term_mode = "t", -- term_mode = 't',
-- command_mode = "c", -- command_mode = 'c',
keymap('n', 'c', '"_c', opts)
-- Normal -- -- Normal --
-- Better window navigation -- Better window navigation
keymap("n", "<C-h>", "<C-w>h", opts) keymap('n', '<C-h>', '<C-w>h', opts)
keymap("n", "<C-j>", "<C-w>j", opts) keymap('n', '<C-j>', '<C-w>j', opts)
keymap("n", "<C-k>", "<C-w>k", opts) keymap('n', '<C-k>', '<C-w>k', opts)
keymap("n", "<C-l>", "<C-w>l", opts) keymap('n', '<C-l>', '<C-w>l', opts)
-- Resize with arrows -- Resize with arrows
keymap("n", "<C-Up>", ":resize -2<CR>", opts) keymap('n', '<C-Up>', ':resize -2<CR>', opts)
keymap("n", "<C-Down>", ":resize +2<CR>", opts) keymap('n', '<C-Down>', ':resize +2<CR>', opts)
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts) keymap('n', '<C-Left>', ':vertical resize -2<CR>', opts)
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts) keymap('n', '<C-Right>', ':vertical resize +2<CR>', opts)
-- Naviagate buffers -- Naviagate buffers
keymap("n", "<S-l>", ":bnext<CR>", opts) keymap('n', '<S-l>', ':bnext<CR>', opts)
keymap("n", "<S-h>", ":bprevious<CR>", opts) keymap('n', '<S-h>', ':bprevious<CR>', opts)
-- Move text up and down -- Move text up and down
keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts) keymap('n', '<A-j>', '<Esc>:m .+1<CR>==gi', opts)
keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts) keymap('n', '<A-k>', '<Esc>:m .-2<CR>==gi', opts)
-- Insert -- -- Insert --
-- Press jk fast to enter -- Press jk fast to enter
keymap("i", "jk", "<ESC>", opts) keymap('i', 'jk', '<ESC>', opts)
-- Visual -- -- Visual --
-- Stay in indent mode -- Stay in indent mode
keymap("v", "<", "<gv", opts) keymap('v', '<', '<gv', opts)
keymap("v", ">", ">gv", opts) keymap('v', '>', '>gv', opts)
-- Move text up and down -- Move text up and down
keymap("v", "<A-j>", ":m .+1<CR>==", opts) keymap('v', '<A-j>', ':m .+1<CR>==', opts)
keymap("v", "<A-k>", ":m .-2<CR>==", opts) keymap('v', '<A-k>', ':m .-2<CR>==', opts)
keymap("v", "p", '"_dP', opts) keymap('v', 'p', '"_dP', opts)
keymap("v", "P", '"_dP', opts) keymap('v', 'P', '"_dP', opts)
-- Visual Block -- -- Visual Block --
-- Move text up and down -- Move text up and down
keymap("x", "J", ":move '>+1<CR>gv-gv", opts) keymap('x', 'J', ':move ">+1<CR>gv-gv', opts)
keymap("x", "K", ":move '<-2<CR>gv-gv", opts) keymap('x', 'K', ':move "<-2<CR>gv-gv', opts)
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts) keymap('x', '<A-j>', ':move ">+1<CR>gv-gv', opts)
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts) keymap('x', '<A-k>', ':move "<-2<CR>gv-gv', opts)
-- My bit's an pieces currently unsorted -- My bit's an pieces currently unsorted
-- Spellcheck -- Spellcheck
keymap("n", "<leader>o", ":setlocal spell! spelllang=en_us<CR>", opts) keymap('n', '<leader>o', ':setlocal spell! spelllang=en_us<CR>', opts)
-- Tree -- Tree
keymap("n", "<leader>n", ":NvimTreeToggle<CR>", opts) keymap('n', '<leader>n', ':NvimTreeToggle<CR>', opts)
-- Goyo
keymap('n', '<leader>f', ':Goyo<CR>', opts)
-- Copy and Paste -- Copy and Paste
keymap("n", "<C-c>", "\"+y", opts) keymap('n', '<C-c>', '"+y', opts)
keymap("n", "<C-p", "\"+p", opts) keymap('n', '<C-p', '"+p', opts)
-- Replace All is S -- Replace All is S
keymap("n", "S", ":%s//g<Left><Left>", opts) vim.cmd [[nnoremap S :%s//g<Left><Left>]]
-- keymap('n', '<S-s>', ':%s//g<Left><Left>', opts)
-- Compile the document with default compiler script -- Compile the document with default compiler script
keymap("n", "<leader>c", ":w! | !compiler <c-r>%<CR>", opts) vim.cmd [[map <leader>c :w! \| !compiler "<c-r>%"<CR>]]
-- keymap('n', '<leader>c', ':w! | !compiler <c-r>%<CR>', opts)
-- Open compiled document -- Open compiled document
keymap("n", "<leader>p", ":!opout <c-r>%<CR><CR>", opts) keymap('n', '<leader>p', ':!opout <c-r>%<CR><CR>', opts)
-- Attempt sudo for files that require it -- Attempt sudo for files that require it
keymap("n", "w!!", "execute 'silent! write !sudo tee % >/dev/null' <bar> edit!", opts) keymap('n', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!', opts)
keymap("n", "<F11>", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
keymap("n", "<F12>", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
keymap("n", "<C-z>", "<cmd>ZenMode<cr>", opts)

View File

@ -1,471 +1,124 @@
M = {} local colors = {
local status_ok, lualine = pcall(require, "lualine") red = '#ca1243',
if not status_ok then grey = '#a0a1a7',
return black = '#383a42',
end white = '#f3f3f3',
light_green = '#83a598',
local lualine_scheme = "darkplus_dark" orange = '#fe8019',
-- local lualine_scheme = "onedarker_alt" green = '#8ec07c',
local status_theme_ok, theme = pcall(require, "lualine.themes." .. lualine_scheme)
if not status_theme_ok then
return
end
-- check if value in table
local function contains(t, value)
for _, v in pairs(t) do
if v == value then
return true
end
end
return false
end
local gray = "#32363e"
local dark_gray = "#282C34"
local dark_gray = "#282C34"
local red = "#D16969"
local blue = "#569CD6"
local green = "#6A9955"
local cyan = "#4EC9B0"
local orange = "#CE9178"
local indent = "#CE9178"
local yellow = "#DCDCAA"
local yellow_orange = "#D7BA7D"
local purple = "#C586C0"
if lualine_scheme == "darkplus_dark" then
-- gray = "#3e3e3e"
gray = "#303030"
dark_gray = "#303030"
red = "#bf616a"
blue = "#5e81ac"
indent = "#A3BE8C"
green = "#A3BE8C"
cyan = "#88c0d0"
orange = "#C68A75"
yellow = "#DCDCAA"
yellow_orange = "#D7BA7D"
purple = "#B48EAD"
end
local sl_hl = vim.api.nvim_get_hl_by_name("StatusLine", true)
local sl_hl_sep = vim.api.nvim_get_hl_by_name("StatusLineSeparator", true)
vim.api.nvim_set_hl(0, "SLGitIcon", { fg = "#E8AB53", bg = dark_gray })
vim.api.nvim_set_hl(0, "SLTermIcon", { fg = purple, bg = gray })
vim.api.nvim_set_hl(0, "SLBranchName", { fg = "#abb2bf", bg = dark_gray, bold = false })
vim.api.nvim_set_hl(0, "SLProgress", { fg = purple, bg = gray })
vim.api.nvim_set_hl(0, "SLLocation", { fg = blue, bg = gray })
vim.api.nvim_set_hl(0, "SLFT", { fg = cyan, bg = gray })
vim.api.nvim_set_hl(0, "SLIndent", { fg = indent, bg = gray })
vim.api.nvim_set_hl(0, "SLLSP", { fg = "#6b727f", bg = "NONE" })
vim.api.nvim_set_hl(0, "SLSep", { fg = gray, bg = "NONE" })
vim.api.nvim_set_hl(0, "SLFG", { fg = "#abb2bf", bg = "NONE" })
vim.api.nvim_set_hl(0, "SLSeparator", { fg = "#6b727f", bg = "NONE", italic = true })
vim.api.nvim_set_hl(0, "SLError", { fg = "#bf616a", bg = "NONE" })
vim.api.nvim_set_hl(0, "SLWarning", { fg = "#D7BA7D", bg = "NONE" })
vim.api.nvim_set_hl(0, "SLCopilot", { fg = "#6CC644", bg = "NONE" })
local hl_str = function(str, hl)
return "%#" .. hl .. "#" .. str .. "%*"
end
local mode_color = {
n = blue,
i = orange,
v = "#b668cd",
[""] = "#b668cd",
V = "#b668cd",
-- c = '#B5CEA8',
-- c = '#D7BA7D',
c = "#46a6b2",
no = "#D16D9E",
s = green,
S = orange,
[""] = orange,
ic = red,
R = "#D16D9E",
Rv = red,
cv = blue,
ce = blue,
r = red,
rm = "#46a6b2",
["r?"] = "#46a6b2",
["!"] = "#46a6b2",
t = red,
} }
local left_pad = { local theme = {
function() normal = {
return "" a = { fg = colors.white, bg = colors.black },
end, b = { fg = colors.white, bg = colors.grey },
padding = 0, c = { fg = colors.black, bg = colors.white },
color = function() z = { fg = colors.white, bg = colors.black },
return { fg = gray }
end,
}
local right_pad = {
function()
return ""
end,
padding = 0,
color = function()
return { fg = dark_gray }
end,
}
local left_pad_alt = {
function()
return ""
end,
padding = 0,
color = function()
return { fg = gray }
end,
}
local right_pad_alt = {
function()
return ""
end,
padding = 0,
color = function()
return { fg = gray }
end,
}
local mode = {
-- mode component
function()
-- return "▊"
return ""
-- return "  "
end,
color = function()
-- auto change color according to neovims mode
return { fg = mode_color[vim.fn.mode()], bg = gray }
end,
padding = 0,
}
local hide_in_width_60 = function()
return vim.o.columns > 60
end
local hide_in_width = function()
return vim.o.columns > 80
end
local hide_in_width_100 = function()
return vim.o.columns > 100
end
local icons = require "user.icons"
local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn" },
symbols = {
error = "%#SLError#" .. icons.diagnostics.Error .. "%*" .. " ",
warn = "%#SLWarning#" .. icons.diagnostics.Warning .. "%*" .. " ",
}, },
colored = false, insert = { a = { fg = colors.black, bg = colors.light_green } },
update_in_insert = false, visual = { a = { fg = colors.black, bg = colors.orange } },
always_visible = true, replace = { a = { fg = colors.black, bg = colors.green } },
padding = 0,
} }
local diff = { local empty = require('lualine.component'):extend()
"diff", function empty:draw(default_highlight)
colored = false, self.status = ''
symbols = { added = icons.git.Add .. " ", modified = icons.git.Mod .. " ", removed = icons.git.Remove .. " " }, -- changes diff symbols self.applied_separator = ''
cond = hide_in_width_60, self:apply_highlights(default_highlight)
separator = "%#SLSeparator#" .. "" .. "%*", self:apply_section_separators()
} return self.status
end
local filetype = { -- Put proper separators and gaps between components in sections
"filetype", local function process_sections(sections)
fmt = function(str) for name, section in pairs(sections) do
local ui_filetypes = { local left = name:sub(9, 10) < 'x'
"help", for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
"packer", table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
"neogitstatus",
"NvimTree",
"Trouble",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"DressingSelect",
"",
"nil",
}
local return_val = function(str)
return hl_str("", "SLSep") .. hl_str(str, "SLFT") .. hl_str("", "SLSep")
end end
for id, comp in ipairs(section) do
if str == "TelescopePrompt" then if type(comp) ~= 'table' then
return return_val(icons.ui.Telescope) comp = { comp }
section[id] = comp
end end
comp.separator = left and { right = '' } or { left = '' }
local function get_term_num()
local t_status_ok, toggle_num = pcall(vim.api.nvim_buf_get_var, 0, "toggle_number")
if not t_status_ok then
return ""
end
return toggle_num
end
if str == "toggleterm" then
-- 
local term = "%#SLTermIcon#" .. "" .. "%*" .. "%#SLFT#" .. get_term_num() .. "%*"
return return_val(term)
end
if contains(ui_filetypes, str) then
return ""
else
return return_val(str)
end
end,
icons_enabled = false,
padding = 0,
}
local branch = {
"branch",
icons_enabled = true,
icon = "%#SLGitIcon#" .. "" .. "%*" .. "%#SLBranchName#",
-- color = "Constant",
colored = false,
padding = 0,
-- cond = hide_in_width_100,
fmt = function(str)
if str == "" or str == nil then
return "!=vcs"
end
return str
end,
}
local progress = {
"progress",
fmt = function(str)
-- return "▊"
return hl_str("", "SLSep") .. hl_str("%P/%L", "SLProgress") .. hl_str("", "SLSep")
-- return "  "
end,
-- color = "SLProgress",
padding = 0,
}
local current_signature = {
function()
local buf_ft = vim.bo.filetype
if buf_ft == "toggleterm" or buf_ft == "TelescopePrompt" then
return ""
end
if not pcall(require, "lsp_signature") then
return ""
end
local sig = require("lsp_signature").status_line(30)
local hint = sig.hint
if not require("user.functions").isempty(hint) then
-- return "%#SLSeparator#│ : " .. hint .. "%*"
-- return "%#SLSeparator#│ " .. hint .. "%*"
return "%#SLSeparator# " .. hint .. "%*"
end
return ""
end,
cond = hide_in_width_100,
padding = 0,
}
-- cool function for progress
-- local progress = function()
-- local current_line = vim.fn.line "."
-- local total_lines = vim.fn.line "$"
-- local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" }
-- local line_ratio = current_line / total_lines
-- local index = math.ceil(line_ratio * #chars)
-- -- return chars[index]
-- return "%#SLProgress#" .. chars[index] .. "%*"
-- end
local spaces = {
function()
local buf_ft = vim.bo.filetype
local ui_filetypes = {
"help",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"lir",
"Outline",
"spectre_panel",
"DressingSelect",
"",
}
local space = ""
if contains(ui_filetypes, buf_ft) then
space = " "
end
local shiftwidth = vim.api.nvim_buf_get_option(0, "shiftwidth")
if shiftwidth == nil then
return ""
end
-- TODO: update codicons and use their indent
return hl_str("", "SLSep") .. hl_str("" .. shiftwidth .. space, "SLIndent") .. hl_str("", "SLSep")
end,
padding = 0,
-- separator = "%#SLSeparator#" .. " │" .. "%*",
-- cond = hide_in_width_100,
}
local lanuage_server = {
function()
local buf_ft = vim.bo.filetype
local ui_filetypes = {
"help",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"DressingSelect",
"TelescopePrompt",
"lspinfo",
"lsp-installer",
"",
}
if contains(ui_filetypes, buf_ft) then
if M.language_servers == nil then
return ""
else
return M.language_servers
end end
end end
return sections
end
local clients = vim.lsp.buf_get_clients() local function search_result()
local client_names = {} if vim.v.hlsearch == 0 then
local copilot_active = false return ''
end
local last_search = vim.fn.getreg('/')
if not last_search or last_search == '' then
return ''
end
local searchcount = vim.fn.searchcount { maxcount = 9999 }
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
end
-- add client local function modified()
for _, client in pairs(clients) do if vim.bo.modified then
if client.name ~= "copilot" and client.name ~= "null-ls" then return '+'
table.insert(client_names, client.name) elseif vim.bo.modifiable == false or vim.bo.readonly == true then
end return '-'
if client.name == "copilot" then
copilot_active = true
end
end end
return ''
end
-- add formatter require('lualine').setup {
local s = require "null-ls.sources"
local available_sources = s.get_available(buf_ft)
local registered = {}
for _, source in ipairs(available_sources) do
for method in pairs(source.methods) do
registered[method] = registered[method] or {}
table.insert(registered[method], source.name)
end
end
local formatter = registered["NULL_LS_FORMATTING"]
local linter = registered["NULL_LS_DIAGNOSTICS"]
if formatter ~= nil then
vim.list_extend(client_names, formatter)
end
if linter ~= nil then
vim.list_extend(client_names, linter)
end
-- join client names with commas
local client_names_str = table.concat(client_names, ", ")
-- check client_names_str if empty
local language_servers = ""
local client_names_str_len = #client_names_str
if client_names_str_len ~= 0 then
language_servers = hl_str("", "SLSep") .. hl_str(client_names_str, "SLSeparator") .. hl_str("", "SLSep")
end
if copilot_active then
language_servers = language_servers .. "%#SLCopilot#" .. " " .. icons.git.Octoface .. "%*"
end
if client_names_str_len == 0 and not copilot_active then
return ""
else
M.language_servers = language_servers
return language_servers:gsub(", anonymous source", "")
end
end,
padding = 0,
cond = hide_in_width,
-- separator = "%#SLSeparator#" .. " │" .. "%*",
}
local location = {
"location",
fmt = function(str)
-- return "▊"
return hl_str("", "SLSep") .. hl_str(str, "SLLocation") .. hl_str("", "SLSep")
-- return "  "
end,
padding = 0,
}
lualine.setup {
options = { options = {
globalstatus = true, theme = 'gruvbox-material',
icons_enabled = true, component_separators = '',
-- theme = "auto", section_separators = { left = '', right = '' },
theme = theme,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = { "alpha", "dashboard" },
always_divide_middle = true,
}, },
sections = { sections = process_sections {
lualine_a = { left_pad, mode, branch, right_pad }, lualine_a = { 'mode' },
lualine_b = { left_pad_alt, diagnostics, right_pad_alt }, lualine_b = {
-- lualine_c = {}, 'branch',
lualine_c = { current_signature }, 'diff',
-- lualine_x = { diff, spaces, "encoding", filetype }, {
-- lualine_x = { diff, lanuage_server, spaces, filetype }, 'diagnostics',
-- lualine_x = { lanuage_server, spaces, filetype }, source = { 'nvim' },
lualine_x = { lanuage_server, spaces, filetype }, sections = { 'error' },
lualine_y = {}, diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
lualine_z = { location, progress }, },
{
'diagnostics',
source = { 'nvim' },
sections = { 'warn' },
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
},
{ 'filename', file_status = false, path = 1 },
{ modified, color = { bg = colors.red } },
{
'%w',
cond = function()
return vim.wo.previewwindow
end,
},
{
'%r',
cond = function()
return vim.bo.readonly
end,
},
{
'%q',
cond = function()
return vim.bo.buftype == 'quickfix'
end,
},
},
lualine_c = {},
lualine_x = {},
lualine_y = { search_result, 'filetype' },
lualine_z = { '%l:%c', '%p%%/%L' },
}, },
inactive_sections = { inactive_sections = {
lualine_a = {}, lualine_c = { '%f %y %m' },
lualine_b = {}, lualine_x = {},
lualine_c = {},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
}, },
tabline = {},
extensions = {},
} }

View File

@ -32,7 +32,7 @@ local options = {
relativenumber = true, -- set relative numbered lines relativenumber = true, -- set relative numbered lines
numberwidth = 4, -- set number column width to 2 {default 4} numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = false, -- display lines as one long line wrap = true, -- display lines as one long line
scrolloff = 8, -- is one of my fav scrolloff = 8, -- is one of my fav
sidescrolloff = 8, sidescrolloff = 8,
guifont = "monospace:h17", -- the font used in graphical neovim applications guifont = "monospace:h17", -- the font used in graphical neovim applications
@ -61,17 +61,3 @@ end
vim.cmd "set whichwrap+=<,>,[,],h,l" vim.cmd "set whichwrap+=<,>,[,],h,l"
vim.cmd [[set iskeyword+=-]] vim.cmd [[set iskeyword+=-]]
-- I don't know enough yet to get these working so here's a work around
vim.api.nvim_command([[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o]])
vim.cmd [[autocmd BufRead,BufNewFile *.tex set filetype=tex]]
vim.api.nvim_command([[
augroup TrimAndReset
autocmd BufWritePre * let currPos = getpos(".")
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritePre * %s/\n\+\%$//e
autocmd BufWritePre *.[ch] %s/\%$/\r/e
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
augroup END
]])
vim.cmd [[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]]

View File

@ -61,6 +61,7 @@ return packer.startup(function(use)
use "simrat39/symbols-outline.nvim" use "simrat39/symbols-outline.nvim"
use "RRethy/vim-illuminate" use "RRethy/vim-illuminate"
use "j-hui/fidget.nvim" use "j-hui/fidget.nvim"
use "lvimuser/lsp-inlayhints.nvim"
-- Completion -- Completion
use "hrsh7th/nvim-cmp" use "hrsh7th/nvim-cmp"
@ -97,6 +98,8 @@ return packer.startup(function(use)
-- Colorschemes -- Colorschemes
use "folke/tokyonight.nvim" use "folke/tokyonight.nvim"
use "sainnhe/gruvbox-material"
use 'RRethy/nvim-base16'
-- Utility -- Utility
use "rcarriga/nvim-notify" use "rcarriga/nvim-notify"
@ -105,6 +108,8 @@ return packer.startup(function(use)
use "moll/vim-bbye" use "moll/vim-bbye"
use "lewis6991/impatient.nvim" use "lewis6991/impatient.nvim"
use "lalitmee/browse.nvim" use "lalitmee/browse.nvim"
use 'junegunn/goyo.vim'
use 'junegunn/limelight.vim'
-- Icon -- Icon
use "kyazdani42/nvim-web-devicons" use "kyazdani42/nvim-web-devicons"
@ -160,8 +165,10 @@ return packer.startup(function(use)
use "nacro90/numb.nvim" use "nacro90/numb.nvim"
use "andymass/vim-matchup" use "andymass/vim-matchup"
use "folke/zen-mode.nvim" use "folke/zen-mode.nvim"
use "fgheng/winbar.nvim"
use "karb94/neoscroll.nvim" use "karb94/neoscroll.nvim"
use "junegunn/vim-slash" use "junegunn/vim-slash"
use 'vimwiki/vimwiki'
-- Motion -- Motion
use "phaazon/hop.nvim" use "phaazon/hop.nvim"

View File

@ -69,6 +69,7 @@ import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
import XMonad.Util.SpawnOnce import XMonad.Util.SpawnOnce
-- A simple way to switch between desktop and laptop related things -- A simple way to switch between desktop and laptop related things
-- Don't forget this exists, I have previously confused myself by doing so.
isLaptop :: Bool isLaptop :: Bool
isLaptop = True isLaptop = True