From 67f73b704498322cfbc79315f4ee9761f630b464 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 17:00:38 -0500 Subject: add colorscheme add colorscheme --- lua/user/colorscheme.lua | 8 ++++++++ lua/user/plugins.lua | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 lua/user/colorscheme.lua (limited to 'lua') diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua new file mode 100644 index 0000000..b1e21f6 --- /dev/null +++ b/lua/user/colorscheme.lua @@ -0,0 +1,8 @@ +vim.cmd [[ +try + colorscheme darkplus +catch /^Vim\%((\a\+)\)\=:E185/ + colorscheme default + set background=dark +endtry +]] diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 3d4499f..6b131a2 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -45,6 +45,10 @@ return packer.startup(function(use) use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins + -- Colorschemes + -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out + use "lunarvim/darkplus.nvim" + -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if PACKER_BOOTSTRAP then -- cgit v1.2.3 From 2683495c3df5ee7d3682897e0d47b0facb3cedc9 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 17:08:44 -0500 Subject: add completion add completion --- init.lua | 1 + lua/user/cmp.lua | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++ lua/user/plugins.lua | 13 +++++- 3 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 lua/user/cmp.lua (limited to 'lua') diff --git a/init.lua b/init.lua index be25513..6614b7a 100644 --- a/init.lua +++ b/init.lua @@ -2,3 +2,4 @@ require "user.options" require "user.keymaps" require "user.plugins" require "user.colorscheme" +require "user.cmp" diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua new file mode 100644 index 0000000..c5e2d3e --- /dev/null +++ b/lua/user/cmp.lua @@ -0,0 +1,127 @@ +local cmp_status_ok, cmp = pcall(require, "cmp") +if not cmp_status_ok then + return +end + +local snip_status_ok, luasnip = pcall(require, "luasnip") +if not snip_status_ok then + return +end + +require("luasnip/loaders/from_vscode").lazy_load() + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +--   פּ ﯟ   some other good icons +local kind_icons = { + Text = "", + Method = "m", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", +} +-- find more here: https://www.nerdfonts.com/cheat-sheet + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + 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, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [""] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.confirm { select = true }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + -- Kind icons + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind + vim_item.menu = ({ + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + documentation = { + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + }, + experimental = { + ghost_text = false, + native_menu = false, + }, +} diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 505d14a..4fcc929 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -47,7 +47,18 @@ return packer.startup(function(use) -- Colorschemes -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out - use "lunarvim/darkplus.nvim" -- A bunch of colorschemes you can try out + use "lunarvim/darkplus.nvim" + + -- cmp plugins + use "hrsh7th/nvim-cmp" -- The completion plugin + use "hrsh7th/cmp-buffer" -- buffer completions + use "hrsh7th/cmp-path" -- path completions + use "hrsh7th/cmp-cmdline" -- cmdline completions + use "saadparwaiz1/cmp_luasnip" -- snippet completions + + -- snippets + use "L3MON4D3/LuaSnip" --snippet engine + use "rafamadriz/friendly-snippets" -- a bunch of snippets to use -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins -- cgit v1.2.3 From 54c2bb07828c8e11bfa8e26f5931060ac3402358 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 18:04:23 -0500 Subject: add comments add comments --- init.lua | 1 + lua/user/comment.lua | 22 ++++++++++++++++++++++ lua/user/plugins.lua | 2 ++ lua/user/treesitter.lua | 8 ++++++-- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 lua/user/comment.lua (limited to 'lua') diff --git a/init.lua b/init.lua index ff1e2e2..f1c864d 100644 --- a/init.lua +++ b/init.lua @@ -7,3 +7,4 @@ require "user.lsp" require "user.telescope" require "user.treesitter" require "user.autopairs" +require "user.comment" diff --git a/lua/user/comment.lua b/lua/user/comment.lua new file mode 100644 index 0000000..2fa4a56 --- /dev/null +++ b/lua/user/comment.lua @@ -0,0 +1,22 @@ +local status_ok, comment = pcall(require, "Comment") +if not status_ok then + return +end + +comment.setup { + pre_hook = function(ctx) + local U = require "Comment.utils" + + local location = nil + if ctx.ctype == U.ctype.block then + location = require("ts_context_commentstring.utils").get_cursor_location() + elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then + location = require("ts_context_commentstring.utils").get_visual_start_location() + end + + return require("ts_context_commentstring.internal").calculate_commentstring { + key = ctx.ctype == U.ctype.line and "__default" or "__multiline", + location = location, + } + end, +} diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 74fcb73..3e2c87c 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -45,6 +45,7 @@ return packer.startup(function(use) use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter + use "numToStr/Comment.nvim" -- Easily comment stuff -- Colorschemes -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out @@ -75,6 +76,7 @@ return packer.startup(function(use) "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", } + use 'JoosepAlviste/nvim-ts-context-commentstring' -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index b5754d6..6f14cfc 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -8,12 +8,16 @@ configs.setup { sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) ignore_install = { "" }, -- List of parsers to ignore installing autopairs = { - enable = true, - }, + enable = true, + }, highlight = { enable = true, -- false will disable the whole extension disable = { "" }, -- list of language that will be disabled additional_vim_regex_highlighting = true, }, indent = { enable = true, disable = { "yaml" } }, + context_commentstring = { + enable = true, + enable_autocmd = false, + }, } -- cgit v1.2.3 From 6fbc8c23123a6b44590a3fa6c656c2f5b98ae89e Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 18:07:49 -0500 Subject: add gitsigns update --- init.lua | 1 + lua/user/gitsigns.lua | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ lua/user/keymaps.lua | 4 ---- lua/user/plugins.lua | 3 +++ 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 lua/user/gitsigns.lua (limited to 'lua') diff --git a/init.lua b/init.lua index f1c864d..ba4006d 100644 --- a/init.lua +++ b/init.lua @@ -8,3 +8,4 @@ require "user.telescope" require "user.treesitter" require "user.autopairs" require "user.comment" +require "user.gitsigns" diff --git a/lua/user/gitsigns.lua b/lua/user/gitsigns.lua new file mode 100644 index 0000000..ff72b93 --- /dev/null +++ b/lua/user/gitsigns.lua @@ -0,0 +1,48 @@ +local status_ok, gitsigns = pcall(require, "gitsigns") +if not status_ok then + return +end + +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" }, + topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + 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, + ignore_whitespace = false, + }, + 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/lua/user/keymaps.lua b/lua/user/keymaps.lua index 9534dec..fb8fdb4 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -68,7 +68,3 @@ keymap("t", "", "h", term_opts) keymap("t", "", "j", term_opts) keymap("t", "", "k", term_opts) keymap("t", "", "l", term_opts) - --- Comment -keymap("n", "/", "lua require('Comment').toggle()", opts) -keymap("v", "/", ":lua require(\"Comment.api\").gc(vim.fn.visualmode())", opts) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 3e2c87c..24678aa 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -78,6 +78,9 @@ return packer.startup(function(use) } use 'JoosepAlviste/nvim-ts-context-commentstring' + -- Git + use "lewis6991/gitsigns.nvim" + -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if PACKER_BOOTSTRAP then -- cgit v1.2.3 From 03ec92cafb62f4331bd04bee734d0bd2c28e668e Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 18:18:28 -0500 Subject: add nvimtree update --- init.lua | 1 + lua/user/keymaps.lua | 7 +--- lua/user/nvim-tree.lua | 112 +++++++++++++++++++++++++++++++++++++++++++++++++ lua/user/plugins.lua | 2 + 4 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 lua/user/nvim-tree.lua (limited to 'lua') diff --git a/init.lua b/init.lua index ba4006d..0669cb2 100644 --- a/init.lua +++ b/init.lua @@ -9,3 +9,4 @@ require "user.treesitter" require "user.autopairs" require "user.comment" require "user.gitsigns" +require "user.nvim-tree" diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 9534dec..638cab5 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -25,8 +25,6 @@ keymap("n", "", "j", opts) keymap("n", "", "k", opts) keymap("n", "", "l", opts) -keymap("n", "e", ":Lex 30", opts) - -- Resize with arrows keymap("n", "", ":resize -2", opts) keymap("n", "", ":resize +2", opts) @@ -69,6 +67,5 @@ keymap("t", "", "j", term_opts) keymap("t", "", "k", term_opts) keymap("t", "", "l", term_opts) --- Comment -keymap("n", "/", "lua require('Comment').toggle()", opts) -keymap("v", "/", ":lua require(\"Comment.api\").gc(vim.fn.visualmode())", opts) +-- Nvimtree +keymap("n", "e", ":NvimTreeToggle", opts) diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua new file mode 100644 index 0000000..9c5170c --- /dev/null +++ b/lua/user/nvim-tree.lua @@ -0,0 +1,112 @@ +-- following options are the default +-- each of these are documented in `:help nvim-tree.OPTION_NAME` +vim.g.nvim_tree_icons = { + default = "", + symlink = "", + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "U", + ignored = "◌", + }, + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + }, +} + +local status_ok, nvim_tree = pcall(require, "nvim-tree") +if not status_ok then + return +end + +local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") +if not config_status_ok then + return +end + +local tree_cb = nvim_tree_config.nvim_tree_callback + +nvim_tree.setup { + disable_netrw = true, + hijack_netrw = true, + open_on_setup = false, + ignore_ft_on_setup = { + "startify", + "dashboard", + "alpha", + }, + auto_close = true, + open_on_tab = false, + hijack_cursor = false, + update_cwd = true, + update_to_buf_dir = { + enable = true, + auto_open = true, + }, + diagnostics = { + enable = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + system_open = { + cmd = nil, + args = {}, + }, + filters = { + dotfiles = false, + custom = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + width = 30, + height = 30, + hide_root_folder = false, + side = "left", + auto_resize = true, + mappings = { + custom_only = false, + list = { + { key = { "l", "", "o" }, cb = tree_cb "edit" }, + { key = "h", cb = tree_cb "close_node" }, + { key = "v", cb = tree_cb "vsplit" }, + }, + }, + number = false, + relativenumber = false, + }, + trash = { + cmd = "trash", + require_confirm = true, + }, + quit_on_open = 0, + git_hl = 1, + disable_window_picker = 0, + root_folder_modifier = ":t", + show_icons = { + git = 1, + folders = 1, + files = 1, + folder_arrows = 1, + tree_width = 30, + }, +} diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 24678aa..04c0bc9 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -46,6 +46,8 @@ return packer.startup(function(use) use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter use "numToStr/Comment.nvim" -- Easily comment stuff + use 'kyazdani42/nvim-web-devicons' + use 'kyazdani42/nvim-tree.lua' -- Colorschemes -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out -- cgit v1.2.3 From 122bedde844fcef84169889d7666af0592b58c46 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 18:21:42 -0500 Subject: add bufferline add bufferline update --- init.lua | 1 + lua/user/bufferline.lua | 167 ++++++++++++++++++++++++++++++++++++++++++++++++ lua/user/keymaps.lua | 4 -- lua/user/plugins.lua | 8 ++- 4 files changed, 173 insertions(+), 7 deletions(-) create mode 100644 lua/user/bufferline.lua (limited to 'lua') diff --git a/init.lua b/init.lua index 0669cb2..5ff470c 100644 --- a/init.lua +++ b/init.lua @@ -10,3 +10,4 @@ require "user.autopairs" require "user.comment" require "user.gitsigns" require "user.nvim-tree" +require "user.bufferline" diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua new file mode 100644 index 0000000..7d98cf0 --- /dev/null +++ b/lua/user/bufferline.lua @@ -0,0 +1,167 @@ +local status_ok, bufferline = pcall(require, "bufferline") +if not status_ok then + return +end + +bufferline.setup { + options = { + numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, + close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + -- NOTE: this plugin is designed with this icon in mind, + -- and so changing this is NOT recommended, this is intended + -- as an escape hatch for people who cannot bear it for whatever reason + indicator_icon = "▎", + buffer_close_icon = "", + -- buffer_close_icon = '', + modified_icon = "●", + close_icon = "", + -- close_icon = '', + left_trunc_marker = "", + right_trunc_marker = "", + --- name_formatter can be used to change the buffer's label in the bufferline. + --- Please note some names can/will break the + --- bufferline so use this at your discretion knowing that it has + --- some limitations that will *NOT* be fixed. + -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- -- remove extension from markdown files for example + -- if buf.name:match('%.md') then + -- return vim.fn.fnamemodify(buf.name, ':t:r') + -- end + -- end, + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 21, + diagnostics = false, -- | "nvim_lsp" | "coc", + diagnostics_update_in_insert = false, + -- diagnostics_indicator = function(count, level, diagnostics_dict, context) + -- return "("..count..")" + -- end, + -- NOTE: this will be called a lot so don't do any heavy processing here + -- custom_filter = function(buf_number) + -- -- filter out filetypes you don't want to see + -- if vim.bo[buf_number].filetype ~= "" then + -- return true + -- end + -- -- filter out by buffer name + -- if vim.fn.bufname(buf_number) ~= "" then + -- return true + -- end + -- -- filter out based on arbitrary rules + -- -- e.g. filter out vim wiki buffer from tabline in your work repo + -- if vim.fn.getcwd() == "" and vim.bo[buf_number].filetype ~= "wiki" then + -- return true + -- end + -- end, + offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + show_tab_indicators = true, + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, + enforce_regular_tabs = true, + always_show_bufferline = true, + -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) + -- -- add custom logic + -- return buffer_a.modified > buffer_b.modified + -- end + }, + highlights = { + fill = { + guifg = { attribute = "fg", highlight = "#ff0000" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + background = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + -- buffer_selected = { + -- guifg = {attribute='fg',highlight='#ff0000'}, + -- guibg = {attribute='bg',highlight='#0000ff'}, + -- gui = 'none' + -- }, + buffer_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + close_button = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + close_button_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + -- close_button_selected = { + -- guifg = {attribute='fg',highlight='TabLineSel'}, + -- guibg ={attribute='bg',highlight='TabLineSel'} + -- }, + + tab_selected = { + guifg = { attribute = "fg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + tab = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + tab_close = { + -- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, + guifg = { attribute = "fg", highlight = "TabLineSel" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + + duplicate_selected = { + guifg = { attribute = "fg", highlight = "TabLineSel" }, + guibg = { attribute = "bg", highlight = "TabLineSel" }, + gui = "italic", + }, + duplicate_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + gui = "italic", + }, + duplicate = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + gui = "italic", + }, + + modified = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + modified_selected = { + guifg = { attribute = "fg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + modified_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + separator = { + guifg = { attribute = "bg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + separator_selected = { + guifg = { attribute = "bg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + -- separator_visible = { + -- guifg = {attribute='bg',highlight='TabLine'}, + -- guibg = {attribute='bg',highlight='TabLine'} + -- }, + indicator_selected = { + guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + }, +} diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b4d2195..638cab5 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -67,9 +67,5 @@ keymap("t", "", "j", term_opts) keymap("t", "", "k", term_opts) keymap("t", "", "l", term_opts) --- Comment -keymap("n", "/", "lua require('Comment').toggle()", opts) -keymap("v", "/", ":lua require(\"Comment.api\").gc(vim.fn.visualmode())", opts) - -- Nvimtree keymap("n", "e", ":NvimTreeToggle", opts) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 04c0bc9..530d7bf 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -46,8 +46,10 @@ return packer.startup(function(use) use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter use "numToStr/Comment.nvim" -- Easily comment stuff - use 'kyazdani42/nvim-web-devicons' - use 'kyazdani42/nvim-tree.lua' + use "kyazdani42/nvim-web-devicons" + use "kyazdani42/nvim-tree.lua" + use "akinsho/bufferline.nvim" + use "moll/vim-bbye" -- Colorschemes -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out @@ -78,7 +80,7 @@ return packer.startup(function(use) "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", } - use 'JoosepAlviste/nvim-ts-context-commentstring' + use "JoosepAlviste/nvim-ts-context-commentstring" -- Git use "lewis6991/gitsigns.nvim" -- cgit v1.2.3 From 6fddfcb743fe2f4980608853ef27fb9b5737a3ee Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 18:25:42 -0500 Subject: add null-ls fix bufferline f --- lua/user/bufferline.lua | 8 ++++---- lua/user/keymaps.lua | 4 ---- lua/user/lsp/init.lua | 5 +++-- lua/user/lsp/null-ls.lua | 19 +++++++++++++++++++ lua/user/plugins.lua | 1 + 5 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 lua/user/lsp/null-ls.lua (limited to 'lua') diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua index 81015c5..7d98cf0 100644 --- a/lua/user/bufferline.lua +++ b/lua/user/bufferline.lua @@ -92,12 +92,12 @@ bufferline.setup { }, close_button = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, }, close_button_visible = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, }, -- close_button_selected = { -- guifg = {attribute='fg',highlight='TabLineSel'}, diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b4d2195..638cab5 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -67,9 +67,5 @@ keymap("t", "", "j", term_opts) keymap("t", "", "k", term_opts) keymap("t", "", "l", term_opts) --- Comment -keymap("n", "/", "lua require('Comment').toggle()", opts) -keymap("v", "/", ":lua require(\"Comment.api\").gc(vim.fn.visualmode())", opts) - -- Nvimtree keymap("n", "e", ":NvimTreeToggle", opts) diff --git a/lua/user/lsp/init.lua b/lua/user/lsp/init.lua index a62e7aa..8158cf3 100644 --- a/lua/user/lsp/init.lua +++ b/lua/user/lsp/init.lua @@ -1,7 +1,8 @@ local status_ok, _ = pcall(require, "lspconfig") if not status_ok then - return + return end -require("user.lsp.lsp-installer") +require "user.lsp.lsp-installer" require("user.lsp.handlers").setup() +require "user.lsp.null-ls" diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua new file mode 100644 index 0000000..874e19c --- /dev/null +++ b/lua/user/lsp/null-ls.lua @@ -0,0 +1,19 @@ +local null_ls_status_ok, null_ls = pcall(require, "null-ls") +if not null_ls_status_ok then + return +end + +-- 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.stylua, + -- diagnostics.flake8 + }, +}) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 530d7bf..614545c 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -71,6 +71,7 @@ return packer.startup(function(use) use "neovim/nvim-lspconfig" -- enable LSP use "williamboman/nvim-lsp-installer" -- simple to use language server installer use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for + use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters -- Telescope use "nvim-telescope/telescope.nvim" -- cgit v1.2.3 From 453274513272d301906db175f8f2e7e22ef7d568 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 18:33:51 -0500 Subject: add lualine add lualine f --- init.lua | 1 + lua/user/bufferline.lua | 8 ++--- lua/user/keymaps.lua | 4 --- lua/user/lualine.lua | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ lua/user/plugins.lua | 1 + 5 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 lua/user/lualine.lua (limited to 'lua') diff --git a/init.lua b/init.lua index 5ff470c..927f1e0 100644 --- a/init.lua +++ b/init.lua @@ -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/bufferline.lua b/lua/user/bufferline.lua index 81015c5..7d98cf0 100644 --- a/lua/user/bufferline.lua +++ b/lua/user/bufferline.lua @@ -92,12 +92,12 @@ bufferline.setup { }, close_button = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, }, close_button_visible = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, }, -- close_button_selected = { -- guifg = {attribute='fg',highlight='TabLineSel'}, diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b4d2195..638cab5 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -67,9 +67,5 @@ keymap("t", "", "j", term_opts) keymap("t", "", "k", term_opts) keymap("t", "", "l", term_opts) --- Comment -keymap("n", "/", "lua require('Comment').toggle()", opts) -keymap("v", "/", ":lua require(\"Comment.api\").gc(vim.fn.visualmode())", opts) - -- Nvimtree keymap("n", "e", ":NvimTreeToggle", opts) 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 614545c..ef28595 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' -- Colorschemes -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out -- cgit v1.2.3 From 4f2899202ef524a0264959feb6e4775b6e82b596 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sat, 18 Dec 2021 23:05:40 -0500 Subject: remove keymap --- lua/user/keymaps.lua | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lua') diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index fb8fdb4..b4823fe 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -37,10 +37,6 @@ keymap("n", "", ":vertical resize +2", opts) keymap("n", "", ":bnext", opts) keymap("n", "", ":bprevious", opts) --- Move text up and down -keymap("n", "", ":m .+1==gi", opts) -keymap("n", "", ":m .-2==gi", opts) - -- Insert -- -- Press jk fast to enter keymap("i", "jk", "", opts) -- cgit v1.2.3 From e1ac27496fccd2e0accb79c6ac2097865feff14b Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 19 Dec 2021 13:16:43 -0500 Subject: update resize --- lua/user/keymaps.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lua') diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b4823fe..b3eb0d8 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -28,8 +28,8 @@ keymap("n", "", "l", opts) keymap("n", "e", ":Lex 30", opts) -- Resize with arrows -keymap("n", "", ":resize -2", opts) -keymap("n", "", ":resize +2", opts) +keymap("n", "", ":resize +2", opts) +keymap("n", "", ":resize -2", opts) keymap("n", "", ":vertical resize -2", opts) keymap("n", "", ":vertical resize +2", opts) -- cgit v1.2.3 From 68de5d4fab1cd11d74829947a2809c1899280dea Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 20 Dec 2021 10:57:40 -0500 Subject: use lua way to handle color scheme errors --- lua/user/colorscheme.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lua') diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index b1e21f6..8c73fd6 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,8 +1,7 @@ -vim.cmd [[ -try - colorscheme darkplus -catch /^Vim\%((\a\+)\)\=:E185/ - colorscheme default - set background=dark -endtry -]] +local colorscheme = "default" + +local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) +if not status_ok then + vim.notify("colorscheme " .. colorscheme .. " not found!") + return +end -- cgit v1.2.3 From 0981b2838275468ad1863aba908379af63209e7a Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 20 Dec 2021 23:27:38 -0500 Subject: lsp updates --- init.lua | 1 + lua/user/cmp.lua | 2 ++ lua/user/lsp/lsp-installer.lua | 5 +++++ lua/user/lsp/settings/jsonls.lua | 18 ++---------------- lua/user/lsp/settings/pyright.lua | 10 ++++++++++ lua/user/plugins.lua | 2 +- 6 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 lua/user/lsp/settings/pyright.lua (limited to 'lua') diff --git a/init.lua b/init.lua index 8a515b8..dd4c62b 100644 --- a/init.lua +++ b/init.lua @@ -4,3 +4,4 @@ require "user.plugins" require "user.colorscheme" require "user.cmp" require "user.lsp" + diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua index a151214..0ba1fc7 100644 --- a/lua/user/cmp.lua +++ b/lua/user/cmp.lua @@ -102,6 +102,7 @@ cmp.setup { -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind vim_item.menu = ({ nvim_lsp = "[LSP]", + nvim_lua = "[NVIM_LUA]", luasnip = "[Snippet]", buffer = "[Buffer]", path = "[Path]", @@ -111,6 +112,7 @@ cmp.setup { }, sources = { { name = "nvim_lsp" }, + { name = "nvim_lua" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" }, diff --git a/lua/user/lsp/lsp-installer.lua b/lua/user/lsp/lsp-installer.lua index 2fe4af2..f539050 100644 --- a/lua/user/lsp/lsp-installer.lua +++ b/lua/user/lsp/lsp-installer.lua @@ -21,6 +21,11 @@ lsp_installer.on_server_ready(function(server) opts = vim.tbl_deep_extend("force", sumneko_opts, opts) end + if server.name == "pyright" then + local pyright_opts = require("user.lsp.settings.pyright") + opts = vim.tbl_deep_extend("force", pyright_opts, opts) + end + -- This setup() function is exactly the same as lspconfig's setup function. -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md server:setup(opts) diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/user/lsp/settings/jsonls.lua index 1fffa68..be362c9 100644 --- a/lua/user/lsp/settings/jsonls.lua +++ b/lua/user/lsp/settings/jsonls.lua @@ -1,9 +1,4 @@ -local default_schemas = nil -local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") -if status_ok then - default_schemas = jsonls_settings.get_default_schemas() -end - +-- Find more schemas here: https://www.schemastore.org/json/ local schemas = { { description = "TypeScript compiler configuration file", @@ -168,19 +163,10 @@ local schemas = { }, } -local function extend(tab1, tab2) - for _, value in ipairs(tab2) do - table.insert(tab1, value) - end - return tab1 -end - -local extended_schemas = extend(schemas, default_schemas) - local opts = { settings = { json = { - schemas = extended_schemas, + schemas = schemas, }, }, setup = { diff --git a/lua/user/lsp/settings/pyright.lua b/lua/user/lsp/settings/pyright.lua new file mode 100644 index 0000000..6354274 --- /dev/null +++ b/lua/user/lsp/settings/pyright.lua @@ -0,0 +1,10 @@ +return { + settings = { + + python = { + analysis = { + typeCheckingMode = "off" + } + } + }, +} diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 45141e2..17dd7b5 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -56,6 +56,7 @@ return packer.startup(function(use) use "hrsh7th/cmp-cmdline" -- cmdline completions use "saadparwaiz1/cmp_luasnip" -- snippet completions use "hrsh7th/cmp-nvim-lsp" + use "hrsh7th/cmp-nvim-lua" -- snippets use "L3MON4D3/LuaSnip" --snippet engine @@ -64,7 +65,6 @@ return packer.startup(function(use) -- LSP use "neovim/nvim-lspconfig" -- enable LSP use "williamboman/nvim-lsp-installer" -- simple to use language server installer - use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins -- cgit v1.2.3 From 4b0d085006724b6f5a1d6db5b980800db44e0e88 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 21 Dec 2021 17:52:58 -0500 Subject: udpate --- init.lua | 1 + lua/user/keymaps.lua | 5 +++++ lua/user/lsp/settings/jsonls.lua | 17 +---------------- lua/user/plugins.lua | 2 +- lua/user/telescope.lua | 8 ++++++++ 5 files changed, 16 insertions(+), 17 deletions(-) (limited to 'lua') diff --git a/init.lua b/init.lua index 1b3f3e8..8c14215 100644 --- a/init.lua +++ b/init.lua @@ -5,3 +5,4 @@ require "user.colorscheme" require "user.cmp" require "user.lsp" require "user.telescope" + diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index fb8fdb4..28718bb 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -68,3 +68,8 @@ keymap("t", "", "h", term_opts) keymap("t", "", "j", term_opts) keymap("t", "", "k", term_opts) keymap("t", "", "l", term_opts) + +-- keymap("n", "f", "Telescope find_files", opts) +keymap("n", "f", "lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))", opts) +keymap("n", "", "Telescope live_grep", opts) + diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/user/lsp/settings/jsonls.lua index 1fffa68..8ee9544 100644 --- a/lua/user/lsp/settings/jsonls.lua +++ b/lua/user/lsp/settings/jsonls.lua @@ -1,9 +1,3 @@ -local default_schemas = nil -local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") -if status_ok then - default_schemas = jsonls_settings.get_default_schemas() -end - local schemas = { { description = "TypeScript compiler configuration file", @@ -168,19 +162,10 @@ local schemas = { }, } -local function extend(tab1, tab2) - for _, value in ipairs(tab2) do - table.insert(tab1, value) - end - return tab1 -end - -local extended_schemas = extend(schemas, default_schemas) - local opts = { settings = { json = { - schemas = extended_schemas, + schemas = schemas, }, }, setup = { diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index c8a32cb..b173f9b 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -64,10 +64,10 @@ return packer.startup(function(use) -- LSP use "neovim/nvim-lspconfig" -- enable LSP use "williamboman/nvim-lsp-installer" -- simple to use language server installer - use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for -- Telescope use "nvim-telescope/telescope.nvim" + use 'nvim-telescope/telescope-media-files.nvim' -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua index 0706b51..d4bf410 100644 --- a/lua/user/telescope.lua +++ b/lua/user/telescope.lua @@ -3,6 +3,8 @@ if not status_ok then return end +telescope.load_extension('media_files') + local actions = require "telescope.actions" telescope.setup { @@ -87,6 +89,12 @@ telescope.setup { -- builtin picker }, extensions = { + media_files = { + -- filetypes whitelist + -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} + filetypes = {"png", "webp", "jpg", "jpeg"}, + find_cmd = "rg" -- find command (defaults to `fd`) + } -- Your extension configuration goes here: -- extension_name = { -- extension_config_key = value, -- cgit v1.2.3 From 5b2777816a17b2d56c18cedb7b8bc1975539645e Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 28 Dec 2021 02:28:15 -0500 Subject: update --- lua/user/lsp/settings/jsonls.lua | 17 +---------------- lua/user/plugins.lua | 2 ++ lua/user/treesitter.lua | 23 +++++++++++++++++------ 3 files changed, 20 insertions(+), 22 deletions(-) (limited to 'lua') diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/user/lsp/settings/jsonls.lua index 1fffa68..8ee9544 100644 --- a/lua/user/lsp/settings/jsonls.lua +++ b/lua/user/lsp/settings/jsonls.lua @@ -1,9 +1,3 @@ -local default_schemas = nil -local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") -if status_ok then - default_schemas = jsonls_settings.get_default_schemas() -end - local schemas = { { description = "TypeScript compiler configuration file", @@ -168,19 +162,10 @@ local schemas = { }, } -local function extend(tab1, tab2) - for _, value in ipairs(tab2) do - table.insert(tab1, value) - end - return tab1 -end - -local extended_schemas = extend(schemas, default_schemas) - local opts = { settings = { json = { - schemas = extended_schemas, + schemas = schemas, }, }, setup = { diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index af7dfb1..87dc269 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -74,6 +74,8 @@ return packer.startup(function(use) "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", } + use "p00f/nvim-ts-rainbow" + use "nvim-treesitter/playground" -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index f00cc2d..7d45bd4 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -1,16 +1,27 @@ -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end + + + + + + + + + + + + + +local configs = require("nvim-treesitter.configs") configs.setup { - ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages - sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) + ensure_installed = "maintained", + sync_install = false, ignore_install = { "" }, -- List of parsers to ignore installing highlight = { enable = true, -- false will disable the whole extension disable = { "" }, -- list of language that will be disabled additional_vim_regex_highlighting = true, + }, indent = { enable = true, disable = { "yaml" } }, } -- cgit v1.2.3 From dd004512f2850c894753b15a6a8a2147088f1cb4 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 2 Jan 2022 13:41:33 -0500 Subject: updates --- lua/user/nvim-tree.lua | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'lua') diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua index 9c5170c..e80e04b 100644 --- a/lua/user/nvim-tree.lua +++ b/lua/user/nvim-tree.lua @@ -64,14 +64,6 @@ nvim_tree.setup { update_cwd = true, ignore_list = {}, }, - system_open = { - cmd = nil, - args = {}, - }, - filters = { - dotfiles = false, - custom = {}, - }, git = { enable = true, ignore = true, @@ -94,10 +86,6 @@ nvim_tree.setup { number = false, relativenumber = false, }, - trash = { - cmd = "trash", - require_confirm = true, - }, quit_on_open = 0, git_hl = 1, disable_window_picker = 0, -- cgit v1.2.3 From efd287ffa01e611a0981b34e70538528e5e96fdb Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 2 Jan 2022 14:27:12 -0500 Subject: update deprecated diagnostic show --- lua/user/lsp/handlers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index fb8b7f8..5dfde9b 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -76,7 +76,7 @@ local function lsp_keymaps(bufnr) bufnr, "n", "gl", - 'lua vim.lsp.diagnostic.show_line_diagnostics({ border = "rounded" })', + 'lua vim.diagnostic.open_float()', opts ) vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) -- cgit v1.2.3 From a9f3e7f837775601941c51abfcde7eb9ca708241 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 2 Jan 2022 14:28:26 -0500 Subject: remove plugin --- lua/user/plugins.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'lua') diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 614545c..0035ad8 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -70,7 +70,6 @@ return packer.startup(function(use) -- LSP use "neovim/nvim-lspconfig" -- enable LSP use "williamboman/nvim-lsp-installer" -- simple to use language server installer - use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters -- Telescope -- cgit v1.2.3 From 65466d0b009251f5dfc745abfac9540f2b597eb8 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 2 Jan 2022 14:37:51 -0500 Subject: diagnostic flake8 enabled by default --- lua/user/lsp/null-ls.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua index 874e19c..c7d40fd 100644 --- a/lua/user/lsp/null-ls.lua +++ b/lua/user/lsp/null-ls.lua @@ -14,6 +14,6 @@ null_ls.setup({ formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), formatting.black.with({ extra_args = { "--fast" } }), formatting.stylua, - -- diagnostics.flake8 + diagnostics.flake8 }, }) -- cgit v1.2.3 From 8309138032f1bcd6eeb9586994994696f4786204 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 2 Jan 2022 15:13:39 -0500 Subject: updates for video --- lua/user/keymaps.lua | 1 + lua/user/lsp/handlers.lua | 8 +------- lua/user/lsp/null-ls.lua | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 17 deletions(-) (limited to 'lua') diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 638cab5..6140fbd 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -69,3 +69,4 @@ keymap("t", "", "l", term_opts) -- Nvimtree keymap("n", "e", ":NvimTreeToggle", opts) +keymap("n", "f", ":Format", opts) diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index 5dfde9b..4868b79 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -72,13 +72,7 @@ local function lsp_keymaps(bufnr) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "f", "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", - "gl", - 'lua vim.diagnostic.open_float()', - opts - ) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", 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", "q", "lua vim.diagnostic.setloclist()", opts) vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua index c7d40fd..ec79994 100644 --- a/lua/user/lsp/null-ls.lua +++ b/lua/user/lsp/null-ls.lua @@ -1,6 +1,6 @@ local null_ls_status_ok, null_ls = pcall(require, "null-ls") if not null_ls_status_ok then - return + return end -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting @@ -8,12 +8,13 @@ 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.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.yapf, + formatting.stylua, + diagnostics.flake8, + }, +} -- cgit v1.2.3 From eb27d1883384bc7990d43a79f6100967fde7c7b3 Mon Sep 17 00:00:00 2001 From: "Vito G. Graffagnino" Date: Sat, 28 May 2022 11:15:19 +0100 Subject: keymaps: Changed leader key to ',' options: Allowed relative numbers, showmode, removed mouse --- lua/user/keymaps.lua | 6 +++--- lua/user/options.lua | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lua') diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b3eb0d8..e66fca5 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -6,9 +6,9 @@ local term_opts = { silent = true } local keymap = vim.api.nvim_set_keymap --Remap space as leader key -keymap("", "", "", opts) -vim.g.mapleader = " " -vim.g.maplocalleader = " " +-- keymap("", "", "", opts) +vim.g.mapleader = "," +vim.g.maplocalleader = "," -- Modes -- normal_mode = "n", diff --git a/lua/user/options.lua b/lua/user/options.lua index 6b38e23..cf23784 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -7,16 +7,16 @@ local options = { fileencoding = "utf-8", -- the encoding written to a file hlsearch = true, -- highlight all matches on previous search pattern ignorecase = true, -- ignore case in search patterns - mouse = "a", -- allow the mouse to be used in neovim + mouse = "", -- allow the mouse to be used in neovim pumheight = 10, -- pop up menu height - showmode = false, -- we don't need to see things like -- INSERT -- anymore + showmode = true, -- we don't need to see things like -- INSERT -- anymore showtabline = 2, -- always show tabs smartcase = true, -- smart case smartindent = true, -- make indenting smarter again splitbelow = true, -- force all horizontal splits to go below current window splitright = true, -- force all vertical splits to go to the right of current window swapfile = false, -- creates a swapfile - -- termguicolors = true, -- set term gui colors (most terminals support this) + termguicolors = true, -- set term gui colors (most terminals support this) timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) undofile = true, -- enable persistent undo updatetime = 300, -- faster completion (4000ms default) @@ -26,7 +26,7 @@ local options = { tabstop = 2, -- insert 2 spaces for a tab cursorline = true, -- highlight the current line number = true, -- set numbered lines - relativenumber = false, -- set relative numbered lines + relativenumber = true, -- set relative numbered lines numberwidth = 4, -- set number column width to 2 {default 4} signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time wrap = false, -- display lines as one long line -- cgit v1.2.3