This commit is contained in:
ksyasuda 2023-08-11 18:12:35 -07:00
parent e0a811ea58
commit e582ebeab1
No known key found for this signature in database
7 changed files with 286 additions and 344 deletions

View File

@ -36,6 +36,7 @@ source ~/.config/nvim/plugin-confs/nvim-cmp.lua
source ~/.config/nvim/plugin-confs/fidget.lua
source ~/.config/nvim/plugin-confs/symbols-outline.lua
source ~/.config/nvim/plugin-confs/chatgpt.lua
source ~/.config/nvim/plugin-confs/nvim-colorizer.lua
" source ~/.config/nvim/plugin-confs/copilot.lua
" source ~/.config/nvim/plugin-confs/lsp-signature.lua
" source ~/.config/nvim/plugin-confs/nvim-docs-view.lua
@ -75,7 +76,6 @@ command! Env execute ":Dotenv .env"
command! MakeTags !ctags -R .
command! Ovewrite execute ":w !sudo tee %"
command! PS execute ":PackerSync"
command! Aniwrapper execute ":FloatermNew aniwrapper -qtdoomone -D 144"
" set termguicolors
" colorscheme doom-one

View File

@ -4,7 +4,9 @@ require('packer').startup(function(use)
use 'nvim-lua/plenary.nvim'
use {
'nvim-treesitter/nvim-treesitter',
run = function() require('nvim-treesitter.install').update({ with_sync = true }) end,
run = function()
require('nvim-treesitter.install').update({ with_sync = true })
end
}
use {
@ -12,11 +14,10 @@ require('packer').startup(function(use)
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
use {
"zbirenbaum/copilot.lua",
event = "VimEnter",
config = function ()
config = function()
vim.defer_fn(function()
require('copilot').setup({
panel = {
@ -32,7 +33,7 @@ require('packer').startup(function(use)
layout = {
position = "right", -- | top | left | right
ratio = 0.4
},
}
},
suggestion = {
enabled = false,
@ -43,8 +44,8 @@ require('packer').startup(function(use)
-- accept = "<Right>",
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
dismiss = "<C-]>"
}
},
-- filetypes = {
-- yaml = false,
@ -58,29 +59,30 @@ require('packer').startup(function(use)
-- ["."] = false,
-- },
copilot_node_command = 'node', -- Node version must be < 18
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
plugin_manager_path = vim.fn.stdpath("data") ..
"/site/pack/packer",
server_opts_overrides = {
trace = "verbose",
settings = {
advanced = {
listCount = 10, -- #completions for panel
inlineSuggestCount = 4, -- #completions for getCompletions
inlineSuggestCount = 4 -- #completions for getCompletions
}
}
},
}
})
require("copilot.suggestion").toggle_auto_trigger()
end, 100)
end,
end
}
use {
"zbirenbaum/copilot-cmp",
-- after = { "copilot.lua" },
config = function ()
config = function()
require("copilot_cmp").setup({
suggestion = { enabled = false },
panel = { enabled = false },
panel = { enabled = false }
-- method = "getCompletionsCycling",
-- formatters = {
-- insert_text = require("copilot_cmp.format").remove_existing
@ -89,10 +91,7 @@ require('packer').startup(function(use)
end
}
use {
'junegunn/fzf',
run = function() vim.fn['fzf#install']() end
}
use { 'junegunn/fzf', run = function() vim.fn['fzf#install']() end }
-- use {
-- "lewis6991/hover.nvim",
@ -131,7 +130,7 @@ require('packer').startup(function(use)
-- end
-- }
use 'ap/vim-css-color'
use 'norcalli/nvim-colorizer.lua'
use 'jiangmiao/auto-pairs'
use 'junegunn/fzf.vim'
use 'pechorin/any-jump.vim'
@ -140,87 +139,47 @@ require('packer').startup(function(use)
use 'voldikss/vim-floaterm'
use 'wakatime/vim-wakatime'
use {
'akinsho/nvim-bufferline.lua'
}
use {
'andweeb/presence.nvim'
}
use {
'folke/which-key.nvim'
}
use {
'glepnir/dashboard-nvim'
}
use {
'kyazdani42/nvim-tree.lua'
}
use { 'akinsho/nvim-bufferline.lua' }
use { 'andweeb/presence.nvim' }
use { 'folke/which-key.nvim' }
use { 'glepnir/dashboard-nvim' }
use { 'kyazdani42/nvim-tree.lua' }
use 'kyazdani42/nvim-web-devicons'
use {
'lewis6991/gitsigns.nvim'
}
use {
'nvim-telescope/telescope.nvim'
}
use {
'nvim-telescope/telescope-file-browser.nvim'
}
use { 'lewis6991/gitsigns.nvim' }
use { 'nvim-telescope/telescope.nvim' }
use { 'nvim-telescope/telescope-file-browser.nvim' }
use {
'ojroques/nvim-lspfuzzy'
}
use { 'ojroques/nvim-lspfuzzy' }
use 'L3MON4D3/LuaSnip'
-- use 'amrbashir/nvim-docs-view'
use { 'hrsh7th/nvim-cmp' }
use { 'hrsh7th/cmp-nvim-lsp' }
use { 'hrsh7th/cmp-nvim-lua' }
use { 'hrsh7th/cmp-nvim-lsp-signature-help' }
use { 'hrsh7th/cmp-path' }
use { 'hrsh7th/cmp-cmdline' }
use { 'hrsh7th/cmp-buffer' }
use { 'hrsh7th/cmp-nvim-lsp-document-symbol' }
use {
'hrsh7th/nvim-cmp'
'j-hui/fidget.nvim',
tag = 'legacy',
config = function()
require("fidget").setup {
-- options
}
use {
'hrsh7th/cmp-nvim-lsp'
}
use {
'hrsh7th/cmp-nvim-lua'
}
use {
'hrsh7th/cmp-nvim-lsp-signature-help'
}
use {
'hrsh7th/cmp-path'
}
use {
'hrsh7th/cmp-cmdline'
}
use {
'hrsh7th/cmp-buffer'
}
use {
'hrsh7th/cmp-nvim-lsp-document-symbol'
}
use {
'j-hui/fidget.nvim'
}
use {
'jose-elias-alvarez/null-ls.nvim'
}
use {
'ksyasuda/lsp_lines.nvim'
}
use {
'neovim/nvim-lspconfig'
}
use {
'onsails/lspkind-nvim'
end
}
use { 'jose-elias-alvarez/null-ls.nvim' }
use { 'ksyasuda/lsp_lines.nvim' }
use { 'neovim/nvim-lspconfig' }
use { 'onsails/lspkind-nvim' }
-- use 'ray-x/lsp_signature.nvim'
use {
'rmagatti/goto-preview'
}
use { 'rmagatti/goto-preview' }
use 'saadparwaiz1/cmp_luasnip'
use 'williamboman/nvim-lsp-installer'
use {
'Mofiqul/dracula.nvim'
}
use { 'Mofiqul/dracula.nvim' }
use {
'NTBBloodbath/doom-one.nvim',
setup = function()
@ -253,20 +212,15 @@ require('packer').startup(function(use)
vim.g.doom_one_plugin_indent_blankline = true
vim.g.doom_one_plugin_vim_illuminate = false
vim.g.doom_one_plugin_lspsaga = true
end,
}
use {
'olimorris/onedarkpro.nvim'
}
use {
'projekt0n/github-nvim-theme'
end
}
use { 'olimorris/onedarkpro.nvim' }
use { 'projekt0n/github-nvim-theme' }
use({
"jackMort/ChatGPT.nvim",
requires = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
}
})
@ -274,4 +228,9 @@ require('packer').startup(function(use)
use 'khaveesh/vim-fish-syntax'
use { "catppuccin/nvim", as = "catppuccin" }
use({
"iamcco/markdown-preview.nvim",
run = function() vim.fn["mkdp#util#install"]() end
})
end)

View File

@ -6,7 +6,7 @@ local l = vim.lsp
g.mapleader = " "
g.maplocalleader = ','
g.fzf_command = 'fzf --height 90% --width=85% --layout=reverse --preview "bat --color=always {}"'
o.completeopt="menu,menuone,noselect"
o.completeopt = "menu,menuone,noselect"
o.showmode = false
o.termguicolors = true
o.background = 'dark'
@ -30,7 +30,7 @@ o.cursorline = true
o.scrolloff = 8
o.sidescrolloff = 8
o.wildmenu = true
o.wildignore= '.git,.hg,.svn,CVS,.DS_Store,.idea,.vscode,.vscode-test,node_modules'
o.wildignore = '.git,.hg,.svn,CVS,.DS_Store,.idea,.vscode,.vscode-test,node_modules'
o.showmatch = true
o.list = true
o.listchars = 'tab:»·,trail:·,nbsp:·,extends:>,precedes:<'
@ -41,7 +41,8 @@ o.hidden = true
o.cmdheight = 1
o.updatetime = 300
o.timeoutlen = 500
o.pumwidth=35
o.pumwidth = 35
o.foldmethod = 'marker'
local border = {
{ "", "FloatBorder" },

View File

@ -15,12 +15,12 @@ require("null-ls").setup({
sources = {
-- null_ls.builtins.completion.spell,
null_ls.builtins.completion.luasnip,
null_ls.builtins.code_actions.gitsigns,
-- null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.code_actions.shellcheck,
null_ls.builtins.diagnostics.cppcheck,
null_ls.builtins.diagnostics.gitlint,
null_ls.builtins.diagnostics.jsonlint,
-- require("null-ls").builtins.diagnostics.luacheck,
require("null-ls").builtins.diagnostics.luacheck,
null_ls.builtins.diagnostics.markdownlint,
-- null_ls.builtins.diagnostics.sqlfluff.with({
-- extra_args = {
@ -31,28 +31,26 @@ require("null-ls").setup({
null_ls.builtins.diagnostics.pylint,
null_ls.builtins.diagnostics.pydocstyle.with({
extra_args = { "--config=$ROOT/setup.cfg" }
}),
null_ls.builtins.diagnostics.vint,
}), null_ls.builtins.diagnostics.vint,
null_ls.builtins.diagnostics.shellcheck.with({
extra_args = { "-s", "bash", "-o", "add-default-case, check-set-e-suppressed, check-unassigned-uppercase, deprecate-which, quote-safe-variables" }
}),
null_ls.builtins.diagnostics.ansiblelint,
extra_args = {
"-s", "bash", "-o",
"add-default-case, check-set-e-suppressed, check-unassigned-uppercase, deprecate-which, quote-safe-variables"
}
}), null_ls.builtins.diagnostics.ansiblelint,
null_ls.builtins.formatting.json_tool,
-- require("null-ls").builtins.formatting.lua_format,
require("null-ls").builtins.formatting.lua_format,
null_ls.builtins.formatting.markdownlint,
null_ls.builtins.formatting.prettier,
-- handled by lsp server
null_ls.builtins.formatting.prettier, -- handled by lsp server
-- require("null-ls").builtins.formatting.rustfmt,
null_ls.builtins.formatting.shfmt.with({
filetypes = { "sh", "bash" },
extra_args = { "-i", "0", "-ci", "-sr" }
}),
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.djlint,
}), null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort, null_ls.builtins.formatting.djlint
-- null_ls.builtins.hover.printenv
-- null_ls.builtins.formatting.tidy
},
}
})
-- local markdownlint = {

View File

@ -7,18 +7,18 @@ local luasnip = require 'luasnip'
local highlight = require('cmp.utils.highlight')
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
return false
end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
return col ~= 0 and
vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match(
"^%s*$") == nil
end
lspkind.init({
symbol_map = {
Copilot = "",
},
})
lspkind.init({ symbol_map = { Copilot = "" } })
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", {fg ="#6CC644"})
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" })
cmp.setup({
snippet = {
@ -27,7 +27,7 @@ cmp.setup({
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
end
},
capabilities = capabilities,
mapping = {
@ -59,7 +59,7 @@ cmp.setup({
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
select = false
},
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
@ -80,10 +80,8 @@ cmp.setup({
end
end),
['<S-Tab>'] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
end
end, { "i", "s"}),
if cmp.visible() then cmp.select_prev_item() end
end, { "i", "s" })
},
window = {
completion = {
@ -92,28 +90,14 @@ cmp.setup({
side_padding = 0,
border = "rounded",
borderchars = {
"",
"",
"",
"",
"",
"",
"",
"",
},
"", "", "", "", "", "", "", ""
}
},
documentation = {
border = "rounded",
borderchars = {
"",
"",
"",
"",
"",
"",
"",
"",
},
"", "", "", "", "", "", "", ""
}
-- padding = 15,
}
},
@ -150,15 +134,15 @@ cmp.setup({
Constant = "󰏿",
Struct = "",
Event = "",
TypeParameter = "󰅲",
},
TypeParameter = "󰅲"
}
})(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. strings[1] .. " "
kind.menu = " (" .. strings[2] .. ")"
return kind
end,
end
-- format = lspkind.cmp_format({
-- mode = 'symbol_text', -- show only symbol annotations
-- menu = ({
@ -171,8 +155,7 @@ cmp.setup({
-- })
},
sources = cmp.config.sources({
{ name = "copilot", group_index = 2 },
{ name = "path", group_index = 2 },
{ name = "copilot", group_index = 2 }, { name = "path", group_index = 2 },
{ name = 'nvim_lsp', group_index = 2 },
{ name = 'nvim_lsp_signature_help', group_index = 2 },
{ name = 'nvim_lsp_document_symbol', group_index = 2 },
@ -191,9 +174,7 @@ cmp.setup({
}
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
}),
}, { { name = 'buffer' } }),
sorting = {
priority_weight = 2,
comparators = {
@ -208,52 +189,40 @@ cmp.setup({
-- Below is the default comparitor list and order for nvim-cmp
cmp.config.compare.offset,
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
cmp.config.compare.exact, cmp.config.compare.score,
cmp.config.compare.recently_used, cmp.config.compare.locality,
cmp.config.compare.kind, cmp.config.compare.sort_text,
cmp.config.compare.length, cmp.config.compare.order
}
}
})
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
sources = { { name = 'buffer' } }
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{
name = 'cmdline',
option = {
ignore_cmds = { 'Man', '!' }
}
}
sources = cmp.config.sources({ { name = 'path' } }, {
{ name = 'cmdline', option = { ignore_cmds = { 'Man', '!' } } }
})
})
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local servers = { 'bashls', 'jedi_language_server', 'sqlls', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls', 'html', 'cssls', 'lua_ls' }
local servers = {
'bashls', 'jedi_language_server', 'sqlls', 'jsonls', 'yamlls', 'vimls',
'dotls', 'dockerls', 'html', 'cssls', 'lua_ls'
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
-- on_attach = my_custom_on_attach,
capabilities = capabilities,
capabilities = capabilities
}
end
cmp.event:on("menu_opened", function()
vim.b.copilot_suggestion_hidden = true
end)
cmp.event:on("menu_closed", function()
vim.b.copilot_suggestion_hidden = false
end)
cmp.event:on("menu_opened",
function() vim.b.copilot_suggestion_hidden = true end)
cmp.event:on("menu_closed",
function() vim.b.copilot_suggestion_hidden = false end)

View File

@ -0,0 +1 @@
require 'colorizer'.setup()

View File

@ -1,34 +1,48 @@
require 'nvim-treesitter.configs'.setup {
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
-- ensure_installed = "maintained",
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = {
"c", "lua", "vim", "vimdoc", "query", "cpp", "python", "bash", "sql",
"yaml", "toml", "dockerfile", "gitcommit", "gitignore", "html", "css",
"javascript", "typescript", "rust", "go", "json", "regex", "latex",
"comment", "cmake", "graphql", "haskell", "java", "php", "ruby",
"sparql", "vue"
},
-- Install languages synchronously (only applied to `ensure_installed`)
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- List of parsers to ignore installing
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
-- ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
-- `false` will disable the whole extension
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
-- disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
-- disable = function(lang, buf)
-- local max_filesize = 100 * 1024 -- 100 KB
-- local ok, stats = pcall(vim.loop.fs_stat,
-- vim.api.nvim_buf_get_name(buf))
-- if ok and stats and stats.size > max_filesize then
-- return true
-- end
-- end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
additional_vim_regex_highlighting = false
}
}