Updates to settings, particularly addinmg autopair plugin

feature/lua-configs
Alex Selimov 9 months ago
parent 20e5f8cfb7
commit 5993047779

@ -12,8 +12,15 @@
"clangd.path": "/usr/bin/clangd",
"python.formatting.provider": "black",
"python.formatting.blackArgs": ["-l","100"],
"coc.preferences.formatOnSaveFiletypes": ["python", "java", "rust"],
"coc.preferences.formatOnSaveFiletypes": ["python","java", "rust"],
"java.inlayHints.parameterNames.enabled": "none",
"java.format.settings.url": "/home/alex.selimov/RedTop.xml"
"java.format.settings.url": "/home/alex.selimov/RedTop.xml",
"workspace.ignoredFolders": [
"$HOME",
"$HOME/.cargo/**",
"$HOME/.rustup/**"
],
"rust-analyzer.inlayHints.typeHints.enable": false,
"rust-analyzer.inlayHints.parameterHints.enable": false
}

@ -17,4 +17,6 @@ inoremap ;pc ```<CR>```<Esc>O
inoremap ;cu - [ ]
inoremap ;cc - [x]
set tw=200
set colorcolumn=

@ -20,7 +20,8 @@ Plug 'christoomey/vim-tmux-navigator'
Plug 'GCBallesteros/vim-textobj-hydrogen'
Plug 'nvim-telescope/telescope-live-grep-args.nvim'
Plug 'folke/todo-comments.nvim'
Plug 'rust-lang/rust'
Plug 'windwp/nvim-autopairs'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
@ -178,6 +179,9 @@ nnoremap <silent> <A-g> <cmd> Telescope live_grep grep_open_files=true theme=ivy
vnoremap <silent> <A-g> "zy:Telescope live_grep grep_open_files=true theme=ivy <cr><c-r>z
" Change an option theme=ivy<cr>
"
"Some coc.nvim bindings
nnoremap <silent> gd <cmd>call CocActionAsync('jumpDefinition')<cr>
"Neomutt settings
autocmd BufNewFile,BufRead /tmp/neomutt* set noautoindent filetype=mail wm=0 tw=0 nonumber nolist
autocmd BufNewFile,BufRead ~/tmp/neomutt* set noautoindent filetype=mail wm=0 tw=0 nonumber nolist
@ -195,8 +199,14 @@ nnoremap <C-H> <C-W><C-H>
lua require('iron')
set formatoptions-=o
"autopair settings
lua require('autopair')
"todo-comments
lua require("todo-comments").setup()
"Default width for everything nonw
set colorcolumn=100
set tw=100
"Some jumping
inoremap ;<Space><Space> <Esc>/<++><Enter>"_c4l

@ -0,0 +1,62 @@
local remap = vim.api.nvim_set_keymap
local npairs = require('nvim-autopairs')
npairs.setup({ map_bs = false, map_cr = false })
vim.g.coq_settings = { keymap = { recommended = false } }
-- these mappings are coq recommended mappings unrelated to nvim-autopairs
remap('i', '<esc>', [[pumvisible() ? "<c-e><esc>" : "<esc>"]], { expr = true, noremap = true })
remap('i', '<c-c>', [[pumvisible() ? "<c-e><c-c>" : "<c-c>"]], { expr = true, noremap = true })
remap('i', '<tab>', [[pumvisible() ? "<c-n>" : "<tab>"]], { expr = true, noremap = true })
remap('i', '<s-tab>', [[pumvisible() ? "<c-p>" : "<bs>"]], { expr = true, noremap = true })
-- skip it, if you use another global object
_G.MUtils= {}
MUtils.CR = function()
if vim.fn.pumvisible() ~= 0 then
if vim.fn.complete_info({ 'selected' }).selected ~= -1 then
return npairs.esc('<c-y>')
else
return npairs.esc('<c-e>') .. npairs.autopairs_cr()
end
else
return npairs.autopairs_cr()
end
end
remap('i', '<cr>', 'v:lua.MUtils.CR()', { expr = true, noremap = true })
MUtils.BS = function()
if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({ 'mode' }).mode == 'eval' then
return npairs.esc('<c-e>') .. npairs.autopairs_bs()
else
return npairs.autopairs_bs()
end
end
remap('i', '<bs>', 'v:lua.MUtils.BS()', { expr = true, noremap = true })
-- put this to setup function and press <a-e> to use fast_wrap
npairs.setup({
fast_wrap = {},
})
-- change default fast_wrap
npairs.setup({
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = [=[[%'%"%>%]%)%}%,]]=],
end_key = '$',
before_key = 'h',
after_key = 'l',
cursor_pos_before = true,
keys = 'qwertyuiopzxcvbnmasdfghjkl',
manual_position = true,
highlight = 'Search',
highlight_grey='Comment'
},
})
npairs.remove_rule('`')
Loading…
Cancel
Save