From ec7601c7b74f4333d2ab4314765061df3296642f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kn=C3=BCttel?= Date: Sun, 28 Feb 2021 11:21:32 +0100 Subject: [PATCH] added a mapping for automatic curly bracket expansion --- after/ftplugin/c.vim | 2 ++ after/ftplugin/cpp.vim | 2 ++ init.vim | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 after/ftplugin/c.vim create mode 100644 after/ftplugin/cpp.vim diff --git a/after/ftplugin/c.vim b/after/ftplugin/c.vim new file mode 100644 index 0000000..6ebe8e9 --- /dev/null +++ b/after/ftplugin/c.vim @@ -0,0 +1,2 @@ +" This enables the fancy automatic curly brackets. +let g:AutoInsertBracket_enable = 1 diff --git a/after/ftplugin/cpp.vim b/after/ftplugin/cpp.vim new file mode 100644 index 0000000..6ebe8e9 --- /dev/null +++ b/after/ftplugin/cpp.vim @@ -0,0 +1,2 @@ +" This enables the fancy automatic curly brackets. +let g:AutoInsertBracket_enable = 1 diff --git a/init.vim b/init.vim index 3d37ded..0204ffe 100644 --- a/init.vim +++ b/init.vim @@ -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}\O" + else + return "{" + endif +endfunction +inoremap { 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