From 98658d1c8c37bda40565444a0eeebb1786f1feb2 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Tue, 10 Jan 2023 10:21:09 -0800 Subject: [PATCH] add and apply stylua --- .stylua.toml | 4 + init.lua | 14 +- lua/cmds.lua | 3 +- lua/commands.lua | 14 +- lua/configs/alpha.lua | 25 ++- lua/configs/autopairs.lua | 27 ++- lua/configs/bufferline.lua | 39 ++-- lua/configs/cmp.lua | 109 ++++++----- lua/configs/colorizer.lua | 21 +-- lua/configs/comment.lua | 27 ++- lua/configs/git-blame.lua | 6 +- lua/configs/gitsigns.lua | 36 ++-- lua/configs/icons.lua | 183 +++++++++--------- lua/configs/illuminate.lua | 27 ++- lua/configs/indent-blankline.lua | 17 +- lua/configs/lspconfig.lua | 203 +++++++++----------- lua/configs/lspsaga.lua | 51 +++-- lua/configs/lualine.lua | 86 ++++----- lua/configs/null-ls.lua | 83 +++++---- lua/configs/nvim-tree.lua | 55 +++--- lua/configs/session-manager.lua | 19 +- lua/configs/telescope.lua | 88 ++++----- lua/configs/treesitter-context.lua | 8 +- lua/configs/treesitter.lua | 9 +- lua/highlights.lua | 3 +- lua/keybinds.lua | 90 ++++----- lua/plugins.lua | 287 ++++++++++++++++++----------- lua/settings.lua | 8 +- 28 files changed, 786 insertions(+), 756 deletions(-) create mode 100644 .stylua.toml diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..7e75525 --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,4 @@ +indent_type = "Tabs" +indent_width = 4 +quote_style = "AutoPreferSingle" +call_parentheses = "Always" diff --git a/init.lua b/init.lua index 9844ac6..68495f5 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,6 @@ - -require('plugins') -require('settings') -require('keybinds') -require('commands') -require('cmds') -require('highlights') - +require("plugins") +require("settings") +require("keybinds") +require("commands") +require("cmds") +require("highlights") diff --git a/lua/cmds.lua b/lua/cmds.lua index 8b7b2e1..c182019 100644 --- a/lua/cmds.lua +++ b/lua/cmds.lua @@ -1,3 +1,2 @@ -- Set colorscheme -vim.cmd [[ colorscheme darkplus ]] - +vim.cmd([[ colorscheme darkplus ]]) diff --git a/lua/commands.lua b/lua/commands.lua index 5876046..6090c1c 100644 --- a/lua/commands.lua +++ b/lua/commands.lua @@ -5,13 +5,13 @@ vim.api.nvim_create_user_command('Black', 'call Black()', {}) vim.api.nvim_create_user_command('IPDB', 'norm oimport ipdb; ipdb.set_trace() # fmt:skip', {}) local function gitblame_toggle_summary() - local normal = '' - local with_summary = '' - if vim.g.gitblame_message_template == normal then - vim.g.gitblame_message_template = with_summary - else - vim.g.gitblame_message_template = normal - end + local normal = '' + local with_summary = '' + if vim.g.gitblame_message_template == normal then + vim.g.gitblame_message_template = with_summary + else + vim.g.gitblame_message_template = normal + end end vim.api.nvim_create_user_command('GitBlameToggleSummary', gitblame_toggle_summary, {}) diff --git a/lua/configs/alpha.lua b/lua/configs/alpha.lua index 53d0c7c..f2c3f9a 100644 --- a/lua/configs/alpha.lua +++ b/lua/configs/alpha.lua @@ -1,25 +1,24 @@ local M = {} function M.config() - local status_ok, alpha = pcall(require, "alpha") + local status_ok, alpha = pcall(require, 'alpha') if not status_ok then return end - local dashboard = require'alpha.themes.dashboard' + local dashboard = require('alpha.themes.dashboard') - dashboard.section.header.val = { "NeoVim", } - dashboard.section.buttons.val = { - dashboard.button("f", "Find File", ":Telescope find_files"), - dashboard.button("w", "Find Word", ":Telescope live_grep"), - dashboard.button("o", "Recent Files", ":Telescope oldfiles"), - dashboard.button("e", "Open Tree", ":NvimTreeToggle"), - dashboard.button("s", "Load Session", ":SessionManager load_current_dir_session"), - dashboard.button("q", "Quit", ":qa"), - } + dashboard.section.header.val = { 'NeoVim' } + dashboard.section.buttons.val = { + dashboard.button('f', 'Find File', ':Telescope find_files'), + dashboard.button('w', 'Find Word', ':Telescope live_grep'), + dashboard.button('o', 'Recent Files', ':Telescope oldfiles'), + dashboard.button('e', 'Open Tree', ':NvimTreeToggle'), + dashboard.button('s', 'Load Session', ':SessionManager load_current_dir_session'), + dashboard.button('q', 'Quit', ':qa'), + } - alpha.setup(dashboard.config) + alpha.setup(dashboard.config) end return M - diff --git a/lua/configs/autopairs.lua b/lua/configs/autopairs.lua index 9ee75ed..19e48fe 100644 --- a/lua/configs/autopairs.lua +++ b/lua/configs/autopairs.lua @@ -1,31 +1,31 @@ local M = {} function M.config() - local status_ok, npairs = pcall(require, "nvim-autopairs") + local status_ok, npairs = pcall(require, 'nvim-autopairs') if not status_ok then return end - npairs.setup { + npairs.setup({ check_ts = true, ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, + lua = { 'string', 'source' }, + javascript = { 'string', 'template_string' }, java = false, }, - disable_filetype = { "TelescopePrompt", "spectre_panel" }, + disable_filetype = { 'TelescopePrompt', 'spectre_panel' }, fast_wrap = { - map = "", - chars = { "{", "[", "(", '"', "'" }, - pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + map = '', + chars = { '{', '[', '(', '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''), offset = 0, - end_key = "$", - keys = "qwertyuiopzxcvbnmasdfghjkl", + end_key = '$', + keys = 'qwertyuiopzxcvbnmasdfghjkl', check_comma = true, - highlight = "PmenuSel", - highlight_grey = "LineNr", + highlight = 'PmenuSel', + highlight_grey = 'LineNr', }, - } + }) --Rule = require "nvim-autopairs.rule" -- local cmp_autopairs = require "nvim-autopairs.completion.cmp" @@ -37,4 +37,3 @@ function M.config() end return M - diff --git a/lua/configs/bufferline.lua b/lua/configs/bufferline.lua index 47a77fe..475519a 100644 --- a/lua/configs/bufferline.lua +++ b/lua/configs/bufferline.lua @@ -1,8 +1,8 @@ local M = {} function M.config() - local status_ok, bufferline = pcall(require, "bufferline") - if not status_ok then + local status_ok, bufferline = pcall(require, 'bufferline') + if not status_ok then return end @@ -21,35 +21,35 @@ function M.config() none = 'NONE', } - bufferline.setup { + bufferline.setup({ options = { - close_command = "Bdelete! %d", -- use vim-bbye - right_mouse_command = "Bdelete! %d", -- use vim-bbye + close_command = 'Bdelete! %d', -- use vim-bbye + right_mouse_command = 'Bdelete! %d', -- use vim-bbye offsets = { { - filetype = "NvimTree", - text = "", - padding = 1 - } + filetype = 'NvimTree', + text = '', + padding = 1, + }, }, indicator = { icon = '▎', - style = 'icon' + style = 'icon', }, - modified_icon = "", + modified_icon = '', --buffer_close_icon = "", show_buffer_close_icons = false, --close_icon = "", show_close_icon = false, - left_trunc_marker = "", - right_trunc_marker = "", + left_trunc_marker = '', + right_trunc_marker = '', tab_size = 12, -- minimum size max_name_length = 40, max_prefix_length = 13, show_tab_indicators = true, enforce_regular_tabs = false, - view = "multiwindow", - separator_style = "thick", + view = 'multiwindow', + separator_style = 'thick', always_show_bufferline = true, diagnostics = false, }, @@ -75,8 +75,8 @@ function M.config() bg = scolors.tab_visible_bg, }, - -- de-duplicate text - duplicate = { + -- de-duplicate text + duplicate = { fg = scolors.gray_fg, bg = scolors.tab_bg, --gui = colors.none, @@ -164,9 +164,8 @@ function M.config() fg = scolors.white_fg, bg = scolors.tab_visible_bg, }, - } - } + }, + }) end return M - diff --git a/lua/configs/cmp.lua b/lua/configs/cmp.lua index 4be0368..4056963 100644 --- a/lua/configs/cmp.lua +++ b/lua/configs/cmp.lua @@ -1,54 +1,54 @@ local M = {} function M.config() - local cmp_status_ok, cmp = pcall(require, "cmp") + local cmp_status_ok, cmp = pcall(require, 'cmp') if not cmp_status_ok then return end - local snip_status_ok, luasnip = pcall(require, "luasnip") + local snip_status_ok, luasnip = pcall(require, 'luasnip') if not snip_status_ok then return end local check_backspace = function() - local col = vim.fn.col "." - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" + local col = vim.fn.col('.') - 1 + return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') end local kind_icons = { - 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 = "", + 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 = '', } - cmp.setup { + cmp.setup({ formatting = { - fields = { "kind", "abbr", "menu" }, + fields = { 'kind', 'abbr', 'menu' }, format = function(_, vim_item) - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + vim_item.kind = string.format('%s', kind_icons[vim_item.kind]) return vim_item end, }, @@ -68,9 +68,9 @@ function M.config() behavior = cmp.ConfirmBehavior.Replace, select = false, }, - window = { - documentation = cmp.config.window.bordered(), - }, + window = { + documentation = cmp.config.window.bordered(), + }, -- documentation = { -- border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, -- }, @@ -82,24 +82,24 @@ function M.config() keyword_length = 1, }, sources = { - { name = "nvim_lsp" }, + { name = 'nvim_lsp' }, --{ name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, + { name = 'buffer' }, + { name = 'path' }, }, mapping = { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.config.disable, - [""] = cmp.mapping { + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping(cmp.mapping.scroll_docs(-1), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(1), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + [''] = cmp.config.disable, + [''] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close(), - }, - [""] = cmp.mapping.confirm { select = false }, - [""] = cmp.mapping(function(fallback) + }), + [''] = cmp.mapping.confirm({ select = false }), + [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expandable() then @@ -112,10 +112,10 @@ function M.config() fallback() end end, { - "i", - "s", + 'i', + 's', }), - [""] = cmp.mapping(function(fallback) + [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then @@ -124,12 +124,11 @@ function M.config() fallback() end end, { - "i", - "s", + 'i', + 's', }), }, - } + }) end return M - diff --git a/lua/configs/colorizer.lua b/lua/configs/colorizer.lua index a230c6c..77a7553 100644 --- a/lua/configs/colorizer.lua +++ b/lua/configs/colorizer.lua @@ -1,26 +1,25 @@ local M = {} function M.config() - local present, colorizer = pcall(require, "colorizer") + local present, colorizer = pcall(require, 'colorizer') if not present then return end colorizer.setup( - { "*" }, -- Highlight all files, but customize some others + { '*' }, -- Highlight all files, but customize some others { - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - names = false, -- "Name" codes like Blue + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = false, -- "Name" codes like Blue RRGGBBAA = false, -- #RRGGBBAA hex codes - rgb_fn = false, -- CSS rgb() and rgba() functions - hsl_fn = false, -- CSS hsl() and hsla() functions - css = false, -- Enable all css features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn - mode = "foreground", -- Set the display mode + rgb_fn = false, -- CSS rgb() and rgba() functions + hsl_fn = false, -- CSS hsl() and hsla() functions + css = false, -- Enable all css features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + mode = 'foreground', -- Set the display mode } ) end return M - diff --git a/lua/configs/comment.lua b/lua/configs/comment.lua index a183888..fb212cc 100644 --- a/lua/configs/comment.lua +++ b/lua/configs/comment.lua @@ -1,24 +1,23 @@ local M = {} function M.config() - local status_ok, comment = pcall(require, "Comment") + local status_ok, comment = pcall(require, 'Comment') if not status_ok then return end - comment.setup { - pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(), - padding = true, - sticky = true, - ignore = '^$', -- Don't comment empty lines - toggler = { - line = '/', - }, - opleader = { - line = '/', - }, - } + comment.setup({ + pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(), + padding = true, + sticky = true, + ignore = '^$', -- Don't comment empty lines + toggler = { + line = '/', + }, + opleader = { + line = '/', + }, + }) end return M - diff --git a/lua/configs/git-blame.lua b/lua/configs/git-blame.lua index 3d9939b..433df52 100644 --- a/lua/configs/git-blame.lua +++ b/lua/configs/git-blame.lua @@ -1,9 +1,9 @@ local M = {} function M.config() - vim.g.gitblame_display_virtual_text = 0 - vim.g.gitblame_message_template = '' - vim.g.gitblame_date_format = '%r' + vim.g.gitblame_display_virtual_text = 0 + vim.g.gitblame_message_template = '' + vim.g.gitblame_date_format = '%r' end return M diff --git a/lua/configs/gitsigns.lua b/lua/configs/gitsigns.lua index 49bc6d8..c854dc6 100644 --- a/lua/configs/gitsigns.lua +++ b/lua/configs/gitsigns.lua @@ -1,27 +1,27 @@ local M = {} function M.config() - local status_ok, gitsigns = pcall(require, "gitsigns") + local status_ok, gitsigns = pcall(require, 'gitsigns') if not status_ok then return end - gitsigns.setup { + gitsigns.setup({ signs = { - add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - delete = { 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", + hl = 'GitSignsDelete', + text = '契', + numhl = 'GitSignsDeleteNr', + linehl = 'GitSignsDeleteLn', }, changedelete = { - hl = "GitSignsChange", - text = "▎", - numhl = "GitSignsChangeNr", - linehl = "GitSignsChangeLn", + hl = 'GitSignsChange', + text = '▎', + numhl = 'GitSignsChangeNr', + linehl = 'GitSignsChangeLn', }, }, signcolumn = true, @@ -36,7 +36,7 @@ function M.config() current_line_blame = false, current_line_blame_opts = { virt_text = true, - virt_text_pos = "eol", + virt_text_pos = 'eol', delay = 1000, ignore_whitespace = false, }, @@ -48,16 +48,16 @@ function M.config() status_formatter = nil, max_file_length = 40000, preview_config = { - border = "single", - style = "minimal", - relative = "cursor", + border = 'single', + style = 'minimal', + relative = 'cursor', row = 0, col = 1, }, yadm = { enable = false, }, - } + }) end return M diff --git a/lua/configs/icons.lua b/lua/configs/icons.lua index b9c6870..668d2e3 100644 --- a/lua/configs/icons.lua +++ b/lua/configs/icons.lua @@ -1,192 +1,191 @@ local M = {} function M.config() - local status_ok, icons = pcall(require, "nvim-web-devicons") + local status_ok, icons = pcall(require, 'nvim-web-devicons') if not status_ok then return end local colors = { - c = "#519aba", - css = "#61afef", - deb = "#a1b7ee", - docker = "#384d54", - html = "#de8c92", - js = "#ebcb8b", - kt = "#7bc99c", - lock = "#c4c720", - lua = "#51a0cf", - mp3 = "#d39ede", - mp4 = "#9ea3de", - out = "#abb2bf", - py = "#a3b8ef", - robot = "#abb2bf", - toml = "#39bf39", - ts = "#519aba", - ttf = "#abb2bf", - rb = "#ff75a0", - rpm = "#fca2aa", - woff = "#abb2bf", - woff2 = "#abb2bf", - zip = "#f9d71c", - jsx = "#519ab8", - vue = "#7bc99c", - rs = "#dea584", - png = "#c882e7", - jpeg = "#c882e7", - jpg = "#c882e7", + c = '#519aba', + css = '#61afef', + deb = '#a1b7ee', + docker = '#384d54', + html = '#de8c92', + js = '#ebcb8b', + kt = '#7bc99c', + lock = '#c4c720', + lua = '#51a0cf', + mp3 = '#d39ede', + mp4 = '#9ea3de', + out = '#abb2bf', + py = '#a3b8ef', + robot = '#abb2bf', + toml = '#39bf39', + ts = '#519aba', + ttf = '#abb2bf', + rb = '#ff75a0', + rpm = '#fca2aa', + woff = '#abb2bf', + woff2 = '#abb2bf', + zip = '#f9d71c', + jsx = '#519ab8', + vue = '#7bc99c', + rs = '#dea584', + png = '#c882e7', + jpeg = '#c882e7', + jpg = '#c882e7', } - icons.setup { + icons.setup({ override = { c = { - icon = "", + icon = '', color = colors.c, - name = "c", + name = 'c', }, css = { - icon = "", + icon = '', color = colors.css, - name = "css", + name = 'css', }, deb = { - icon = "", + icon = '', color = colors.deb, - name = "deb", + name = 'deb', }, Dockerfile = { - icon = "", + icon = '', color = colors.docker, - name = "Dockerfile", + name = 'Dockerfile', }, html = { - icon = "", + icon = '', color = colors.html, - name = "html", + name = 'html', }, js = { - icon = "", + icon = '', color = colors.js, - name = "js", + name = 'js', }, kt = { - icon = "󱈙", + icon = '󱈙', color = colors.kt, - name = "kt", + name = 'kt', }, lock = { - icon = "", + icon = '', color = colors.lock, - name = "lock", + name = 'lock', }, lua = { - icon = "", + icon = '', color = colors.lua, - name = "lua", + name = 'lua', }, mp3 = { - icon = "", + icon = '', color = colors.mp3, - name = "mp3", + name = 'mp3', }, mp4 = { - icon = "", + icon = '', color = colors.mp4, - name = "mp4", + name = 'mp4', }, out = { - icon = "", + icon = '', color = colors.out, - name = "out", + name = 'out', }, py = { - icon = "", + icon = '', color = colors.py, - name = "py", + name = 'py', }, - ["robots.txt"] = { - icon = "ﮧ", + ['robots.txt'] = { + icon = 'ﮧ', color = colors.robot, - name = "robots", + name = 'robots', }, toml = { - icon = "", + icon = '', color = colors.toml, - name = "toml", + name = 'toml', }, ts = { - icon = "", + icon = '', color = colors.ts, - name = "ts", + name = 'ts', }, ttf = { - icon = "", + icon = '', color = colors.ttf, - name = "TrueTypeFont", + name = 'TrueTypeFont', }, rb = { - icon = "", + icon = '', color = colors.rb, - name = "rb", + name = 'rb', }, rpm = { - icon = "", + icon = '', color = colors.rpm, - name = "rpm", + name = 'rpm', }, vue = { - icon = "﵂", + icon = '﵂', color = colors.vue, - name = "vue", + name = 'vue', }, woff = { - icon = "", + icon = '', color = colors.woff, - name = "WebOpenFontFormat", + name = 'WebOpenFontFormat', }, woff2 = { - icon = "", + icon = '', color = colors.woff2, - name = "WebOpenFontFormat2", + name = 'WebOpenFontFormat2', }, xz = { - icon = "", + icon = '', color = colors.zip, - name = "xz", + name = 'xz', }, zip = { - icon = "", + icon = '', color = colors.zip, - name = "zip", + name = 'zip', }, jsx = { - icon = "ﰆ", + icon = 'ﰆ', color = colors.jsx, - name = "jsx", + name = 'jsx', }, rust = { - icon = "", + icon = '', color = colors.rs, - name = "rs", + name = 'rs', }, jpg = { - icon = "", + icon = '', color = colors.jpg, - name = "jpg", + name = 'jpg', }, png = { - icon = "", + icon = '', color = colors.png, - name = "png", + name = 'png', }, jpeg = { - icon = "", + icon = '', color = colors.jpeg, - name = "jpeg", + name = 'jpeg', }, - } - } + }, + }) end return M - diff --git a/lua/configs/illuminate.lua b/lua/configs/illuminate.lua index 772ec33..cf0489e 100644 --- a/lua/configs/illuminate.lua +++ b/lua/configs/illuminate.lua @@ -6,20 +6,19 @@ function M.config() return end - illuminate.configure({ - providers = { - 'lsp', - 'treesitter', - 'regex', - }, - delay = 200, - filetypes_denylist = { - 'alpha', - 'NvimTree', - 'TelescopePrompt', - }, - }) + illuminate.configure({ + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + delay = 200, + filetypes_denylist = { + 'alpha', + 'NvimTree', + 'TelescopePrompt', + }, + }) end return M - diff --git a/lua/configs/indent-blankline.lua b/lua/configs/indent-blankline.lua index 92026b1..c12aa2b 100644 --- a/lua/configs/indent-blankline.lua +++ b/lua/configs/indent-blankline.lua @@ -1,22 +1,21 @@ local M = {} function M.config() - local status_ok, indent_blankline = pcall(require, "indent_blankline") + local status_ok, indent_blankline = pcall(require, 'indent_blankline') if not status_ok then return end - -- vim.opt.list = true - -- vim.opt.listchars:append "space:⋅" - -- vim.opt.listchars:append "eol:↴" + -- vim.opt.list = true + -- vim.opt.listchars:append "space:⋅" + -- vim.opt.listchars:append "eol:↴" - indent_blankline.setup { + indent_blankline.setup({ show_current_context = false, show_current_context_start = false, - -- show_end_of_line = true, - -- space_char_blankline = " ", - } + -- show_end_of_line = true, + -- space_char_blankline = " ", + }) end return M - diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua index 2bf6203..518167c 100644 --- a/lua/configs/lspconfig.lua +++ b/lua/configs/lspconfig.lua @@ -2,14 +2,14 @@ local M = {} function M.config() local signs = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, + { name = 'DiagnosticSignError', text = '' }, + { name = 'DiagnosticSignWarn', text = '' }, + { name = 'DiagnosticSignHint', text = '' }, + { name = 'DiagnosticSignInfo', text = '' }, } for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) + vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = '' }) end local config = { @@ -22,141 +22,114 @@ function M.config() severity_sort = true, float = { focusable = false, - style = "minimal", - border = "rounded", - source = "always", - header = "", - prefix = "", + style = 'minimal', + border = 'rounded', + source = 'always', + header = '', + prefix = '', }, } vim.diagnostic.config(config) - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "rounded", + vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { + border = 'rounded', }) - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "rounded", + vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = 'rounded', }) - vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false, }) - local status_ok, lspconfig = pcall(require, "lspconfig") + local status_ok, lspconfig = pcall(require, 'lspconfig') if not status_ok then return end - -- Highlight under current selection - -- local function lsp_highlight_document(client) - -- if client.resolved_capabilities.document_highlight then - -- vim.api.nvim_exec( - -- [[ - -- augroup lsp_document_highlight - -- autocmd! * - -- autocmd CursorHold lua vim.lsp.buf.document_highlight() - -- autocmd CursorMoved lua vim.lsp.buf.clear_references() - -- augroup END - -- ]], - -- false - -- ) - -- end - -- end - local function lsp_keymaps(bufnr) local opts = { noremap = true, silent = true } - vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float({ source = false, prefix = function(d, i, ttl) return string.rep(' ', #tostring(ttl) - #tostring(i)) .. tostring(i) .. ': ', nil end })", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "lua vim.lsp.buf.implementation()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "go", "lua vim.diagnostic.open_float()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", 'lua vim.diagnostic.goto_prev({ border = "rounded" })', opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "ll", "lua vim.diagnostic.setloclist()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "lf", "lua vim.lsp.buf.formatting_sync()", opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) + vim.api.nvim_buf_set_keymap( + bufnr, + 'n', + 'gl', + "lua vim.diagnostic.open_float({ source = false, prefix = function(d, i, ttl) return string.rep(' ', #tostring(ttl) - #tostring(i)) .. tostring(i) .. ': ', nil end })", + opts + ) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', 'lua vim.diagnostic.open_float()', opts) + vim.api.nvim_buf_set_keymap( + bufnr, + 'n', + '[d', + 'lua vim.diagnostic.goto_prev({ border = "rounded" })', + opts + ) + vim.api.nvim_buf_set_keymap( + bufnr, + 'n', + ']d', + 'lua vim.diagnostic.goto_next({ border = "rounded" })', + opts + ) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'll', 'lua vim.diagnostic.setloclist()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lf', 'lua vim.lsp.buf.formatting_sync()', opts) --vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] end - local on_attach = function(client, bufnr) - lsp_keymaps(bufnr) - end + local on_attach = function(client, bufnr) + lsp_keymaps(bufnr) + end - local sumneko_root_path = '/home/peters/builds/lua-language-server' - local sumneko_binary = sumneko_root_path.."/bin/lua-language-server" - -- lua-language-server - -- pacman -S lua-language-server - lspconfig.sumneko_lua.setup { - cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" }, - on_attach = on_attach, - settings = { - Lua = { - format = { - enable = false - }, - diagnostics = { - globals = { 'vim' }, - }, - workspace = { - library = { - -- include neovim runtime files - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, - }, - checkThirdParty = false, -- disable "do you want to set up the workspace" - }, - telemetry = { - enable = false, - } - }, - }, - } + -- lua-language-server + -- pacman -S lua-language-server + lspconfig.sumneko_lua.setup({ + on_attach = on_attach, + settings = { + Lua = { + format = { + enable = false, + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = { + -- include neovim runtime files + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, + }, + checkThirdParty = false, -- disable "do you want to set up the workspace" + }, + telemetry = { + enable = false, + }, + }, + }, + }) - -- TODO: python-language-server (pip install pylsp) - -- lspconfig.pylsp.setup { - -- -- cmd = { '/home/peters/.env38/bin/pylsp' }, - -- on_attach = on_attach, - -- settings = { - -- pylsp = { - -- plugins = { - -- -- pylint = { - -- -- enabled = false, - -- -- }, - -- } - -- } - -- } - -- } + -- pyright + -- pip install pyright + lspconfig.pyright.setup({ + on_attach = on_attach, + }) - -- pyright - -- pip install pyright - lspconfig.pyright.setup { - on_attach = on_attach, - -- settings = { - -- https://github.com/microsoft/pyright/blob/main/docs/settings.md - -- python = { - -- autoSearchPaths = true, - -- autoImportCompletion = true, - -- diagnosticMode = 'openFilesOnly', -- workspace | openFilesOnly - -- useLibraryCodeForTypes = true, - -- typeCheckingMode = '...' -- off | basic | strict - -- venvPath = '...' - -- } - -- } - } + -- vscode-json-language-server + -- npm i -g vscode-langservers-extracted + lspconfig.jsonls.setup({ + on_attach = on_attach, + }) - -- vscode-json-language-server - -- npm i -g vscode-langservers-extracted - lspconfig.jsonls.setup { - on_attach = on_attach, - } - - -- typescript-language-server - -- npm i -g typescript-language-server - lspconfig.tsserver.setup { - on_attach = on_attach, - } + -- typescript-language-server + -- npm i -g typescript-language-server + lspconfig.tsserver.setup({ + on_attach = on_attach, + }) end return M diff --git a/lua/configs/lspsaga.lua b/lua/configs/lspsaga.lua index 635dabf..7037c23 100644 --- a/lua/configs/lspsaga.lua +++ b/lua/configs/lspsaga.lua @@ -1,54 +1,53 @@ local M = {} function M.config() - local status_ok, lspsaga = pcall(require, "lspsaga") + local status_ok, lspsaga = pcall(require, 'lspsaga') if not status_ok then return end - lspsaga.setup { + lspsaga.setup({ debug = false, use_saga_diagnostic_sign = false, -- Diagnostics - error_sign = "", - warn_sign = "", - hint_sign = "", - infor_sign = "", - diagnostic_header_icon = "  ", + error_sign = '', + warn_sign = '', + hint_sign = '', + infor_sign = '', + diagnostic_header_icon = '  ', -- Code actions - code_action_icon = " ", + code_action_icon = ' ', code_action_prompt = { enable = false, --sign = false, -- this thing is ultra annoying --sign_priority = 40, --virtual_text = false, }, - finder_definition_icon = " ", - finder_reference_icon = " ", + finder_definition_icon = ' ', + finder_reference_icon = ' ', max_preview_lines = 40, finder_action_keys = { - open = "o", - vsplit = "s", - split = "i", - quit = "q", - scroll_down = "", - scroll_up = "", + open = 'o', + vsplit = 's', + split = 'i', + quit = 'q', + scroll_down = '', + scroll_up = '', }, code_action_keys = { - quit = "q", - exec = "", + quit = 'q', + exec = '', }, rename_action_keys = { - quit = "", - exec = "", + quit = '', + exec = '', }, - definition_preview_icon = " ", - border_style = "round", - rename_prompt_prefix = "➤ ", + definition_preview_icon = ' ', + border_style = 'round', + rename_prompt_prefix = '➤ ', server_filetype_map = {}, - diagnostic_prefix_format = "%d. ", - } + diagnostic_prefix_format = '%d. ', + }) end return M - diff --git a/lua/configs/lualine.lua b/lua/configs/lualine.lua index d109b3c..3c55298 100644 --- a/lua/configs/lualine.lua +++ b/lua/configs/lualine.lua @@ -1,12 +1,12 @@ local M = {} function M.config() - local status_lualine_ok, lualine = pcall(require, "lualine") + local status_lualine_ok, lualine = pcall(require, 'lualine') if not status_lualine_ok then return end - local status_gitblame_ok, gitblame = pcall(require, "gitblame") + local status_gitblame_ok, gitblame = pcall(require, 'gitblame') if not status_gitblame_ok then return end @@ -36,23 +36,24 @@ function M.config() } local conditions = { - buffer_not_empty = function() return vim.fn.empty(vim.fn.expand "%:t") ~= 1 + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 end, hide_in_width = function() return vim.fn.winwidth(0) > 80 end, check_git_workspace = function() - local filepath = vim.fn.expand "%:p:h" - local gitdir = vim.fn.finddir(".git", filepath .. ";") + local filepath = vim.fn.expand('%:p:h') + local gitdir = vim.fn.finddir('.git', filepath .. ';') return gitdir and #gitdir > 0 and #gitdir < #filepath end, } local config = { options = { - disabled_filetypes = { "NvimTree", "dashboard", "Outline" }, - component_separators = "", - section_separators = "", + disabled_filetypes = { 'NvimTree', 'dashboard', 'Outline' }, + component_separators = '', + section_separators = '', theme = { normal = { c = { fg = scolors.fg, bg = scolors.bg } }, inactive = { c = { fg = scolors.fg, bg = scolors.bg } }, @@ -63,21 +64,21 @@ function M.config() lualine_b = {}, lualine_c = { { -- working dir - function () - local cwd = vim.fn.getcwd() - -- substr the cwd starting at the last "/" character - local cwd_name = string.sub(cwd,-cwd:reverse():find("/")+1) - return cwd_name - end, - color = { fg = scolors.working_dir, gui = "bold" }, - icon="", + function() + local cwd = vim.fn.getcwd() + -- substr the cwd starting at the last "/" character + local cwd_name = string.sub(cwd, -cwd:reverse():find('/') + 1) + return cwd_name + end, + color = { fg = scolors.working_dir, gui = 'bold' }, + icon = '', padding = { left = 2, right = 1 }, }, { -- file name - "filename", - path = 1, - icon="", - color = { fg = scolors.filename, gui = "bold" }, + 'filename', + path = 1, + icon = '', + color = { fg = scolors.filename, gui = 'bold' }, padding = { left = 1, right = 1 }, }, -- { -- git branch @@ -87,15 +88,15 @@ function M.config() -- padding = { left = 1, right = 1 }, -- }, { -- filetype - "filetype", + 'filetype', colored = false, - color = { fg = scolors.filetype, gui = "bold" }, + color = { fg = scolors.filetype, gui = 'bold' }, cond = conditions.buffer_not_empty, padding = { left = 1, right = 1 }, }, { -- git diff - "diff", - symbols = { added = " ", modified = "柳", removed = " " }, + 'diff', + symbols = { added = ' ', modified = '柳', removed = ' ' }, diff_color = { added = { fg = scolors.added }, modified = { fg = scolors.modified }, @@ -105,9 +106,9 @@ function M.config() padding = { left = 1, right = 1 }, }, { -- nvim diagnostics - "diagnostics", - sources = { "nvim_diagnostic" }, - symbols = { error = " ", warn = " ", info = " ", hint = " " }, + 'diagnostics', + sources = { 'nvim_diagnostic' }, + symbols = { error = ' ', warn = ' ', info = ' ', hint = ' ' }, diagnostics_color = { color_error = { fg = scolors.error }, color_warn = { fg = scolors.warn }, @@ -118,24 +119,24 @@ function M.config() }, lualine_x = { { -- git blame - function () - local blame_text = gitblame.get_current_blame_text() - blame_text = blame_text:gsub("Not Committed Yet", "not committed") - return blame_text - end, + function() + local blame_text = gitblame.get_current_blame_text() + blame_text = blame_text:gsub('Not Committed Yet', 'not committed') + return blame_text + end, color = { fg = scolors.fg_wash }, cond = gitblame.is_blame_text_available, padding = { left = 0, right = 1 }, }, { -- location in file (line:col) - "location", + 'location', padding = { left = 0, right = 1 }, }, { -- progress through file (%) -- slightly modified from default "progress" -- always 3 chars long, no TOP -- https://github.com/nvim-lualine/lualine.nvim/blob/master/lua/lualine/components/progress.lua - function () + function() local cur = vim.fn.line('.') local total = vim.fn.line('$') if cur == total then @@ -146,8 +147,8 @@ function M.config() return math.floor(cur / total * 100) .. '%%' end end, - "progress", - color = { gui = "none" }, + 'progress', + color = { gui = 'none' }, padding = { left = 0, right = 1 }, }, }, @@ -157,23 +158,22 @@ function M.config() inactive_sections = { lualine_a = { { -- file name - "filename", - path = 1, - icon="", - color = { fg = scolors.filename, gui = "bold" }, + 'filename', + path = 1, + icon = '', + color = { fg = scolors.filename, gui = 'bold' }, padding = { left = 1, right = 1 }, }, - }, + }, lualine_b = {}, lualine_c = {}, lualine_x = {}, lualine_y = {}, lualine_z = {}, - } + }, } lualine.setup(config) end return M - diff --git a/lua/configs/null-ls.lua b/lua/configs/null-ls.lua index f191b71..b8de717 100644 --- a/lua/configs/null-ls.lua +++ b/lua/configs/null-ls.lua @@ -1,63 +1,68 @@ local M = {} function M.config() - local status_ok, null_ls = pcall(require, "null-ls") + local status_ok, null_ls = pcall(require, 'null-ls') if not status_ok then return end - local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - null_ls.setup { + local augroup = vim.api.nvim_create_augroup('LspFormatting', {}) + null_ls.setup({ debug = false, sources = { - -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md + -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md - -- Python + -- Lua - -- pip install black + -- sudo pacman -S stylua + -- https://github.com/JohnnyMorganz/StyLua/releases + null_ls.builtins.formatting.stylua, + + -- Python + + -- pip install black null_ls.builtins.formatting.black, - -- pip install isort + -- pip install isort null_ls.builtins.formatting.isort, + -- JavaScript / TypeScript - -- JavaScript / TypeScript - - -- sudo pacman -S prettierd - -- sudo npm install -g @fsouza/prettierd + -- sudo pacman -S prettierd + -- sudo npm install -g @fsouza/prettierd null_ls.builtins.formatting.prettierd.with({ - disabled_filetypes = { "html", "markdown" }, - condition = function(utils) - return utils.root_has_file({ ".prettierrc.yml" }) - end, - }), + disabled_filetypes = { 'html', 'markdown' }, + condition = function(utils) + return utils.root_has_file({ '.prettierrc.yml' }) + end, + }), - -- sudo pacman -S eslint_d - -- sudo npm install -g eslint_d + -- sudo pacman -S eslint_d + -- sudo npm install -g eslint_d null_ls.builtins.diagnostics.eslint_d.with({ - diagnostic_config = { - virtual_text = false, - severity_sort = true, - }, - condition = function(utils) - return utils.root_has_file({ ".eslintrc.js" }) - end, - }), + diagnostic_config = { + virtual_text = false, + severity_sort = true, + }, + condition = function(utils) + return utils.root_has_file({ '.eslintrc.js' }) + end, + }), }, -- Format before save - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.format({ bufnr = bufnr }) - end, - }) - end - end, - } + on_attach = function(client, bufnr) + if client.supports_method('textDocument/formatting') then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd('BufWritePre', { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr }) + end, + }) + end + end, + }) end return M diff --git a/lua/configs/nvim-tree.lua b/lua/configs/nvim-tree.lua index cf998f1..0d09dd8 100644 --- a/lua/configs/nvim-tree.lua +++ b/lua/configs/nvim-tree.lua @@ -1,61 +1,61 @@ local M = {} function M.config() - local status_ok, nvimtree = pcall(require, "nvim-tree") + local status_ok, nvimtree = pcall(require, 'nvim-tree') if not status_ok then return end - nvimtree.setup { + nvimtree.setup({ filters = { dotfiles = false, custom = { - "^\\.git$", - "^\\.mypy_cache$", - "^\\.test_cache$", - "^\\.coverage$", - "^node_modules$", + '^\\.git$', + '^\\.mypy_cache$', + '^\\.test_cache$', + '^\\.coverage$', + '^node_modules$', }, }, view = { width = 40, - side = "left", + side = 'left', hide_root_folder = true, number = false, relativenumber = false, - signcolumn = "yes", + signcolumn = 'yes', }, renderer = { indent_markers = { enable = false, icons = { - corner = "└ ", - edge = "│ ", - none = " ", - } + corner = '└ ', + edge = '│ ', + none = ' ', + }, }, icons = { webdev_colors = true, - glyphs = { - folder = { - symlink_open = "", - }, - }, - } + glyphs = { + folder = { + symlink_open = '', + }, + }, + }, }, disable_netrw = true, hijack_netrw = true, open_on_tab = false, ignore_ft_on_setup = { - "alpha", + 'alpha', }, actions = { open_file = { quit_on_open = false, window_picker = { enable = false, - } - } + }, + }, }, hijack_cursor = true, update_focused_file = { @@ -64,10 +64,10 @@ function M.config() diagnostics = { enable = false, icons = { - hint = "", - info = "", - warning = "", - error = "", + hint = '', + info = '', + warning = '', + error = '', }, }, git = { @@ -75,8 +75,7 @@ function M.config() ignore = false, timeout = 500, }, - } + }) end return M - diff --git a/lua/configs/session-manager.lua b/lua/configs/session-manager.lua index c467323..379503d 100644 --- a/lua/configs/session-manager.lua +++ b/lua/configs/session-manager.lua @@ -1,23 +1,23 @@ local M = {} function M.config() - local status_ok, session_manager = pcall(require, "session_manager") + local status_ok, session_manager = pcall(require, 'session_manager') if not status_ok then return end - local sm_config = require'session_manager.config' + local sm_config = require('session_manager.config') local function get_branch_name() - local handle = io.popen("git branch --show-current 2>/dev/null") - if (handle == nil) then + local handle = io.popen('git branch --show-current 2>/dev/null') + if handle == nil then return nil end - local branch = handle:read("l") + local branch = handle:read('l') handle:close() - if (branch == nil) then + if branch == nil then return nil end - branch = branch:gsub("/", "--") + branch = branch:gsub('/', '--') return branch end @@ -25,14 +25,14 @@ function M.config() session_manager.setup({ autoload_mode = sm_config.AutoloadMode.Disabled, -- do not auto-load the last session at startup session_filename_to_dir = function(filename) - local filename_without_extra = filename:sub(0, filename:find("==")) + local filename_without_extra = filename:sub(0, filename:find('==')) return sm_config.delimited_session_filename_to_dir(filename_without_extra) end, dir_to_session_filename = function(dir) local filename = sm_config.dir_to_delimited_session_filename(dir) local branch = get_branch_name() if branch ~= nil then - return filename .. "==" .. branch + return filename .. '==' .. branch else return filename end @@ -41,4 +41,3 @@ function M.config() end return M - diff --git a/lua/configs/telescope.lua b/lua/configs/telescope.lua index 1edd41d..5c98968 100644 --- a/lua/configs/telescope.lua +++ b/lua/configs/telescope.lua @@ -1,77 +1,77 @@ local M = {} function M.config() - local status_ok, telescope = pcall(require, "telescope") + local status_ok, telescope = pcall(require, 'telescope') if not status_ok then return end - local actions = require "telescope.actions" + local actions = require('telescope.actions') --telescope.load_extension "fzf" - telescope.setup { + telescope.setup({ defaults = { - prompt_prefix = " ", - selection_caret = "+ ", - -- emojis cause annoying highlight behavior - -- waiting on https://github.com/nvim-telescope/telescope.nvim/issues/1841 + prompt_prefix = ' ', + selection_caret = '+ ', + -- emojis cause annoying highlight behavior + -- waiting on https://github.com/nvim-telescope/telescope.nvim/issues/1841 --selection_caret = "❯ ", - path_display = { "truncate" }, + path_display = { 'truncate' }, mappings = { i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, + [''] = actions.cycle_history_next, + [''] = actions.cycle_history_prev, - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, + [''] = actions.move_selection_next, + [''] = actions.move_selection_previous, - [""] = actions.close, + [''] = actions.close, - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, + [''] = actions.move_selection_next, + [''] = actions.move_selection_previous, - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, + [''] = actions.select_default, + [''] = actions.select_horizontal, + [''] = actions.select_vertical, + [''] = actions.select_tab, - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, + [''] = actions.preview_scrolling_up, + [''] = actions.preview_scrolling_down, - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, + [''] = actions.results_scrolling_up, + [''] = actions.results_scrolling_down, - [""] = actions.toggle_selection, - [""] = actions.toggle_selection, + [''] = actions.toggle_selection, + [''] = actions.toggle_selection, - [""] = actions.complete_tag, + [''] = actions.complete_tag, }, n = { - [""] = actions.close, - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, + [''] = actions.close, + [''] = actions.select_default, + [''] = actions.select_horizontal, + [''] = actions.select_vertical, + [''] = actions.select_tab, - [""] = actions.toggle_selection, - [""] = actions.toggle_selection, + [''] = actions.toggle_selection, + [''] = actions.toggle_selection, - ["j"] = actions.move_selection_next, - ["k"] = actions.move_selection_previous, + ['j'] = actions.move_selection_next, + ['k'] = actions.move_selection_previous, - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, + ['gg'] = actions.move_to_top, + ['G'] = actions.move_to_bottom, - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, + [''] = actions.move_selection_next, + [''] = actions.move_selection_previous, - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, + [''] = actions.preview_scrolling_up, + [''] = actions.preview_scrolling_down, - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, + [''] = actions.results_scrolling_up, + [''] = actions.results_scrolling_down, }, }, }, @@ -91,7 +91,7 @@ function M.config() -- case_mode = "smart_case", -- }, }, - } + }) end return M diff --git a/lua/configs/treesitter-context.lua b/lua/configs/treesitter-context.lua index c89d3b6..cf6d64a 100644 --- a/lua/configs/treesitter-context.lua +++ b/lua/configs/treesitter-context.lua @@ -1,4 +1,3 @@ - local M = {} function M.config() @@ -7,10 +6,9 @@ function M.config() return end - treesitter_context.setup { - mode = 'topline', - } + treesitter_context.setup({ + mode = 'topline', + }) end return M - diff --git a/lua/configs/treesitter.lua b/lua/configs/treesitter.lua index d50ecb1..37eac6d 100644 --- a/lua/configs/treesitter.lua +++ b/lua/configs/treesitter.lua @@ -6,19 +6,18 @@ function M.config() return end - treesitter_configs.setup { + treesitter_configs.setup({ highlight = { enable = true, - disable = { }, + disable = {}, --additional_vim_regex_highlighting = true }, context_commentstring = { enable = true, enable_autocmd = false, }, - indent = { enable = true, disable = { "html" } }, - } + indent = { enable = true, disable = { 'html' } }, + }) end return M - diff --git a/lua/highlights.lua b/lua/highlights.lua index 7c3e322..0dba9c5 100644 --- a/lua/highlights.lua +++ b/lua/highlights.lua @@ -1,3 +1,2 @@ -- Mostly to hide the nvim-tree Vert Split group. Looks nice in general too -vim.cmd [[ highlight VertSplit guifg=#252526 guibg=#252526 ]] - +vim.cmd([[ highlight VertSplit guifg=#252526 guibg=#252526 ]]) diff --git a/lua/keybinds.lua b/lua/keybinds.lua index 9d616ce..b648ceb 100644 --- a/lua/keybinds.lua +++ b/lua/keybinds.lua @@ -1,84 +1,84 @@ local opts = { noremap = true, silent = true } local map = vim.api.nvim_set_keymap -map("", "", "", opts) -vim.g.mapleader = " " -vim.g.maplocalleader = " " +map('', '', '', opts) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' -- Window Navigation without needing first -map("n", "", "h", opts) -map("n", "", "j", opts) -map("n", "", "k", opts) -map("n", "", "l", opts) +map('n', '', 'h', opts) +map('n', '', 'j', opts) +map('n', '', 'k', opts) +map('n', '', 'l', opts) -- Stay in visual mode when indenting -map("v", "<", "", ">gv", opts) +map('v', '<', '', '>gv', opts) -- Resize with C-arrow -map("n", "", "resize -2", opts) -map("n", "", "resize +2", opts) -map("n", "", "vertical resize -2", opts) -map("n", "", "vertical resize +2", opts) +map('n', '', 'resize -2', opts) +map('n', '', 'resize +2', opts) +map('n', '', 'vertical resize -2', opts) +map('n', '', 'vertical resize +2', opts) -- Jump to column and row rather than first column in row -map("n", "'", "`", opts) -map("n", "`", "'", opts) +map('n', "'", '`', opts) +map('n', '`', "'", opts) -- Close context menus map('n', 'q', 'cclose', opts) -- Navigate buffers -map("n", "", "BufferLineCycleNext", opts) -- :bnext -map("n", "", "BufferLineCyclePrev", opts) -- :bprevious -map("n", "]b", "BufferLineMoveNext", opts) -map("n", "[b", "BufferLineMovePrev", opts) -map("n", "w", "Bdelete", opts) -- don't close if unsaved -map("n", "c", "Bdelete!", opts) -- close it no matter what B) +map('n', '', 'BufferLineCycleNext', opts) -- :bnext +map('n', '', 'BufferLineCyclePrev', opts) -- :bprevious +map('n', ']b', 'BufferLineMoveNext', opts) +map('n', '[b', 'BufferLineMovePrev', opts) +map('n', 'w', 'Bdelete', opts) -- don't close if unsaved +map('n', 'c', 'Bdelete!', opts) -- close it no matter what B) -- Navigate Git Signs -map("n", "]g", "Gitsigns next_hunk", opts) -map("n", "[g", "Gitsigns prev_hunk", opts) +map('n', ']g', 'Gitsigns next_hunk', opts) +map('n', '[g', 'Gitsigns prev_hunk', opts) -- Toggle Diagnostics -map("n", "de", "lua vim.diagnostic.enable()", opts) -map("n", "dd", "lua vim.diagnostic.disable()", opts) +map('n', 'de', 'lua vim.diagnostic.enable()', opts) +map('n', 'dd', 'lua vim.diagnostic.disable()', opts) -- NvimTree map('n', 'e', 'NvimTreeToggle', opts) map('n', 'o', 'NvimTreeFocus', opts) -- Telescope (See also configs/telescope.lua) -map("n", "ff", "Telescope find_files", opts) -map("n", "fw", "Telescope live_grep", opts) -map("n", "fo", "Telescope oldfiles", opts) -map("n", "fp", "Telescope projects", opts) -- ahmedkhalf/project.nvim +map('n', 'ff', 'Telescope find_files', opts) +map('n', 'fw', 'Telescope live_grep', opts) +map('n', 'fo', 'Telescope oldfiles', opts) +map('n', 'fp', 'Telescope projects', opts) -- ahmedkhalf/project.nvim -map("n", "fb", "Telescope buffers", opts) -map("n", "fh", "Telescope help_tags", opts) -map("n", "fs", "Telescope git_status", opts) -map("n", "fc", "Telescope git_commits", opts) +map('n', 'fb', 'Telescope buffers', opts) +map('n', 'fh', 'Telescope help_tags', opts) +map('n', 'fs', 'Telescope git_status', opts) +map('n', 'fc', 'Telescope git_commits', opts) -map("n", "gr", "Telescope lsp_references", opts) +map('n', 'gr', 'Telescope lsp_references', opts) -- Lspsaga (See also configs/lspsaga.lua) --map("n", "gl", "Lspsaga show_line_diagnostics", opts) -map("n", "gpd", "Lspsaga preview_definition", opts) -map("n", "gs", "Lspsaga signature_help", opts) -map("i", "", "Lspsaga signature_help", opts) -map("n", "lr", "Lspsaga rename", opts) -map("n", "la", "Lspsaga code_action", opts) -map("n", "", "lua require('lspsaga.action').smart_scroll_with_saga(-1)", opts) -map("n", "", "lua require('lspsaga.action').smart_scroll_with_saga(1)", opts) +map('n', 'gpd', 'Lspsaga preview_definition', opts) +map('n', 'gs', 'Lspsaga signature_help', opts) +map('i', '', 'Lspsaga signature_help', opts) +map('n', 'lr', 'Lspsaga rename', opts) +map('n', 'la', 'Lspsaga code_action', opts) +map('n', '', "lua require('lspsaga.action').smart_scroll_with_saga(-1)", opts) +map('n', '', "lua require('lspsaga.action').smart_scroll_with_saga(1)", opts) -- Custom "toggle summary" function for blame -- jkkj is a hack to refresh the git blame message since it doesn't update till the line changes -map("n", "s", "GitBlameToggleSummaryjkkj", opts) +map('n', 's', 'GitBlameToggleSummaryjkkj', opts) -- LSP (see configs/lsp-installer.lua) -- disable K in visual mode -map("v", "K", "", { noremap=false, silent=true }) +map('v', 'K', '', { noremap = false, silent = true }) -- Illuminate -map("n", "", "lua require('illuminate').goto_next_reference()", opts) -map("n", "g", "lua require('illuminate').goto_prev_reference()", opts) +map('n', '', "lua require('illuminate').goto_next_reference()", opts) +map('n', 'g', "lua require('illuminate').goto_prev_reference()", opts) diff --git a/lua/plugins.lua b/lua/plugins.lua index 0184809..fce105a 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,221 +1,292 @@ -- Make sure to install packer via the AUR -- $ yay -S nvim-packer-git -local packer_status_ok, packer = pcall(require, "packer") +local packer_status_ok, packer = pcall(require, 'packer') if not packer_status_ok then return end -vim.cmd [[packadd packer.nvim]] +vim.cmd([[packadd packer.nvim]]) -packer.startup { +packer.startup({ function(use) - -- git clone --depth 1 https://github.com/wbthomason/packer.nvim \ - -- ~/.local/share/nvim/site/pack/packer/start/packer.nvim - -- Packer will try to delete itself otherwise - use 'wbthomason/packer.nvim' + -- git clone --depth 1 https://github.com/wbthomason/packer.nvim \ + -- ~/.local/share/nvim/site/pack/packer/start/packer.nvim + -- Packer will try to delete itself otherwise + use('wbthomason/packer.nvim') -- -- General -- -- General Lua functions - use { 'nvim-lua/plenary.nvim' } - use { 'nvim-lua/popup.nvim' } + use({ 'nvim-lua/plenary.nvim' }) + use({ 'nvim-lua/popup.nvim' }) -- General optimizations - use { 'lewis6991/impatient.nvim' } - use { 'nathom/filetype.nvim', config = function() vim.g.did_load_filetypes = 1 end } + use({ 'lewis6991/impatient.nvim' }) + use({ + 'nathom/filetype.nvim', + config = function() + vim.g.did_load_filetypes = 1 + end, + }) -- General Assets/Resources - use { 'kyazdani42/nvim-web-devicons', config = function() require'configs.icons'.config() end } + use({ + 'kyazdani42/nvim-web-devicons', + config = function() + require('configs.icons').config() + end, + }) -- -- Style -- -- Colorscheme (See autocommands.lua) - use { - 'lunarvim/darkplus.nvim', - commit = 'f20cba5d690bc34398a3a8372ee7bbbc7b6609fa', - -- tag = 'neovim-0.7', -- this has imperfect comment highlights - } + use({ + 'lunarvim/darkplus.nvim', + commit = 'f20cba5d690bc34398a3a8372ee7bbbc7b6609fa', + -- tag = 'neovim-0.7', -- this has imperfect comment highlights + }) --[[ use { '~/builds/darkplus.nvim' } ]] -- Buffer Line - use { 'moll/vim-bbye' } -- Close buffers softly - use { + use({ 'moll/vim-bbye' }) -- Close buffers softly + use({ 'akinsho/bufferline.nvim', - -- v3.* requires nvim v0.8+ - tag = 'v2.*', + -- v3.* requires nvim v0.8+ + tag = 'v2.*', requires = { - { 'kyazdani42/nvim-web-devicons' } + { 'kyazdani42/nvim-web-devicons' }, }, - config = function() require'configs.bufferline'.config() end - } + config = function() + require('configs.bufferline').config() + end, + }) - -- Git (git-blame must be before lualine) - use { 'lewis6991/gitsigns.nvim', config = function() require'configs.gitsigns'.config() end } - use { 'f-person/git-blame.nvim', config = function() require'configs.git-blame'.config() end } + -- Git (git-blame must be before lualine) + use({ + 'lewis6991/gitsigns.nvim', + config = function() + require('configs.gitsigns').config() + end, + }) + use({ + 'f-person/git-blame.nvim', + config = function() + require('configs.git-blame').config() + end, + }) -- Status Line - use { 'nvim-lualine/lualine.nvim', config = function() require'configs.lualine'.config() end } + use({ + 'nvim-lualine/lualine.nvim', + config = function() + require('configs.lualine').config() + end, + }) -- NvimTree - use { + use({ 'kyazdani42/nvim-tree.lua', requires = { - { 'kyazdani42/nvim-web-devicons' } + { 'kyazdani42/nvim-web-devicons' }, }, - config = function() require'configs.nvim-tree'.config() end - } - + config = function() + require('configs.nvim-tree').config() + end, + }) -- Show indentation - use { 'lukas-reineke/indent-blankline.nvim', config = function() require'configs.indent-blankline'.config() end } + use({ + 'lukas-reineke/indent-blankline.nvim', + config = function() + require('configs.indent-blankline').config() + end, + }) -- Telescope (find files, words, git commits, etc) - use { 'nvim-telescope/telescope.nvim', config = function() require'configs.telescope'.config() end } + use({ + 'nvim-telescope/telescope.nvim', + config = function() + require('configs.telescope').config() + end, + }) -- use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } - -- Sessions - -- use { - -- 'Shatur/neovim-session-manager', - -- commit = '4005dac93f5cd1257792259ef4df6af0e3afc213', - -- config = function() require'configs.session-manager'.config() end - -- } - -- custom build of the above plugin - use { - '~/builds/neovim-session-manager', - config = function() require'configs.session-manager'.config() end - } + -- Sessions + -- use { + -- 'Shatur/neovim-session-manager', + -- commit = '4005dac93f5cd1257792259ef4df6af0e3afc213', + -- config = function() require'configs.session-manager'.config() end + -- } + -- custom build of the above plugin + use({ + '~/builds/neovim-session-manager', + config = function() + require('configs.session-manager').config() + end, + }) -- -- Treesitter -- -- Treesitter - use { + use({ 'nvim-treesitter/nvim-treesitter', - commit = '4cccb6f494eb255b32a290d37c35ca12584c74d0', + commit = '4cccb6f494eb255b32a290d37c35ca12584c74d0', run = ':TSUpdate', - config = function() require'configs.treesitter'.config() end, - -- the next commit, 42ab95d5e11f247c6f0c8f5181b02e816caa4a4f breaks the darkplus colorscheme (and nvim 0.7.2) - -- https://github.com/nvim-treesitter/nvim-treesitter/pull/3656 - } + config = function() + require('configs.treesitter').config() + end, + -- the next commit, 42ab95d5e11f247c6f0c8f5181b02e816caa4a4f breaks the darkplus colorscheme (and nvim 0.7.2) + -- https://github.com/nvim-treesitter/nvim-treesitter/pull/3656 + }) -- Auto-close tags - use { 'windwp/nvim-ts-autotag', after = 'nvim-treesitter' } + use({ 'windwp/nvim-ts-autotag', after = 'nvim-treesitter' }) -- Context-based auto commenting - use { 'JoosepAlviste/nvim-ts-context-commentstring', after = 'nvim-treesitter' } + use({ 'JoosepAlviste/nvim-ts-context-commentstring', after = 'nvim-treesitter' }) - -- Show context - use { 'nvim-treesitter/nvim-treesitter-context', config = function() require'configs.treesitter-context'.config() end } + -- Show context + use({ + 'nvim-treesitter/nvim-treesitter-context', + config = function() + require('configs.treesitter-context').config() + end, + }) -- -- LSP -- -- Cursorhold fix - use { - "antoinemadec/FixCursorHold.nvim", - config = function() vim.g.cursorhold_updatetime = 300 end, - } + use({ + 'antoinemadec/FixCursorHold.nvim', + config = function() + vim.g.cursorhold_updatetime = 300 + end, + }) -- Built-In LSP Config - use { + use({ 'neovim/nvim-lspconfig', -- event = 'BufRead', - config = function() require'configs.lspconfig'.config() end - } + config = function() + require('configs.lspconfig').config() + end, + }) -- TODO: LSP Enhancer - use { + use({ 'tami5/lspsaga.nvim', - config = function() require'configs.lspsaga'.config() end - } + config = function() + require('configs.lspsaga').config() + end, + }) -- TODO: Symbols Outline -- use { 'simrat39'/symbols-outline.nvim', cmd = 'SymbolsOutline', setup = function ... } -- Formatting + Linting - use { + use({ 'jose-elias-alvarez/null-ls.nvim', event = 'BufRead', - config = function() require'configs.null-ls'.config() end - } - - -- highlight hovered-over text - use { - 'RRethy/vim-illuminate', - config = function() require'configs.illuminate'.config() end - } + config = function() + require('configs.null-ls').config() + end, + }) + -- highlight hovered-over text + use({ + 'RRethy/vim-illuminate', + config = function() + require('configs.illuminate').config() + end, + }) -- -- Autocompletion -- -- Autocompletion Engine - use { + use({ 'hrsh7th/nvim-cmp', - config = function() require'configs.cmp'.config() end - } + config = function() + require('configs.cmp').config() + end, + }) -- Snippet Engine (for nvim-cmp) -- TODO: Add snippets? rafamadriz/friendly-snippets is too cow for me and has too many snippets. -- I'd like to use my own collection exclusively (unless there is a better, less extensive collection) - use { 'L3MON4D3/LuaSnip' } + use({ 'L3MON4D3/LuaSnip' }) -- Autocompletion Sources - use { 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp', requires = { 'nvim-cmp' } } - use { 'hrsh7th/cmp-buffer', after = 'nvim-cmp', requires = { 'nvim-cmp' } } - use { 'hrsh7th/cmp-path', after = 'nvim-cmp', requires = { 'nvim-cmp' } } - use { 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp', requires = { 'nvim-cmp' } } + use({ 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp', requires = { 'nvim-cmp' } }) + use({ 'hrsh7th/cmp-buffer', after = 'nvim-cmp', requires = { 'nvim-cmp' } }) + use({ 'hrsh7th/cmp-path', after = 'nvim-cmp', requires = { 'nvim-cmp' } }) + use({ 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp', requires = { 'nvim-cmp' } }) -- -- Quality of Life -- - -- Dashboard - use { - 'goolord/alpha-nvim', - requires = { 'kyazdani42/nvim-web-devicons' }, - config = function() require'configs.alpha'.config() end - } + -- Dashboard + use({ + 'goolord/alpha-nvim', + requires = { 'kyazdani42/nvim-web-devicons' }, + config = function() + require('configs.alpha').config() + end, + }) -- Autopairs - use { 'windwp/nvim-autopairs', config = function() require'configs.autopairs'.config() end } + use({ + 'windwp/nvim-autopairs', + config = function() + require('configs.autopairs').config() + end, + }) - -- Commenting - use { - 'numToStr/Comment.nvim', - config = function() require'configs.comment'.config() end, - after = 'nvim-ts-context-commentstring' - } + -- Commenting + use({ + 'numToStr/Comment.nvim', + config = function() + require('configs.comment').config() + end, + after = 'nvim-ts-context-commentstring', + }) -- Automatically colorize color strings (#f1b8f1) - use { 'norcalli/nvim-colorizer.lua', config = function() require'configs.colorizer'.config() end } + use({ + 'norcalli/nvim-colorizer.lua', + config = function() + require('configs.colorizer').config() + end, + }) -- Remember your last place when opening a file - use { 'farmergreg/vim-lastplace' } + use({ 'farmergreg/vim-lastplace' }) - -- Import sorting for python (:Isort) - use { 'stsewd/isort.nvim', run = ':UpdateRemotePlugins' } + -- Import sorting for python (:Isort) + use({ 'stsewd/isort.nvim', run = ':UpdateRemotePlugins' }) - -- Formatting for python (:call Black()) - use { 'averms/black-nvim', run = ':UpdateRemotePlugins' } + -- Formatting for python (:call Black()) + use({ 'averms/black-nvim', run = ':UpdateRemotePlugins' }) end, config = { display = { open_fn = function() - return require'packer.util'.float { border = 'rounded' } - end + return require('packer.util').float({ border = 'rounded' }) + end, }, profile = { enable = true, threshold = 0.0001, - } - } -} - + }, + }, +}) diff --git a/lua/settings.lua b/lua/settings.lua index d3209b1..0b4abc7 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -27,13 +27,9 @@ set.number = true set.cursorline = true set.wrap = false --- Javascript Mode ---set.expandtab = false ---set.shiftwidth = 4 ---set.tabstop = 4 --- Python Mode -set.expandtab = true +set.expandtab = false set.shiftwidth = 4 set.tabstop = 4 +-- enable expandtab for python files