Commit Graph

95 Commits

Author SHA1 Message Date
shadmansaleh c5cb601a6a feat(diagnostics): Add support for nvims diagnostic API
- neovim added new diagnostics api in https://github.com/neovim/neovim/pull/15585.
  So I've added a new diagnostics source named `nvim` (Yes I couldn't
  find a name for it :P) that shows diagnostics from that api.
  In neovim nightly with vim.diagnostics you can consider source
  `nvim_lsp` obsolete.
- Diagnostics source `vim_lsp` was removed in a mistake now it's
  restored.
2021-09-17 18:50:32 +06:00
shadmansaleh f7702d8841 enhance: check for new diagnostics highlight groups
- Now DiagnosticError, DiagnosticWarn, DiagnosticInfo, DiagnosticHint
  are also consider3d for default highlight in diagnostics component.
- Moved getHl from auto theme to utils as extract_color_from_hllist

closes #56
2021-09-17 15:28:30 +06:00
shadmansaleh b76c410dba fixup: fixes issues in diagnostics component
- typo diagnostic_color -> diagnostics_color
- typo hin -> hint
- warning -> warn since that's what's used everywhere
- change default diagnostics colors slightly

fixes #55
2021-09-17 15:27:57 +06:00
Shadman 2f801ed622
Refactor: simplify options (#24)
* Deprecate upper & lower option.

These does not make much sense and `format` option can provide same results

* Unify padding options

* Add persistent notices

* Make separators use left/right keys to specify left right instead of
sequence

* Rename format -> fmt

* Rename condition -> cond

* Rename disable_text -> icon_only

* Unify color_error,warning,info,hint under diagnostics_color

* Unify color_added,modified,removed hint under diff_color
2021-09-14 21:14:23 +06:00
shadmansaleh 0e0cf68eba Revert: enahce: sync diff&branch component to buffer based of bufnr instead of BufEnter
functionally reverted commit 2b90200998
nvim gives first scratch buffer(when opened without a file) and the
first opened buffer bufnr 1 . That's why we can't relay completely
on bufnr being different to indicate file is different. So back to
BufEnter autocommands.

closes #38
2021-09-06 18:20:36 +06:00
github-actions[bot] db448f41e6
chore: formated with stylua (#32)
Apply initial stylua format

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-09-04 00:28:20 +06:00
Shadman 4042e837f8
chore: use stylua for formating
* Switch to stylua for formating

* Change lua-format ignore to stylua ignore.

* Add workflow for formating with stylua
2021-09-04 00:20:34 +06:00
shadmansaleh b2fcf50742 enhance: Reload lualine for ColorScheme so auto can self update 2021-09-03 20:16:54 +06:00
shadmansaleh a643a24d94 enhance: improve function component
- provide self as 1st argument
- handle error in function call
- convert the result to string by default
2021-09-03 18:19:00 +06:00
shadmansaleh c0f53e4acd Refactor: better handle how default options are applied 2021-09-03 18:04:48 +06:00
shadmansaleh b3c5c4403c feat: add new filesize component 2021-09-03 16:16:10 +06:00
shadmansaleh ba1efb2a00 Remove deprecated feature: string color option bering treated as fg 2021-08-30 06:35:06 -07:00
shadmansaleh 1439ba6d37 perf: Improve startup by droping most of the requires + refactors
Important: It's no longer guaranteed that if component/extension
of same name exists in multiple entries in rtp which one will be
loaded. The guarantee is still there for themes . Means other
plugins or users config can overwrite a lualines internal theme
with same file name . I'm droping the guarantee for components
and extensions because there isn't much usecase for it . It's simple
to have a unique name and droping that guarantee allows more
optimizations that speeds up lualine.
2021-08-30 17:54:23 +06:00
shadmansaleh 2b90200998 enahce: sync diff&branch component to buffer based of bufnr instead of BufEnter 2021-08-30 12:18:08 +06:00
shadmansaleh 0a032cf43e fix: Properly disable internal diff when source is given 2021-08-30 12:03:07 +06:00
shadmansaleh 276ba5d19e feat: Support indexing dictionaries in var components 2021-08-28 00:32:44 +06:00
shadmansaleh 2348eaea2f enhace: Use nvim_call_function instead of vim.fn so vim.fn does not get populated 2021-08-28 00:13:50 +06:00
shadmansaleh fa1f001207 fix: branch assumes git file will be correctly formated 2021-08-26 17:09:18 +06:00
shadmansaleh 1cbf0686b4 fix: branch incorrectly assumes .git/ without .git/HEAD to be valid
fixes high cpu uses on windows in projects with empty .git folder.
2021-08-26 17:09:18 +06:00
shadmansaleh c9c5e3f9d1 feat: Add type option to hint what type of component is the string
String values for component are way too overloaded . This means lualine
has to make lots of checks to understand how to load a string value
as a component . With type option users can specify exactly what they
want.
2021-08-22 13:54:05 +06:00
shadmansaleh 33defeffb5 feat: Allow function as diagnostics source 2021-08-17 00:17:56 +06:00
shadmansaleh d360039969 fix(filename): include window_width to space estimation & expose
shorting_target option

setting shorting target to 0 disables path shorting
closes #8

Co-authored-by: NullVoxPopuli <LPSego3+dev@gmail.com>
2021-08-14 21:24:48 +06:00
shadmansaleh 0f3ad7e248 fix: Branch stuck in infinite loop in windows
Solution: Using poll-watch instead of event-watch on windows.
Additionally now gitdir paths are cached as optimization

Special thanks to @Shatur for raising the issue and for testing patches.
closes #2
2021-08-09 22:44:38 +06:00
shadmansaleh edb8c344f7 Fix: branch and diff disappearing with diagnostics.goto_next())
I've added a workaround to re sync those components when they
go out of sync . Until upstream issue is addressed this should
prevent this issue from occurring in lualine.
2021-08-09 15:11:50 +06:00
shadmansaleh f68d81d351 [Deprection] Enhance: Provide an uniform interface for color options
- Now all color related options and themes color definition have same
  semantics. They can either be a table containing values like bg,fg,gui
  or a string. When it's a string it's treated as a highlight group name
  and newly created group is linked to that group.
- Using string values to define foreground colors in options like
  color_error/color_added in diagnostics and diff component has been
  deprecated.
- Added a decent way of notifying affected users of deprecations and
  breaking changes.
2021-08-09 14:03:12 +06:00
shadmansaleh fac96d71cc [Breaking] Refactor: switch to %{%expr%} from %!expr
Huge change to internal mechanics.
- Now %{%expr%} blocks are used for evaluating statusline instead of
  %!expr . Pros for this is statusline is evaluated on current win and
  buf context instead of active win & bufs context.
- Now all components branch & diff(These two are cached) including users
  function components updates on inactive status.
  - now components update status and function components receive an
    argument (is_focused) when called. It indicates whether it's running
    for active or inactive statusline.
- Now lualine no longer aggrasively takes over 'statusline' option.
  instead it sets the global version of statusline option. So it's
  possible to unset it to hide lualine . Or set buffer local version
  of that option to have different statusline then lualine on thay
  buffer
- Switch vim.o to vim.go or vim.opt.
- BugFix autcommands being set everytime an instence of diff or branch
  component is created
- Added new utils functions define_autocmd & is_focused
- Remove utils function lualine_eval
- Removed hacky require cache modification from component.lua
2021-08-08 22:50:17 +06:00
shadmansaleh cb5c4c031e Refactor: async jobs and diff component
- Use neovims job api instead of uv.spawn (Probably a bit less
  performent but should be more stable)
- Fix async jobs leaking pipes
- Fix wrong diff counts .Used to occur because job might not be dead
  after closing it . And that still alive job may send data over stdout
  corrupting the cache.
- lots of variable renames in diff.
- utils/async.lua has been replaced by utils/job.lua
2021-08-08 14:47:20 +06:00
shadmansaleh ea2432cc1e feat: Add source option to diff
It allows you to easily integrate external source for diff count.
If user has some other plugin keeping track of diff counts. There's
no reason for lualine to make same calculations again . It can just
reuse them. But lualine knows nothing about how other plugin exposes
their api so user will have to glue them together with this option.
2021-08-03 17:41:37 +06:00
shadmansaleh e7b8b42089 Fix: Branch not working on directory with whilespace 2021-08-03 15:28:05 +06:00
shadmansaleh ac9a9e0a8b fix: Possible fix to diff sometimws not apearing 2021-08-03 12:19:12 +06:00
shadmansaleh 51daaf6f5a fix: Fixes bug diff somtimes doubled 2021-08-03 09:56:07 +06:00
shadmansaleh 486be4462f Remove new_async():send() pattern + restructure augroup
This does not load load lualine asyncronasly rather fools the profilers
In addition causes issues like intro disapearing
2021-08-02 21:16:17 +06:00
shadmansaleh f60bec0969 feat: Add update_in_insert option to diagnostics component 2021-07-25 13:48:50 +06:00
shadmansaleh c57cb43c4d feat:Add component evaluation for inactive sections 2021-07-25 12:52:52 +06:00
shadmansaleh 1d40e34aef Refactor: filetype icon and add disable_text option 2021-07-25 12:39:20 +06:00
Tim Bedard 2aaf434094
feat: add separate hint diagnostic (#241)
* add separate hint diagnostic

* change to lightbulb icon
2021-05-25 22:13:43 +02:00
shadmansaleh a560209c24 Refractor filetype and add disable_text option 2021-05-21 11:23:09 +06:00
shadmansaleh ef47235330 Add component evaluation for inactive sections 2021-05-21 11:11:25 +06:00
Hubert Pelczarski 3702e682ac
refactor: remove filename warning (#228) 2021-05-18 17:13:13 +02:00
Hubert Pelczarski 292609e3ad
docs: vimscript removal prep (#243) 2021-05-13 23:19:11 +02:00
JL Bas 1ee99e0473
enhancement: show diff when component is loaded (#234) 2021-05-13 12:24:51 +02:00
Shadman 33aaabe672
Fix filename error message (#237) 2021-05-12 15:27:37 +06:00
Jonathan Gin bfae320155
feat: color filetype icons when using nvim-devicons (#222) 2021-05-11 14:55:18 +02:00
Hubert Pelczarski 73a6c8fadf
feat: dynamic shortening for filetype (#224)
* feat: dynamic shortening for filetype

* feat: redraw statusline on VimResized

Co-authored-by: NullVoxPopuli <LPSego3+dev@gmail.com>
Co-authored-by: shadmansaleh <shadmansaleh3@gmail.com>
2021-05-11 12:47:09 +02:00
Hubert Pelczarski 82826ef661
refactor: moved loading to new module (#182)
* refactor: moved loading to new module
* refactor: check_single_separator
* refactor: simplified separator fixing
* refactor: tests/ -> lua/tests/
* refactor: moved to nvim_err_writeln for errors

* feat: moved config parsing to config.lua
* feat: get config directly from config module
* feat: added load_all function

* tests: config parsing tests

* added assert to luacheck globals
2021-05-09 23:11:18 +02:00
Folke Lemaitre c8b96850c9
fix: try LspDiagnostics colors first before fallling back to Diff colors (#216) 2021-05-07 13:03:11 +02:00
Shadman 2f17e432ee
fix: typo functon -> function (#191) 2021-04-22 21:09:34 +02:00
Tim Bedard e6cc09c2e9
feat(filename): add support for custom filename symbols (modified, readonly) (#185)
* feat(filename): add support for custom filename symbols (modified, readonly)

* update docs
2021-04-20 22:25:25 +06:00
Tim Bedard 96938c5db2
style: Spell fix instence -> instance (#184) 2021-04-20 09:02:21 +06:00
Shadman 2a222d7ad6
Better fix to nil on vimfunc (#178) 2021-04-14 18:25:34 +06:00