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.cmp")
require("user.navic")
-- require("user.lsp-inlayhints")
-- require("user.lsp")
require("user.lsp-inlayhints")
require("user.lsp")
require("user.telescope")
require("user.treesitter")
require("user.autopairs")
@ -29,9 +29,11 @@ require("user.todo-comments")
require("user.symbol-outline")
require("user.notify")
require("user.ts-context")
require("user.functions")
require("user.illuminate")
require("user.dap")
require("user.lir")
require "user.winbar"
require("user.options")
require("user.nvim-webdev-icons")
require("user.fidget")
@ -39,3 +41,4 @@ require("user.browse")
require("user.surround")
require("user.harpoon")
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("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <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("u", icons.ui.CloudDownload .. " Update", ":PackerSync<CR>"),
button("q", icons.ui.SignOut .. " Quit", ":qa<CR>"),
@ -39,7 +37,7 @@ local function footer()
-- local fortune = handle:read("*a")
-- handle:close()
-- return fortune
return "chrisatmachine.com"
return "inkletblot.com"
end
dashboard.section.footer.val = footer()

View File

@ -31,9 +31,9 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
},
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
nnoremap <silent> <buffer> <esc> :close<CR>
set nobuflisted
nnoremap <silent> <buffer> q :close<CR>
nnoremap <silent> <buffer> <esc> :close<CR>
set nobuflisted
]]
end,
})
@ -43,8 +43,8 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> <m-r> :close<CR>
" nnoremap <silent> <buffer> <m-r> <NOP>
set nobuflisted
" nnoremap <silent> <buffer> <m-r> <NOP>
set nobuflisted
]]
end,
})
@ -55,10 +55,10 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {
local buf_ft = vim.bo.filetype
if buf_ft == "" or buf_ft == nil then
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
nnoremap <silent> <buffer> <c-j> j<CR>
nnoremap <silent> <buffer> <c-k> k<CR>
set nobuflisted
nnoremap <silent> <buffer> q :close<CR>
nnoremap <silent> <buffer> <c-j> j<CR>
nnoremap <silent> <buffer> <c-k> k<CR>
set nobuflisted
]]
end
end,
@ -187,3 +187,19 @@ vim.api.nvim_create_autocmd({ "BufWritePost" }, {
vim.lsp.buf.format { async = true }
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)
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
-- or go here and upload the font file: https://mathew-kurian.github.io/CharacterMap/
-- 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 {
kind = {
Text = "",
@ -114,109 +111,3 @@ if vim.fn.has "mac" == 1 or vim.g.use_nerd_icons then
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 term_opts = { silent = true }
-- Shorten function name
local keymap = vim.api.nvim_set_keymap
--Remap space as leader key
keymap("n", "<Space>", "", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
keymap('n', '<Space>', '', opts)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Modes
-- normal_mode = "n",
-- insert_mode = "i",
-- visual_mode = "v",
-- visual_block_mode = "x",
-- term_mode = "t",
-- command_mode = "c",
-- normal_mode = 'n',
-- insert_mode = 'i',
-- visual_mode = 'v',
-- visual_block_mode = 'x',
-- term_mode = 't',
-- command_mode = 'c',
keymap('n', 'c', '"_c', opts)
-- Normal --
-- Better window navigation
keymap("n", "<C-h>", "<C-w>h", opts)
keymap("n", "<C-j>", "<C-w>j", opts)
keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)
keymap('n', '<C-h>', '<C-w>h', opts)
keymap('n', '<C-j>', '<C-w>j', opts)
keymap('n', '<C-k>', '<C-w>k', opts)
keymap('n', '<C-l>', '<C-w>l', opts)
-- Resize with arrows
keymap("n", "<C-Up>", ":resize -2<CR>", opts)
keymap("n", "<C-Down>", ":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-Up>', ':resize -2<CR>', opts)
keymap('n', '<C-Down>', ':resize +2<CR>', opts)
keymap('n', '<C-Left>', ':vertical resize -2<CR>', opts)
keymap('n', '<C-Right>', ':vertical resize +2<CR>', opts)
-- Naviagate buffers
keymap("n", "<S-l>", ":bnext<CR>", opts)
keymap("n", "<S-h>", ":bprevious<CR>", opts)
keymap('n', '<S-l>', ':bnext<CR>', opts)
keymap('n', '<S-h>', ':bprevious<CR>', opts)
-- Move text up and down
keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts)
keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts)
keymap('n', '<A-j>', '<Esc>:m .+1<CR>==gi', opts)
keymap('n', '<A-k>', '<Esc>:m .-2<CR>==gi', opts)
-- Insert --
-- Press jk fast to enter
keymap("i", "jk", "<ESC>", opts)
keymap('i', 'jk', '<ESC>', opts)
-- Visual --
-- 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
keymap("v", "<A-j>", ":m .+1<CR>==", opts)
keymap("v", "<A-k>", ":m .-2<CR>==", opts)
keymap("v", "p", '"_dP', opts)
keymap("v", "P", '"_dP', opts)
keymap('v', '<A-j>', ':m .+1<CR>==', opts)
keymap('v', '<A-k>', ':m .-2<CR>==', opts)
keymap('v', 'p', '"_dP', opts)
keymap('v', 'P', '"_dP', opts)
-- Visual Block --
-- Move text up and down
keymap("x", "J", ":move '>+1<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-k>", ":move '<-2<CR>gv-gv", opts)
keymap('x', 'J', ':move ">+1<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-k>', ':move "<-2<CR>gv-gv', opts)
-- My bit's an pieces currently unsorted
-- Spellcheck
keymap("n", "<leader>o", ":setlocal spell! spelllang=en_us<CR>", opts)
keymap('n', '<leader>o', ':setlocal spell! spelllang=en_us<CR>', opts)
-- 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
keymap("n", "<C-c>", "\"+y", opts)
keymap("n", "<C-p", "\"+p", opts)
keymap('n', '<C-c>', '"+y', opts)
keymap('n', '<C-p', '"+p', opts)
-- 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
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
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
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 status_ok, lualine = pcall(require, "lualine")
if not status_ok then
return
local colors = {
red = '#ca1243',
grey = '#a0a1a7',
black = '#383a42',
white = '#f3f3f3',
light_green = '#83a598',
orange = '#fe8019',
green = '#8ec07c',
}
local theme = {
normal = {
a = { fg = colors.white, bg = colors.black },
b = { fg = colors.white, bg = colors.grey },
c = { fg = colors.black, bg = colors.white },
z = { fg = colors.white, bg = colors.black },
},
insert = { a = { fg = colors.black, bg = colors.light_green } },
visual = { a = { fg = colors.black, bg = colors.orange } },
replace = { a = { fg = colors.black, bg = colors.green } },
}
local empty = require('lualine.component'):extend()
function empty:draw(default_highlight)
self.status = ''
self.applied_separator = ''
self:apply_highlights(default_highlight)
self:apply_section_separators()
return self.status
end
local lualine_scheme = "darkplus_dark"
-- local lualine_scheme = "onedarker_alt"
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
-- Put proper separators and gaps between components in sections
local function process_sections(sections)
for name, section in pairs(sections) do
local left = name:sub(9, 10) < 'x'
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
end
for id, comp in ipairs(section) do
if type(comp) ~= 'table' then
comp = { comp }
section[id] = comp
end
comp.separator = left and { right = '' } or { left = '' }
end
end
return false
return sections
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"
local function search_result()
if vim.v.hlsearch == 0 then
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
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 .. "%*"
local function modified()
if vim.bo.modified then
return '+'
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
return '-'
end
return ''
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 = {
function()
return ""
end,
padding = 0,
color = function()
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,
update_in_insert = false,
always_visible = true,
padding = 0,
}
local diff = {
"diff",
colored = false,
symbols = { added = icons.git.Add .. " ", modified = icons.git.Mod .. " ", removed = icons.git.Remove .. " " }, -- changes diff symbols
cond = hide_in_width_60,
separator = "%#SLSeparator#" .. "" .. "%*",
}
local filetype = {
"filetype",
fmt = function(str)
local ui_filetypes = {
"help",
"packer",
"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
if str == "TelescopePrompt" then
return return_val(icons.ui.Telescope)
end
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
local clients = vim.lsp.buf_get_clients()
local client_names = {}
local copilot_active = false
-- add client
for _, client in pairs(clients) do
if client.name ~= "copilot" and client.name ~= "null-ls" then
table.insert(client_names, client.name)
end
if client.name == "copilot" then
copilot_active = true
end
end
-- add formatter
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 {
require('lualine').setup {
options = {
globalstatus = true,
icons_enabled = true,
-- theme = "auto",
theme = theme,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = { "alpha", "dashboard" },
always_divide_middle = true,
theme = 'gruvbox-material',
component_separators = '',
section_separators = { left = '', right = '' },
},
sections = {
lualine_a = { left_pad, mode, branch, right_pad },
lualine_b = { left_pad_alt, diagnostics, right_pad_alt },
-- lualine_c = {},
lualine_c = { current_signature },
-- lualine_x = { diff, spaces, "encoding", filetype },
-- lualine_x = { diff, lanuage_server, spaces, filetype },
-- lualine_x = { lanuage_server, spaces, filetype },
lualine_x = { lanuage_server, spaces, filetype },
lualine_y = {},
lualine_z = { location, progress },
sections = process_sections {
lualine_a = { 'mode' },
lualine_b = {
'branch',
'diff',
{
'diagnostics',
source = { 'nvim' },
sections = { 'error' },
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
},
{
'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 = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
lualine_c = { '%f %y %m' },
lualine_x = {},
},
tabline = {},
extensions = {},
}

View File

@ -32,7 +32,7 @@ local options = {
relativenumber = true, -- set relative numbered lines
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
wrap = false, -- display lines as one long line
wrap = true, -- display lines as one long line
scrolloff = 8, -- is one of my fav
sidescrolloff = 8,
guifont = "monospace:h17", -- the font used in graphical neovim applications
@ -61,17 +61,3 @@ end
vim.cmd "set whichwrap+=<,>,[,],h,l"
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 "RRethy/vim-illuminate"
use "j-hui/fidget.nvim"
use "lvimuser/lsp-inlayhints.nvim"
-- Completion
use "hrsh7th/nvim-cmp"
@ -97,6 +98,8 @@ return packer.startup(function(use)
-- Colorschemes
use "folke/tokyonight.nvim"
use "sainnhe/gruvbox-material"
use 'RRethy/nvim-base16'
-- Utility
use "rcarriga/nvim-notify"
@ -105,6 +108,8 @@ return packer.startup(function(use)
use "moll/vim-bbye"
use "lewis6991/impatient.nvim"
use "lalitmee/browse.nvim"
use 'junegunn/goyo.vim'
use 'junegunn/limelight.vim'
-- Icon
use "kyazdani42/nvim-web-devicons"
@ -160,8 +165,10 @@ return packer.startup(function(use)
use "nacro90/numb.nvim"
use "andymass/vim-matchup"
use "folke/zen-mode.nvim"
use "fgheng/winbar.nvim"
use "karb94/neoscroll.nvim"
use "junegunn/vim-slash"
use 'vimwiki/vimwiki'
-- Motion
use "phaazon/hop.nvim"

View File

@ -69,6 +69,7 @@ import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
import XMonad.Util.SpawnOnce
-- 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 = True