diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/default-config.lua | 134 | ||||
| -rw-r--r-- | lua/lsp/clangd.lua | 6 | ||||
| -rw-r--r-- | lua/lsp/dart-ls.lua | 4 | ||||
| -rw-r--r-- | lua/lsp/efm-general-ls.lua | 20 | ||||
| -rw-r--r-- | lua/lsp/js-ts-ls.lua | 6 | ||||
| -rw-r--r-- | lua/lsp/python-ls.lua | 12 | ||||
| -rw-r--r-- | lua/lsp/ruby-ls.lua | 8 | ||||
| -rw-r--r-- | lua/lv-autocommands/init.lua | 12 | ||||
| -rw-r--r-- | lua/lv-globals.lua | 89 | ||||
| -rw-r--r-- | lua/plugins.lua | 137 | 
10 files changed, 196 insertions, 232 deletions
| diff --git a/lua/default-config.lua b/lua/default-config.lua new file mode 100644 index 00000000..5d24d8a0 --- /dev/null +++ b/lua/default-config.lua @@ -0,0 +1,134 @@ +CONFIG_PATH = vim.fn.stdpath('config') +DATA_PATH = vim.fn.stdpath('data') +CACHE_PATH = vim.fn.stdpath('cache') + +O = { +    auto_close_tree = 0, +    auto_complete = true, +    colorscheme = 'lunar', +    hidden_files = true, +    wrap_lines = false, +    number = true, +    relative_number = true, +    cursorline = true, +    shell = 'bash', +    timeoutlen = 100, +    nvim_tree_disable_netrw = 0, +    extras = false, + +    -- @usage pass a table with your desired languages +    treesitter = { +        ensure_installed = "all", +        ignore_install = {"haskell"}, +        highlight = {enabled = true}, +        playground = {enabled = true}, +        rainbow = {enabled = false} +    }, + +    database = {save_location = '~/.config/nvcode_db', auto_execute = 1}, + +    lang = { +        python = { +            linter = '', +            -- @usage can be 'yapf', 'black' +            formatter = '', +            autoformat = false, +            isort = false, +            diagnostics = { +                virtual_text = {spacing = 0, prefix = "ï„‘"}, +                signs = true, +                underline = true +            }, +            analysis = { +                type_checking = "basic", +                auto_search_paths = true, +                use_library_code_types = true +            } +        }, +        dart = { +            sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot' +        }, +        lua = { +            -- @usage can be 'lua-format' +            formatter = '', +            autoformat = false, +            diagnostics = { +                virtual_text = {spacing = 0, prefix = "ï„‘"}, +                signs = true, +                underline = true +            } +        }, +        sh = { +            -- @usage can be 'shellcheck' +            linter = '', +            -- @usage can be 'shfmt' +            formatter = '', +            autoformat = false, +            diagnostics = { +                virtual_text = {spacing = 0, prefix = "ï„‘"}, +                signs = true, +                underline = true +            } +        }, +        tsserver = { +            -- @usage can be 'eslint' +            linter = '', +            -- @usage can be 'prettier' +            formatter = '', +            autoformat = false, +            diagnostics = { +                virtual_text = {spacing = 0, prefix = "ï„‘"}, +                signs = true, +                underline = true +            } +        }, +        json = { +            -- @usage can be 'prettier' +            formatter = '', +            autoformat = false, +            diagnostics = { +                virtual_text = {spacing = 0, prefix = "ï„‘"}, +                signs = true, +                underline = true +            } +        }, +        tailwindls = { +            filetypes = { +                'html', 'css', 'scss', 'javascript', 'javascriptreact', +                'typescript', 'typescriptreact' +            } +        }, +        clang = { +            diagnostics = { +                virtual_text = {spacing = 0, prefix = "ï„‘"}, +                signs = true, +                underline = true +            } +        }, +        ruby = { +            diagnostics = { +                virtualtext = {spacing = 0, prefix = "ï„‘"}, +                signs = true, +                underline = true +            }, +            filetypes = {'rb', 'erb', 'rakefile'} +        }, +        go = {} +        -- css = {formatter = '', autoformat = false, virtual_text = true}, +        -- json = {formatter = '', autoformat = false, virtual_text = true} + +    }, + +    dashboard = { +        custom_header = { +            '                 _..._                                                                           ', +            '               .\'   (_`.    _                         __     ___           ', +            '              :  .      :  | |   _   _ _ __   __ _ _ _\\ \\   / (_)_ __ ___  ', +            '              :)    ()  :  | |  | | | | \'_ \\ / _` | \'__\\ \\ / /| | \'_ ` _ \\ ', +            '              `.   .   .\'  | |__| |_| | | | | (_| | |   \\ V / | | | | | | |', +            '                `-...-\'    |_____\\__,_|_| |_|\\__,_|_|    \\_/  |_|_| |_| |_|' +        }, +        footer = {'chrisatmachine.com'} +    } +} + diff --git a/lua/lsp/clangd.lua b/lua/lsp/clangd.lua index dbbda084..594c375b 100644 --- a/lua/lsp/clangd.lua +++ b/lua/lsp/clangd.lua @@ -3,9 +3,9 @@ require'lspconfig'.clangd.setup {      on_attach = require'lsp'.common_on_attach,      handlers = {          ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { -            virtual_text = O.clang.diagnostics.virtual_text, -            signs = O.clang.diagnostics.signs, -            underline = O.clang.diagnostics.underline, +            virtual_text = O.lang.clang.diagnostics.virtual_text, +            signs = O.lang.clang.diagnostics.signs, +            underline = O.lang.clang.diagnostics.underline,              update_in_insert = true          }) diff --git a/lua/lsp/dart-ls.lua b/lua/lsp/dart-ls.lua index 99f41311..fe4898e8 100644 --- a/lua/lsp/dart-ls.lua +++ b/lua/lsp/dart-ls.lua @@ -1,5 +1,5 @@  require'lspconfig'.dartls.setup{ -    cmd = { "dart", O.dart.sdk_path, "--lsp" }, +    cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },      on_attach = require'lsp'.common_on_attach,      init_options = {        closingLabels = false, @@ -8,4 +8,4 @@ require'lspconfig'.dartls.setup{        outline = false,        suggestFromUnimportedLibraries = true      } -}
\ No newline at end of file +} diff --git a/lua/lsp/efm-general-ls.lua b/lua/lsp/efm-general-ls.lua index 24bdde23..da01db12 100644 --- a/lua/lsp/efm-general-ls.lua +++ b/lua/lsp/efm-general-ls.lua @@ -15,13 +15,13 @@ local isort = {formatCommand = "isort --quiet -", formatStdin = true}  local yapf = {formatCommand = "yapf --quiet", formatStdin = true}  local black = {formatCommand = "black --quiet -", formatStdin = true} -if O.python.linter == 'flake8' then table.insert(python_arguments, flake8) end +if O.lang.python.linter == 'flake8' then table.insert(python_arguments, flake8) end -if O.python.isort then table.insert(python_arguments, isort) end +if O.lang.python.isort then table.insert(python_arguments, isort) end -if O.python.formatter == 'yapf' then +if O.lang.python.formatter == 'yapf' then      table.insert(python_arguments, yapf) -elseif O.python.formatter == 'black' then +elseif O.lang.python.formatter == 'black' then      table.insert(python_arguments, black)  end @@ -38,9 +38,9 @@ local lua_fmt = {      formatStdin = true  } -if O.lua.formatter == 'lua-format' then +if O.lang.lua.formatter == 'lua-format' then    table.insert(lua_arguments, luaFormat) -elseif O.lua.formatter == 'lua-fmt' then +elseif O.lang.lua.formatter == 'lua-fmt' then    table.insert(lua_arguments, lua_fmt)  end @@ -54,9 +54,9 @@ local shellcheck = {      lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'}  } -if O.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end +if O.lang.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end -if O.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end +if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end  -- tsserver/web javascript react, vue, json, html, css, yaml  local prettier = {formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true} @@ -74,9 +74,9 @@ local eslint = {  local tsserver_args = {} -if O.tsserver.formatter == 'prettier' then table.insert(tsserver_args, prettier) end +if O.lang.tsserver.formatter == 'prettier' then table.insert(tsserver_args, prettier) end -if O.tsserver.linter == 'eslint' then table.insert(tsserver_args, eslint) end +if O.lang.tsserver.linter == 'eslint' then table.insert(tsserver_args, eslint) end  -- local markdownlint = {  --     -- TODO default to global lintrc diff --git a/lua/lsp/js-ts-ls.lua b/lua/lsp/js-ts-ls.lua index 4eca1e57..94e1b72d 100644 --- a/lua/lsp/js-ts-ls.lua +++ b/lua/lsp/js-ts-ls.lua @@ -18,9 +18,9 @@ require'lspconfig'.tsserver.setup {      settings = {documentFormatting = false},      handlers = {          ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { -            virtual_text = O.tsserver.diagnostics.virtual_text, -            signs = O.tsserver.diagnostics.signs, -            underline = O.tsserver.diagnostics.underline, +            virtual_text = O.lang.tsserver.diagnostics.virtual_text, +            signs = O.lang.tsserver.diagnostics.signs, +            underline = O.lang.tsserver.diagnostics.underline,              update_in_insert = true          }) diff --git a/lua/lsp/python-ls.lua b/lua/lsp/python-ls.lua index f9af265e..7ffcbb25 100644 --- a/lua/lsp/python-ls.lua +++ b/lua/lsp/python-ls.lua @@ -4,18 +4,18 @@ require'lspconfig'.pyright.setup {      on_attach = require'lsp'.common_on_attach,      handlers = {          ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { -            virtual_text = O.python.diagnostics.virtual_text, -            signs = O.python.diagnostics.signs, -            underline = O.python.diagnostics.underline, +            virtual_text = O.lang.python.diagnostics.virtual_text, +            signs = O.lang.python.diagnostics.signs, +            underline = O.lang.python.diagnostics.underline,              update_in_insert = true          })      },  	 settings = {        python = {          analysis = { -		  typeCheckingMode = O.python.analysis.type_checking, -		  autoSearchPaths = O.python.analysis.auto_search_paths, -          useLibraryCodeForTypes = O.python.analysis.use_library_code_types +		  typeCheckingMode = O.lang.python.analysis.type_checking, +		  autoSearchPaths = O.lang.python.analysis.auto_search_paths, +          useLibraryCodeForTypes = O.lang.python.analysis.use_library_code_types          }        }      } diff --git a/lua/lsp/ruby-ls.lua b/lua/lsp/ruby-ls.lua index fd314e8e..079616b1 100644 --- a/lua/lsp/ruby-ls.lua +++ b/lua/lsp/ruby-ls.lua @@ -4,12 +4,12 @@ require'lspconfig'.solargraph.setup {      on_attach = require'lsp'.common_on_attach,      handlers = {          ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { -            virtual_text = O.ruby.diagnostics.virtual_text, -            signs = O.ruby.diagnostics.signs, -            underline = O.ruby.diagnostics.underline, +            virtual_text = O.lang.ruby.diagnostics.virtual_text, +            signs = O.lang.ruby.diagnostics.signs, +            underline = O.lang.ruby.diagnostics.underline,              update_in_insert = true          })      }, -    filetypes = O.ruby.filetypes, +    filetypes = O.lang.ruby.filetypes,  } diff --git a/lua/lv-autocommands/init.lua b/lua/lv-autocommands/init.lua index c5b70cc3..e6674292 100644 --- a/lua/lv-autocommands/init.lua +++ b/lua/lv-autocommands/init.lua @@ -3,13 +3,13 @@ local utils = require('lv-utils')  local auto_formatters = {            }  local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end +if O.lang.python.autoformat then table.insert(auto_formatters, python_autoformat) end  local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}  local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}  local typescript_autoformat = {'BufWritePre', '*.ts', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}  local typescriptreact_autoformat = {'BufWritePre', '*.tsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.tsserver.autoformat then +if O.lang.tsserver.autoformat then      table.insert(auto_formatters, javascript_autoformat)      table.insert(auto_formatters, javascriptreact_autoformat)  	table.insert(auto_formatters, typescript_autoformat) @@ -17,16 +17,16 @@ if O.tsserver.autoformat then  end  local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.lua.autoformat then table.insert(auto_formatters, lua_format) end +if O.lang.lua.autoformat then table.insert(auto_formatters, lua_format) end  local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.json.autoformat then table.insert(auto_formatters, json_format) end +if O.lang.json.autoformat then table.insert(auto_formatters, json_format) end  local ruby_format = {'BufWritePre', '*.rb', 'lua vim.lsp.buf.formatting_sync(nil,1000)'} -if O.ruby.autoformat then table.insert(auto_formatters, ruby_format) end +if O.lang.ruby.autoformat then table.insert(auto_formatters, ruby_format) end  local go_format = {'BufWritePre', '*.go', 'lua vim.lsp.buf.formatting_sync(nil,1000)'} -if O.go.autoformat then table.insert(auto_formatters, go_format) end +if O.lang.go.autoformat then table.insert(auto_formatters, go_format) end  utils.define_augroups({      _general_settings = { diff --git a/lua/lv-globals.lua b/lua/lv-globals.lua deleted file mode 100644 index 3fb72aa9..00000000 --- a/lua/lv-globals.lua +++ /dev/null @@ -1,89 +0,0 @@ -CONFIG_PATH = vim.fn.stdpath('config') -DATA_PATH = vim.fn.stdpath('data') -CACHE_PATH = vim.fn.stdpath('cache') - -O = { -    auto_close_tree = 0, -    auto_complete = true, -    colorscheme = 'lunar', -    hidden_files = true, -    wrap_lines = false, -    number = true, -    relative_number = true, -    cursorline = true, -    shell = 'bash', -	timeoutlen = 100, -    nvim_tree_disable_netrw = 0, -    extras = false, - -    -- @usage pass a table with your desired languages -    treesitter = { -        ensure_installed = "all", -        ignore_install = {"haskell"}, -        highlight = {enabled = true}, -        playground = {enabled = true}, -        rainbow = {enabled = false} -    }, - -    database = {save_location = '~/.config/nvcode_db', auto_execute = 1}, -    python = { -        linter = '', -        -- @usage can be 'yapf', 'black' -        formatter = '', -        autoformat = false, -        isort = false, -        diagnostics = {virtual_text = {spacing = 0, prefix = "ï„‘"}, signs = true, underline = true}, -		analysis = {type_checking = "basic", auto_search_paths = true, use_library_code_types = true} -    }, -    dart = {sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot'}, -    lua = { -        -- @usage can be 'lua-format' -        formatter = '', -        autoformat = false, -        diagnostics = {virtual_text = {spacing = 0, prefix = "ï„‘"}, signs = true, underline = true} -    }, -    sh = { -        -- @usage can be 'shellcheck' -        linter = '', -        -- @usage can be 'shfmt' -        formatter = '', -        autoformat = false, -        diagnostics = {virtual_text = {spacing = 0, prefix = "ï„‘"}, signs = true, underline = true} -    }, -    tsserver = { -        -- @usage can be 'eslint' -        linter = '', -        -- @usage can be 'prettier' -        formatter = '', -        autoformat = false, -        diagnostics = {virtual_text = {spacing = 0, prefix = "ï„‘"}, signs = true, underline = true} -    }, -    json = { -        -- @usage can be 'prettier' -        formatter = '', -        autoformat = false, -        diagnostics = {virtual_text = {spacing = 0, prefix = "ï„‘"}, signs = true, underline = true} -    }, -    tailwindls = {filetypes = {'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}}, -    clang = {diagnostics = {virtual_text = {spacing = 0, prefix = "ï„‘"}, signs = true, underline = true}}, -	ruby = { -		diagnostics = {virtualtext = {spacing = 0, prefix = "ï„‘"}, signs = true, underline = true}, -		filetypes = {'rb', 'erb', 'rakefile'} -	}, -    go = {}, -    -- css = {formatter = '', autoformat = false, virtual_text = true}, -    -- json = {formatter = '', autoformat = false, virtual_text = true} - -	dashboard = { -		custom_header = { -'                 _..._                                                                           ', -'               .\'   (_`.    _                         __     ___           ', -'              :  .      :  | |   _   _ _ __   __ _ _ _\\ \\   / (_)_ __ ___  ', -'              :)    ()  :  | |  | | | | \'_ \\ / _` | \'__\\ \\ / /| | \'_ ` _ \\ ', -'              `.   .   .\'  | |__| |_| | | | | (_| | |   \\ V / | | | | | | |', -'                `-...-\'    |_____\\__,_|_| |_|\\__,_|_|    \\_/  |_|_| |_| |_|', -		}, -		footer= {'chrisatmachine.com'} -	} -} - diff --git a/lua/plugins.lua b/lua/plugins.lua index 40516ae5..20d0a167 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -34,48 +34,13 @@ return require("packer").startup(function(use)      use "wbthomason/packer.nvim"      -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) -    use { -        "neovim/nvim-lspconfig" - -        -- event = "BufRead",  -        -- config = function() -        --     require("lsp").config() -        -- end -    } -    use { -        "glepnir/lspsaga.nvim" - -        -- event = "BufRead",  - -        -- opt = true -    } -    use { -        "kabouzeid/nvim-lspinstall" - -        -- event = "BufRead",  -        -- opt = true - -    } +    use {"neovim/nvim-lspconfig"} +    use {"glepnir/lspsaga.nvim"} +    use {"kabouzeid/nvim-lspinstall"}      -- Telescope -    use { -        "nvim-lua/popup.nvim" - -        -- opt = true - -    } -    use { -        "nvim-lua/plenary.nvim" - -        -- opt = true - -    } -    use { -        "nvim-telescope/telescope.nvim" - -        -- cmd = "Telescope", - -        -- opt = true -    } +    use {"nvim-lua/popup.nvim"} +    use {"nvim-lua/plenary.nvim"} +    use {"nvim-telescope/telescope.nvim"}      -- Autocomplete      use { @@ -87,29 +52,15 @@ return require("packer").startup(function(use)      }      -- Treesitter -    use { -        "nvim-treesitter/nvim-treesitter", - -        -- event = "BufRead", -        -- config = function() -        --     require('lv-treesitter').config() -        -- end, - -        run = ":TSUpdate" -    } - -    -- Explorer -    -- use {"kyazdani42/nvim-tree.lua", opt = true} +    use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}      use {          "kyazdani42/nvim-tree.lua",          cmd = "NvimTreeToggle",          config = function() -            -- require_plugin("lv-nvimtree")              require("lv-nvimtree").config()          end -        -- opt = true      }      -- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'} @@ -117,28 +68,13 @@ return require("packer").startup(function(use)          "lewis6991/gitsigns.nvim",          config = function() -            -- require_plugin("nvim-compe")              require("lv-gitsigns").config()          end,          event = "BufRead" - -        -- opt = true -      } -    use { -        "folke/which-key.nvim" - -        -- opt = true - -    } -    use { -        "windwp/nvim-autopairs" -        -- event = "InsertEnter",  - -        -- opt = true - -    } +    use {"folke/which-key.nvim"} +    use {"windwp/nvim-autopairs"}      -- Comments      use { @@ -147,31 +83,21 @@ return require("packer").startup(function(use)          config = function()              require('nvim_comment').setup()          end -        -- opt = true      }      -- Color      use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}      -- Icons -    use { -        "kyazdani42/nvim-web-devicons" -        -- opt = true - -    } +    use {"kyazdani42/nvim-web-devicons"}      -- Status Line and Bufferline -    use { -        "glepnir/galaxyline.nvim" - -        -- opt = true -    } +    use {"glepnir/galaxyline.nvim"}      use {          "romgrk/barbar.nvim",          config = function() -            -- require_plugin("barbar.nvim")              vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>',                                      {noremap = true, silent = true})              vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>', @@ -180,32 +106,25 @@ return require("packer").startup(function(use)                                      {noremap = true, silent = true})          end -        -- opt = true - -    } - -    use { -        "hrsh7th/vim-vsnip" - -        -- opt = true -      } -    -- require_plugin("nvim-lspconfig") -    -- require_plugin("lspsaga.nvim") -    -- require_plugin("nvim-lspinstall") -    -- require_plugin("popup.nvim") -    -- require_plugin("plenary.nvim") -    -- require_plugin("telescope.nvim") -    -- require_plugin("nvim-treesitter") -    -- require_plugin("nvim-comment") -    -- require_plugin("nvim-tree.lua") -    -- require_plugin("gitsigns.nvim") -    -- require_plugin("which-key.nvim") -    -- require_plugin("nvim-autopairs") -    -- require_plugin("nvim-web-devicons") -    -- require_plugin("galaxyline.nvim") -    -- require_plugin("vim-vsnip") +    use {"hrsh7th/vim-vsnip"} + +    -- extras +    -- if O.matchup then require('lv-matchup') end +    --     require('lv-rnvimr') +    --     require('lv-gitblame') +    --     require('lv-numb') +    --     require('lv-dial') +    --     require('lv-hop') +    --     require('lv-colorizer') +    --     require('lv-spectre') +    --     require('lv-symbols-outline') +    --     require('lv-vimtex') +    --     require('lv-zen') +    --     require('lv-dashboard') +    --     require('lv-lsp-rooter') +    -- end      -- Extras      if O.extras then | 
