added a mapping for automatic curly bracket expansion

This commit is contained in:
Daniel Knüttel 2021-02-28 11:21:32 +01:00
parent 2b04ed80ec
commit ec7601c7b7
3 changed files with 41 additions and 0 deletions

2
after/ftplugin/c.vim Normal file
View File

@ -0,0 +1,2 @@
" This enables the fancy automatic curly brackets.
let g:AutoInsertBracket_enable = 1

2
after/ftplugin/cpp.vim Normal file
View File

@ -0,0 +1,2 @@
" This enables the fancy automatic curly brackets.
let g:AutoInsertBracket_enable = 1

View File

@ -85,10 +85,16 @@ Plug 'chrisbra/unicode.vim'
" Color schemes.
Plug 'tomasr/molokai'
Plug 'bluz71/vim-moonfly-colors'
Plug 'bluz71/vim-nightfly-guicolors'
Plug 'sainnhe/sonokai'
" This is for snippets.
Plug 'SirVer/ultisnips'
" Treesitter seems to be a reall nice
" plugin for code highlighting.
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()
"===================== Language Server Configuration ===========================
@ -159,6 +165,22 @@ let g:completion_enable_snippet = 'UltiSnips'
" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()
" This function and mapping is basically related
" to autocompletion as well.
" It automatically maps a single bracket to the
" GNU-style formatted bracket.
let g:AutoInsertBracket_enable = 0
function! AutoInsertBracket()
if g:AutoInsertBracket_enable
return "{\n}\<Esc>O"
else
return "{"
endif
endfunction
inoremap <expr> { AutoInsertBracket()
"========================== A Nice Color Scheme ================================
"===============================================================================
@ -167,9 +189,24 @@ autocmd BufEnter * lua require'completion'.on_attach()
"let g:airline_theme='one'
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
set termguicolors
" This is for sonokai, a rather nice
" color scheme.
"let g:sonokai_style = 'atlantis'
"let g:sonokai_enable_italic = 0
"let g:sonokai_disable_italic_comment = 0
colorscheme molokai
"=================== Settings Related to Highlighting ==========================
"===============================================================================
let g:vimsyn_embed= 'l'
"==================== Settings Related to Treesitter ===========================
"===============================================================================
" Install the language parsers.
"TSInstall python
"TSInstall c
"TSInstall cpp
"TSInstall bash