mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-02 17:14:56 +02:00
back to autopairs
This commit is contained in:
parent
fc5f8c89dc
commit
7d74781ead
4 changed files with 69 additions and 12 deletions
4
init.lua
4
init.lua
|
@ -2,7 +2,6 @@
|
|||
require('plugins')
|
||||
require('nv-globals')
|
||||
require('nv-utils')
|
||||
vim.cmd('luafile ~/.config/nvim/nv-settings.lua')
|
||||
require('nv-autocommands')
|
||||
-- require('config')
|
||||
require('settings')
|
||||
|
@ -63,5 +62,8 @@ require('lsp.efm-general-ls')
|
|||
require('lsp.virtual_text')
|
||||
require('lsp.latex-ls')
|
||||
|
||||
-- User config
|
||||
vim.cmd('luafile ~/.config/nvim/nv-settings.lua')
|
||||
|
||||
-- vim.lsp.callbacks["textDocument/publishDiagnostics"] = function() end
|
||||
-- vim.lsp.handlers["textDocument/publishDiagnostics"] = nil
|
||||
|
|
|
@ -40,12 +40,66 @@
|
|||
--
|
||||
-- remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true})
|
||||
-- TODO switch to lua plugin when possible
|
||||
vim.cmd([[
|
||||
let g:lexima_no_default_rules = v:true
|
||||
call lexima#set_default_rules()
|
||||
inoremap <silent><expr> <C-Space> compe#complete()
|
||||
inoremap <silent><expr> <CR> compe#confirm(lexima#expand('<LT>CR>', 'i'))
|
||||
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
||||
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
||||
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
||||
]])
|
||||
-- vim.cmd([[
|
||||
-- let g:lexima_no_default_rules = v:true
|
||||
-- call lexima#set_default_rules()
|
||||
-- inoremap <silent><expr> <C-Space> compe#complete()
|
||||
-- inoremap <silent><expr> <CR> compe#confirm(lexima#expand('<LT>CR>', 'i'))
|
||||
-- inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
||||
-- inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
||||
-- inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
||||
-- ]])
|
||||
require('nvim-autopairs').setup()
|
||||
local npairs = require('nvim-autopairs')
|
||||
|
||||
local function imap(lhs, rhs, opts)
|
||||
local options = {noremap = false}
|
||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||
vim.api.nvim_set_keymap('i', lhs, rhs, options)
|
||||
end
|
||||
|
||||
_G.MUtils = {}
|
||||
|
||||
MUtils.completion_confirm = function()
|
||||
if vim.fn.pumvisible() ~= 0 then
|
||||
if vim.fn.complete_info()["selected"] ~= -1 then
|
||||
vim.fn["compe#confirm"]()
|
||||
return npairs.esc("")
|
||||
else
|
||||
vim.fn.nvim_select_popupmenu_item(0, false, false, {})
|
||||
vim.fn["compe#confirm"]()
|
||||
return npairs.esc("<c-n>")
|
||||
end
|
||||
else
|
||||
return npairs.check_break_line_char()
|
||||
end
|
||||
end
|
||||
|
||||
MUtils.tab = function()
|
||||
if vim.fn.pumvisible() ~= 0 then
|
||||
return npairs.esc("<C-n>")
|
||||
else
|
||||
if vim.fn["vsnip#available"](1) ~= 0 then
|
||||
return vim.fn.feedkeys(string.format('%c%c%c(vsnip-expand-or-jump)', 0x80, 253, 83))
|
||||
else
|
||||
return npairs.esc("<Tab>")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MUtils.s_tab = function()
|
||||
if vim.fn.pumvisible() ~= 0 then
|
||||
return npairs.esc("<C-p>")
|
||||
else
|
||||
if vim.fn["vsnip#jumpable"](-1) ~= 0 then
|
||||
return vim.fn.feedkeys(string.format('%c%c%c(vsnip-jump-prev)', 0x80, 253, 83))
|
||||
else
|
||||
return npairs.esc("<C-h>")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Autocompletion and snippets
|
||||
imap("<CR>", "v:lua.MUtils.completion_confirm()", {expr = true, noremap = true})
|
||||
imap("<Tab>", "v:lua.MUtils.tab()", {expr = true, noremap = true})
|
||||
imap("<S-Tab>", "v:lua.MUtils.s_tab()", {expr = true, noremap = true})
|
||||
|
|
|
@ -6,6 +6,7 @@ require'nvim-treesitter.configs'.setup {
|
|||
enable = true -- false will disable the whole extension
|
||||
},
|
||||
indent = {enable = true, disable = {"python"}},
|
||||
-- indent = {enable = {"javascriptreact"}},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
|
|
|
@ -112,12 +112,12 @@ return require('packer').startup(function(use)
|
|||
use 'monaqa/dial.nvim'
|
||||
use 'junegunn/goyo.vim'
|
||||
use 'andymass/vim-matchup'
|
||||
use 'cohama/lexima.vim'
|
||||
-- use 'cohama/lexima.vim'
|
||||
use 'MattesGroeger/vim-bookmarks'
|
||||
-- use 'kshenoy/vim-signature'
|
||||
-- use 'nelstrom/vim-visual-star-search'
|
||||
-- TODO switch back when config support snips
|
||||
-- use 'windwp/nvim-autopairs'
|
||||
use 'windwp/nvim-autopairs'
|
||||
|
||||
-- TODO put this back when stable for indent lines
|
||||
-- vim.g.indent_blankline_space_char = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue