diff options
| -rw-r--r-- | init.lua | 1 | ||||
| -rw-r--r-- | lua/user/lsp/null-ls.lua | 22 | ||||
| -rw-r--r-- | lua/user/lualine.lua | 93 | ||||
| -rw-r--r-- | lua/user/plugins.lua | 5 |
4 files changed, 106 insertions, 15 deletions
@@ -11,3 +11,4 @@ require "user.comment" require "user.gitsigns" require "user.nvim-tree" require "user.bufferline" +require "user.lualine" diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua index ec79994..b261418 100644 --- a/lua/user/lsp/null-ls.lua +++ b/lua/user/lsp/null-ls.lua @@ -1,20 +1,18 @@ local null_ls_status_ok, null_ls = pcall(require, "null-ls") if not null_ls_status_ok then - return -end + return -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting local formatting = null_ls.builtins.formatting -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics local diagnostics = null_ls.builtins.diagnostics -null_ls.setup { - debug = false, - sources = { - formatting.prettier.with { extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }, - formatting.black.with { extra_args = { "--fast" } }, - -- formatting.yapf, - formatting.stylua, - diagnostics.flake8, - }, -} +null_ls.setup({ + debug = false, + sources = { + formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), + formatting.black.with({ extra_args = { "--fast" } }), + formatting.stylua, + diagnostics.flake8 + }, +}) diff --git a/lua/user/lualine.lua b/lua/user/lualine.lua new file mode 100644 index 0000000..50484cb --- /dev/null +++ b/lua/user/lualine.lua @@ -0,0 +1,93 @@ +local status_ok, lualine = pcall(require, "lualine") +if not status_ok then + return +end + +local hide_in_width = function() + return vim.fn.winwidth(0) > 80 +end + +local diagnostics = { + "diagnostics", + sources = { "nvim_diagnostic" }, + sections = { "error", "warn" }, + symbols = { error = " ", warn = " " }, + colored = false, + update_in_insert = false, + always_visible = true, +} + +local diff = { + "diff", + colored = false, + symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols + cond = hide_in_width +} + +local mode = { + "mode", + fmt = function(str) + return "-- " .. str .. " --" + end, +} + +local filetype = { + "filetype", + icons_enabled = false, + icon = nil, +} + +local branch = { + "branch", + icons_enabled = true, + icon = "", +} + +local location = { + "location", + 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] +end + +local spaces = function() + return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") +end + +lualine.setup({ + options = { + icons_enabled = true, + theme = "auto", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { "dashboard", "NvimTree", "Outline" }, + always_divide_middle = true, + }, + sections = { + lualine_a = { branch, diagnostics }, + lualine_b = { mode }, + lualine_c = {}, + -- lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_x = { diff, spaces, "encoding", filetype }, + lualine_y = { location }, + lualine_z = { progress }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = {}, +}) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 5893e92..dcb353d 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -50,6 +50,7 @@ return packer.startup(function(use) use "kyazdani42/nvim-tree.lua" use "akinsho/bufferline.nvim" use "moll/vim-bbye" + use 'nvim-lualine/lualine.nvim' use 'kyazdani42/nvim-web-devicons' use 'kyazdani42/nvim-tree.lua' @@ -73,10 +74,8 @@ return packer.startup(function(use) -- LSP use "neovim/nvim-lspconfig" -- enable LSP use "williamboman/nvim-lsp-installer" -- simple to use language server installer -<<<<<<< HEAD + use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters -======= ->>>>>>> vgg -- Telescope use "nvim-telescope/telescope.nvim" |
