Skip to content

Commit

Permalink
lualine back
Browse files Browse the repository at this point in the history
  • Loading branch information
aceforeverd committed Jun 17, 2023
1 parent b7ff68e commit ec29d56
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 14 deletions.
3 changes: 3 additions & 0 deletions autoload/aceforeverd/plugin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ function! s:config_plugins()
" vim-sandwich
nnoremap ss s
" csv.vim
let g:csv_no_conceal = 1

endfunction

function! s:auto_pair() abort
Expand Down
2 changes: 2 additions & 0 deletions autoload/aceforeverd/settings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ function! aceforeverd#settings#my_init() abort
" or u can set 'netrw' to use netrw with vim-vinegar enhancements
let g:my_dir_viewer = get(g:, 'my_dir_viewer', 'dirvish')

let g:my_statusline = get(g:, 'my_statusline', 'feline')

let g:my_name = get(g:, 'my_name', 'Ace')
let g:my_email = get(g:, 'my_email', 'teapot@aceforeverd.com')
endfunction
Expand Down
13 changes: 6 additions & 7 deletions lua/aceforeverd/apperance/feline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ local fn = vim.fn

local icons = { UNIX = '', MAC = '', WINDOWS = '' }

local palette = vim.api.nvim_call_function('sonokai#get_palette', { vim.g.sonokai_style, { nothing = '' } })

local bit_green = palette.bg_green[1]
local bit_blue = palette.bg_blue[1]
local bit_yellow = '#e5c463'
local bit_red = palette.bg_red[1]
local palette = require('aceforeverd.apperance.helper')
local bit_green = palette.bit_green
local bit_blue = palette.bit_blue
local bit_yellow = palette.bit_yellow
local bit_red = palette.bit_red

-- TODO: add some short_provider & icon

Expand Down Expand Up @@ -175,7 +174,7 @@ local feline_config = {
short = true,
},
},
enabled = function ()
enabled = function()
-- otherwise it will appear in winbar
return vim.fn.exists('+winbar') == 0
end,
Expand Down
9 changes: 9 additions & 0 deletions lua/aceforeverd/apperance/helper.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
local palette = vim.api.nvim_call_function('sonokai#get_palette', { vim.g.sonokai_style, { nothing = '' } })

return {
bit_green = palette.bg_green[1],
bit_blue = palette.bg_blue[1],
bit_yellow = palette.yellow[0] or '#e5c463',
bit_red = palette.bg_red[1],
orange = palette.orange[1],
}
3 changes: 3 additions & 0 deletions lua/aceforeverd/apperance/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ function M.bufferline()
set_map('n', '<M-9>', '<Cmd>BufferLineGoToBuffer 9<CR>', map_opt)
end

M.feline = function() require('aceforeverd.apperance.feline').setup() end
M.lualine = require('aceforeverd.apperance.lualine').setup

return M
100 changes: 100 additions & 0 deletions lua/aceforeverd/apperance/lualine.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
-- Copyright (C) 2021 Ace <teapot@aceforeverd.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

local M = {}

local palette = require('aceforeverd.apperance.helper')
local bit_green = palette.bit_green
local bit_blue = palette.bit_blue
local bit_yellow = palette.bit_yellow
local bit_red = palette.bit_red
local orange = palette.orange

local function gen_winbar_cfg()
if vim.fn.exists('+winbar') ~= 0 then
return {
lualine_a = {
{
'filename',
path = 1, --[[ relative path ]]
},
},
lualine_b = {
{
require('aceforeverd.utility.statusline').ctx_location,
on_click = function(num_click, mounse, modifiers)
require('nvim-navbuddy').open()
end,
color = { fg = orange }
},
},
lualine_z = { 'datetime' },
}
end

return {}
end

local function lsp_status()
return require('lsp-status').status()
end

