diff options
Diffstat (limited to 'nvim/lua')
-rw-r--r-- | nvim/lua/feline_style.lua | 287 | ||||
-rw-r--r-- | nvim/lua/git.lua | 39 | ||||
-rw-r--r-- | nvim/lua/lsp_conf.lua | 5 | ||||
-rw-r--r-- | nvim/lua/lualine_style.lua | 7 |
4 files changed, 17 insertions, 321 deletions
diff --git a/nvim/lua/feline_style.lua b/nvim/lua/feline_style.lua deleted file mode 100644 index 9dba06a..0000000 --- a/nvim/lua/feline_style.lua +++ /dev/null @@ -1,287 +0,0 @@ -if not pcall(require, "feline") then - return -end - -local colors = { - bg = '#282c34', - fg = '#abb2bf', - yellow = '#e0af68', - cyan = '#56b6c2', - darkblue = '#081633', - green = '#98c379', - orange = '#d19a66', - violet = '#a9a1e1', - magenta = '#c678dd', - blue = '#61afef', - red = '#e86671' -} - -local vi_mode_colors = { - NORMAL = colors.green, - INSERT = colors.red, - VISUAL = colors.magenta, - OP = colors.green, - BLOCK = colors.blue, - REPLACE = colors.violet, - ['V-REPLACE'] = colors.violet, - ENTER = colors.cyan, - MORE = colors.cyan, - SELECT = colors.orange, - COMMAND = colors.green, - SHELL = colors.green, - TERM = colors.green, - NONE = colors.yellow -} - -local function file_osinfo() - local os = vim.bo.fileformat:upper() - local icon - if os == 'UNIX' then - icon = ' ' - elseif os == 'MAC' then - icon = ' ' - else - icon = ' ' - end - return icon .. os -end - -local lsp = require 'feline.providers.lsp' -local vi_mode_utils = require 'feline.providers.vi_mode' - -local lsp_get_diag = function(str) - local count = vim.lsp.diagnostic.get_count(0, str) - return (count > 0) and ' '..count..' ' or '' -end - --- LuaFormatter off - -local comps = { - vi_mode = { - left = { - provider = function() - return vi_mode_utils.get_vim_mode() - end, - hl = function() - local val = { - name = vi_mode_utils.get_mode_highlight_name(), - fg = vi_mode_utils.get_mode_color(), - -- fg = colors.bg - } - return val - end, - right_sep = ' ' - }, - }, - file = { - info = { - provider = 'file_info', - file_modified_icon = '', - hl = { - fg = colors.blue, - style = 'bold' - } - }, - encoding = { - provider = 'file_encoding', - left_sep = ' ', - hl = { - fg = colors.violet, - style = 'bold' - } - }, - type = { - provider = 'file_type' - }, - -- os = { - -- provider = file_osinfo, - -- left_sep = ' ', - -- hl = { - -- fg = colors.violet, - -- style = 'bold' - -- } - -- }, - position = { - provider = 'position', - left_sep = ' ', - hl = { - fg = colors.cyan, - -- style = 'bold' - } - }, - }, - left_end = { - provider = function() return '' end, - hl = { - fg = colors.bg, - bg = colors.blue, - } - }, - line_percentage = { - provider = 'line_percentage', - left_sep = ' ', - hl = { - style = 'bold' - } - }, - -- scroll_bar = { - -- provider = 'scroll_bar', - -- left_sep = ' ', - -- hl = { - -- fg = colors.blue, - -- style = 'bold' - -- } - -- }, - diagnos = { - err = { - -- provider = 'diagnostic_errors', - provider = function() - return '' .. lsp_get_diag("Error") - end, - -- left_sep = ' ', - enabled = function() return lsp.diagnostics_exist('Error') end, - hl = { - fg = colors.red - } - }, - warn = { - -- provider = 'diagnostic_warnings', - provider = function() - return '' .. lsp_get_diag("Warning") - end, - -- left_sep = ' ', - enabled = function() return lsp.diagnostics_exist('Warning') end, - hl = { - fg = colors.yellow - } - }, - info = { - -- provider = 'diagnostic_info', - provider = function() - return '' .. lsp_get_diag("Information") - end, - -- left_sep = ' ', - enabled = function() return lsp.diagnostics_exist('Information') end, - hl = { - fg = colors.blue - } - }, - hint = { - -- provider = 'diagnostic_hints', - provider = function() - return '' .. lsp_get_diag("Hint") - end, - -- left_sep = ' ', - enabled = function() return lsp.diagnostics_exist('Hint') end, - hl = { - fg = colors.cyan - } - }, - }, - lsp = { - name = { - provider = 'lsp_client_names', - -- left_sep = ' ', - right_sep = ' ', - icon = ' ', - hl = { - fg = colors.yellow - } - } - }, - git = { - branch = { - provider = 'git_branch', - icon = ' ', - left_sep = ' ', - hl = { - fg = colors.violet, - style = 'bold' - }, - }, - add = { - provider = 'git_diff_added', - hl = { - fg = colors.green - } - }, - change = { - provider = 'git_diff_changed', - icon = ' ', - hl = { - fg = colors.orange - } - }, - remove = { - provider = 'git_diff_removed', - hl = { - fg = colors.red - } - } - } -} - -local components = { - active = {}, - inactive = {}, -} - -table.insert(components.active, {}) -table.insert(components.active, {}) -table.insert(components.active, {}) -table.insert(components.inactive, {}) -table.insert(components.inactive, {}) - -table.insert(components.active[1], comps.vi_mode.left) -table.insert(components.active[1], comps.file.info) -table.insert(components.active[1], comps.git.branch) -table.insert(components.active[1], comps.git.add) -table.insert(components.active[1], comps.git.change) -table.insert(components.active[1], comps.git.remove) -table.insert(components.inactive[1], comps.vi_mode.left) -table.insert(components.inactive[1], comps.file.info) -table.insert(components.active[3], comps.diagnos.err) -table.insert(components.active[3], comps.diagnos.warn) -table.insert(components.active[3], comps.diagnos.hint) -table.insert(components.active[3], comps.diagnos.info) -table.insert(components.active[3], comps.lsp.name) -table.insert(components.active[3], comps.file.os) -table.insert(components.active[3], comps.file.position) -table.insert(components.active[3], comps.line_percentage) -table.insert(components.active[3], comps.scroll_bar) -table.insert(components.active[3], comps.vi_mode.right) - - --- TreeSitter --- local ts_utils = require("nvim-treesitter.ts_utils") --- local ts_parsers = require("nvim-treesitter.parsers") --- local ts_queries = require("nvim-treesitter.query") ---[[ table.insert(components.active[2], { - provider = function() - local node = require("nvim-treesitter.ts_utils").get_node_at_cursor() - return ("%d:%s [%d, %d] - [%d, %d]") - :format(node:symbol(), node:type(), node:range()) - end, - enabled = function() - local ok, ts_parsers = pcall(require, "nvim-treesitter.parsers") - return ok and ts_parsers.has_parser() - end -}) ]] - --- require'feline'.setup {} -require'feline'.setup { - colors = { bg = colors.bg, fg = colors.fg }, - components = components, - vi_mode_colors = vi_mode_colors, - force_inactive = { - filetypes = { - 'packer', - 'NvimTree', - 'fugitive', - 'fugitiveblame' - }, - buftypes = {'terminal'}, - bufnames = {} - } -} - diff --git a/nvim/lua/git.lua b/nvim/lua/git.lua index bc9ea8f..2f9cbc4 100644 --- a/nvim/lua/git.lua +++ b/nvim/lua/git.lua @@ -1,15 +1,11 @@ require('gitsigns').setup { signs = { - add = {hl = 'GitSignsAdd' , text = '+', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '-', numhl='GitSignsDele.setup()teNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '-', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = true, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` keymaps = { -- Default keymap options noremap = true, @@ -24,33 +20,10 @@ require('gitsigns').setup { ['n hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', ['n hB'] = '<cmd>lua require"gitsigns".blame_line(true)<CR>', }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = true, -- Toggle with `:Gitsigns toggle_numhl` watch_gitdir = { interval = 1000, follow_files = true }, - attach_to_untracked = true, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - }, - current_line_blame_formatter_opts = { - relative_time = false - }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = 'single', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - yadm = { - enable = false - }, } diff --git a/nvim/lua/lsp_conf.lua b/nvim/lua/lsp_conf.lua index 1609eac..e339a5c 100644 --- a/nvim/lua/lsp_conf.lua +++ b/nvim/lua/lsp_conf.lua @@ -4,7 +4,7 @@ local null_ls = require("null-ls") local trouble = require("trouble") -- Redefine sign. -local signs = { Error = ' ', Warning = ' ', Hint = ' ', Information = ' ' } +local signs = { Error = 'E', Warning = 'W', Hint = 'H', Information = 'I' } for type, icon in pairs(signs) do local hl = 'LspDiagnosticsSign' .. type @@ -42,6 +42,8 @@ for _, lsp in ipairs(servers) do on_attach = function(client, bufnr) client.resolved_capabilities.document_formatting = false + require "lsp_signature".on_attach() + -- Mappings. local opts = { noremap=true, silent=true } @@ -61,6 +63,7 @@ end nvim_lsp["null-ls"].setup({ on_attach = function(client) if client.resolved_capabilities.document_formatting then + buf_set_keymap('n', '<A-f>', '<cmd>lua vim.lsp.buf.formatting_sync()<cr>', opts) vim.cmd "autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()" end end diff --git a/nvim/lua/lualine_style.lua b/nvim/lua/lualine_style.lua new file mode 100644 index 0000000..bb7738b --- /dev/null +++ b/nvim/lua/lualine_style.lua @@ -0,0 +1,7 @@ +require'lualine'.setup{ + options = { + theme = 'powerline', + section_separators = { left = '', right = ''}, + component_separators = { left = '|', right = '|'}, + }, +} |