mirror of
https://github.com/jessebot/dot_files.git
synced 2025-10-01 01:48:43 +00:00
adding back tab completion and working and help text
This commit is contained in:
parent
23e4169443
commit
3bbda3f453
5 changed files with 138 additions and 32 deletions
|
@ -47,8 +47,8 @@ require('user.dashboard')
|
|||
require('user.lsp-configs')
|
||||
require('user.tree-sitter')
|
||||
|
||||
-- tab completion for coc - conquer of completion; might not need this after lsp-configs...
|
||||
-- vim.cmd.source("~/.config/nvim/vim/coc-nvim.vim")
|
||||
-- completion from nvim-cmp
|
||||
require('user.completion')
|
||||
|
||||
-- folding
|
||||
require('user.folding')
|
||||
|
|
|
@ -97,8 +97,18 @@ return require('packer').startup(function(use)
|
|||
use {'williamboman/mason.nvim'}
|
||||
use {'williamboman/mason-lspconfig.nvim'}
|
||||
|
||||
-- code completion
|
||||
-- use {'neoclide/coc.nvim', branch = 'release'}
|
||||
-- --------- completion for the above language servers and more ----------
|
||||
use {'hrsh7th/cmp-nvim-lsp'}
|
||||
use {'hrsh7th/cmp-buffer'}
|
||||
use {'hrsh7th/cmp-path'}
|
||||
use {'hrsh7th/cmp-cmdline'}
|
||||
-- emojis and nerfont icon completions
|
||||
use {'hrsh7th/cmp-emoji'}
|
||||
use {'chrisgrieser/cmp-nerdfont'}
|
||||
-- nvim lua api completion
|
||||
use {'hrsh7th/cmp-nvim-lua'}
|
||||
-- our preferred neovim autocompletion plugin
|
||||
use {'hrsh7th/nvim-cmp'}
|
||||
|
||||
-- ------------------- fuzzy completion for files ------------------------
|
||||
-- telescope: extendable fuzzy finder over lists
|
||||
|
@ -106,9 +116,6 @@ return require('packer').startup(function(use)
|
|||
requires = {{'nvim-lua/plenary.nvim'} }
|
||||
}
|
||||
|
||||
-- modern fuzzy searcher; not sure if it's really useful in neovim 🤷
|
||||
use {'liuchengxu/vim-clap'}
|
||||
|
||||
-- ------------------------- general linter ------------------------------
|
||||
-- will use common linters and highlight broken code
|
||||
use {'dense-analysis/ale'}
|
||||
|
|
84
.config/nvim/lua/user/completion.lua
Normal file
84
.config/nvim/lua/user/completion.lua
Normal file
|
@ -0,0 +1,84 @@
|
|||
-- Set up nvim-cmp: https://github.com/hrsh7th/nvim-cmp/
|
||||
local cmp = require'cmp'
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||
-- ['<C-e>'] = cmp.mapping.abort(),
|
||||
-- Accept currently selected item.
|
||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = 'color_names'},
|
||||
{ name = 'emoji'},
|
||||
{ name = 'nvim_lua'},
|
||||
{ name = 'nerdfont'},
|
||||
{ name = 'path'},
|
||||
{ name = 'buffer'},
|
||||
})
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
-- cmp.setup.filetype('gitcommit', {
|
||||
-- sources = cmp.config.sources({
|
||||
-- -- You can specify the `cmp_git` source if you were installed it.
|
||||
-- { name = 'cmp_git' },
|
||||
-- }, {
|
||||
-- { name = 'buffer' },
|
||||
-- })
|
||||
-- })
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
-- Set up lspconfig.
|
||||
-- local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
-- require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
|
||||
-- capabilities = capabilities
|
||||
-- }
|
|
@ -92,6 +92,41 @@ _G.packer_plugins = {
|
|||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/opt/barbecue.nvim",
|
||||
url = "https://github.com/utilyre/barbecue.nvim"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-cmdline"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
|
||||
url = "https://github.com/hrsh7th/cmp-cmdline"
|
||||
},
|
||||
["cmp-emoji"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/cmp-emoji",
|
||||
url = "https://github.com/hrsh7th/cmp-emoji"
|
||||
},
|
||||
["cmp-nerdfont"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/cmp-nerdfont",
|
||||
url = "https://github.com/chrisgrieser/cmp-nerdfont"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-nvim-lua"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lua"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
["dashboard-nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/dashboard-nvim",
|
||||
|
@ -125,6 +160,11 @@ _G.packer_plugins = {
|
|||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/nui.nvim",
|
||||
url = "https://github.com/MunifTanjim/nui.nvim"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-colorizer.lua"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua",
|
||||
|
@ -180,12 +220,6 @@ _G.packer_plugins = {
|
|||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["pretty-fold.nvim"] = {
|
||||
config = { "\27LJ\2\n9\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\16pretty-fold\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/pretty-fold.nvim",
|
||||
url = "https://github.com/anuvyklack/pretty-fold.nvim"
|
||||
},
|
||||
["spacechalk.vim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/spacechalk.vim",
|
||||
|
@ -201,11 +235,6 @@ _G.packer_plugins = {
|
|||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/vim-airline",
|
||||
url = "https://github.com/vim-airline/vim-airline"
|
||||
},
|
||||
["vim-clap"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/vim-clap",
|
||||
url = "https://github.com/liuchengxu/vim-clap"
|
||||
},
|
||||
["vim-fugitive"] = {
|
||||
loaded = true,
|
||||
path = "/Users/jhitch/.local/share/nvim/site/pack/packer/start/vim-fugitive",
|
||||
|
@ -229,10 +258,6 @@ _G.packer_plugins = {
|
|||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: pretty-fold.nvim
|
||||
time([[Config for pretty-fold.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\16pretty-fold\frequire\0", "config", "pretty-fold.nvim")
|
||||
time([[Config for pretty-fold.nvim]], false)
|
||||
-- Load plugins in order defined by `after`
|
||||
time([[Sequenced loading]], true)
|
||||
vim.cmd [[ packadd nvim-web-devicons ]]
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
" use <tab> to trigger completion and navigate to the next complete item
|
||||
function! CheckBackspace() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
inoremap <silent><expr> <Tab>
|
||||
\ coc#pum#visible() ? coc#pum#next(1) :
|
||||
\ CheckBackspace() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
Loading…
Add table
Add a link
Reference in a new issue