function M.setup()
require('lualine').setup({
options = {
theme = 'palenight',
global_status = true,
section_separators = { left = '', right = '' },
component_separators = { left = '|', right = '|' },
},
sections = {
lualine_a = { 'mode' },
lualine_b = {
'branch' ,
'diff' ,
'diagnostics' ,
},
lualine_c = {
{ require('aceforeverd.utility.statusline').lsp_client_names, icon = { '' }, color = { fg = '#FF9000' } },
{ lsp_status, color = { fg = '#E1E120' } },
},
lualine_x = {
{
require('aceforeverd.utility.statusline').ctx_location,
cond = function()
-- otherwise it will appear in winbar
return vim.fn.exists('+winbar') == 0
end,
color = { fg = '#fda5b4' },
},
'filetype',
{ require('aceforeverd.utility.statusline').indent },
{
'vim.bo.spelllang',
cond = function()
return vim.wo.spell == true
end,
},
'encoding',
},
lualine_y = { 'fileformat', 'location' },
lualine_z = { 'filesize', 'progress' },
},
winbar = gen_winbar_cfg(),
extensions = { 'quickfix', 'fugitive', 'lazy', 'fzf' },
})
end

return M
13 changes: 12 additions & 1 deletion lua/aceforeverd/config/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function M.setup()
vim.g.loaded_endwise = 1
vim.g.loaded_tagalong = 1

local hi_disable_fts = { 'yaml', 'coc-explorer' }
require('nvim-treesitter.configs').setup({
ensure_installed = 'all',
ignore_install = {
Expand All @@ -26,7 +27,17 @@ function M.setup()
},
highlight = {
enable = true,
disable = { 'yaml', 'coc-explorer' },
disable = function(lang, buf)
if vim.tbl_contains(hi_disable_fts, lang) then
return true
end
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
return false
end,
},
indent = { enable = true, disable = { 'yaml' } },
incremental_selection = {
Expand Down
4 changes: 4 additions & 0 deletions lua/aceforeverd/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function M.setup()
vim.o.fillchars = [[foldopen:▼,foldclose:⏵]]

require('aceforeverd.plugins').setup()

-- keymap guideline
-- <space>xxx -> view-only operators
-- <leader>xxx -> possibly write operators
end

return M
43 changes: 37 additions & 6 deletions lua/aceforeverd/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ M.plugin_list = {
config = function()
require('colorizer').setup({})
end,
ft = {'css', 'html'},
},

{
Expand Down Expand Up @@ -331,9 +332,27 @@ M.plugin_list = {

{
'hkupty/iron.nvim',
init = function()
vim.g.iron_map_defaults = 0
vim.g.iron_map_extended = 0
config = function()
require('iron.core').setup({
config = {
-- Whether a repl should be discarded or not
scratch_repl = true,
-- Your repl definitions come here
repl_definition = {},
-- How the repl window will be displayed
-- See below for more information
repl_open_cmd = require('iron.view').bottom(40),
},
-- Iron doesn't set keymaps by default anymore.
-- You can set them here or manually add keymaps to the functions in iron.core
keymaps = {},
-- If the highlight is on, you can change how it looks
-- For the available options, check nvim_set_hl
highlight = {
italic = true,
},
ignore_blank_lines = true,
})
end,
},

Expand Down Expand Up @@ -417,7 +436,6 @@ M.plugin_list = {

{
'ggandor/leap.nvim',
lazy = true,
},

{ 'projekt0n/github-nvim-theme' },
Expand Down Expand Up @@ -611,7 +629,7 @@ M.plugin_list = {
})
end,
keys = {
{ '<space>t', '<cmd>AerialToggle!<cr>', { desc = 'Toggle the aerial window.' } },
{ '<space>t', '<cmd>AerialToggle!<cr>', desc = 'Toggle the aerial window' },
},
},

Expand Down Expand Up @@ -683,8 +701,21 @@ M.plugin_list = {
{
'freddiehaddad/feline.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
cond = function()
return vim.g.my_statusline == 'feline'
end,
config = function()
require('aceforeverd.apperance').feline()
end,
},
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
cond = function()
return vim.g.my_statusline == 'lualine'
end,
config = function()
require('aceforeverd.apperance.feline').setup()
require('aceforeverd.apperance').lualine()
end,
},
{
Expand Down

0 comments on commit ec29d56

Please sign in to comment.