feat: NVIM common config and setup

This commit is contained in:
Marc 2022-11-05 12:53:26 -04:00
parent 0156762675
commit ba571b66db
3 changed files with 82 additions and 3 deletions

View file

@ -22,6 +22,7 @@ env/
setup # Adds bootstrap block to your shell's config file.
source/
... # Anything here is sourced on shell-start
extras.vim # Common config for NVIM
```
Adding files to `source/` will add code that gets executed on shell-start. Files are discovered by globbing in the

61
extras.vim Normal file
View file

@ -0,0 +1,61 @@
" Shared configuration for NVIM.
""""""""""
" Misc "
""""""""""
set number
syntax on
set tabstop=4
set shiftwidth=4
set expandtab
set ignorecase
set cursorline
set cursorcolumn
set textwidth=120
set wrap linebreak
set termguicolors
"""""""""""
" Plugins "
"""""""""""
call plug#begin('~/.vim/plugged')
" Style
Plug 'joshdick/onedark.vim'
" Language support
Plug 'maxmellon/vim-jsx-pretty'
Plug 'leafgarland/typescript-vim'
" Git things
Plug 'airblade/vim-gitgutter'
Plug 'nvim-lua/plenary.nvim'
Plug 'vim-airline/vim-airline'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'tpope/vim-fugitive'
" Search
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-symbols.nvim'
" Patched for support Yarn Berry.
Plug 'mcataford/ale'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()
""""""""""""""""
" Key bindings "
""""""""""""""""
let mapleader=" "
nmap <leader>f <cmd>Telescope live_grep<CR>
nmap <leader>F <cmd>Telescope grep_string<CR>
colorscheme onedark

23
setup
View file

@ -5,6 +5,8 @@
# block to its configuration to source extra files on shell-start.
#
BLOCK_DELIMITER_PATTERN="mcataford/env-managed-block"
SHELL_CONFIG_PATH=""
if [[ -n $(echo $SHELL | grep zsh) ]]; then
@ -13,8 +15,23 @@ else
SHELL_CONFIG_PATH="$HOME/.bashrc"
fi
if [[ -z $(cat $SHELL_CONFIG_PATH | grep 'mcataford/env-managed-block') ]]; then
echo '# mcataford/env-managed-block:start
if [[ -z $(cat $SHELL_CONFIG_PATH | grep $BLOCK_DELIMITER_PATTERN) ]]; then
echo "# $BLOCK_DELIMITER_PATTERN:start
for f in ~/.env_goodies/source/*; do source $f; done
# mcataford/env-managed-block:end' >> $SHELL_CONFIG_PATH
# $BLOCK_DELIMITER_PATTERN:end" >> $SHELL_CONFIG_PATH
fi
EDITOR_CONFIG=$HOME/.config/nvim
EDITOR_CONFIG_FILE=$EDITOR_CONFIG/init.vim
if [[ -f $EDITOR_CONFIG_FILE ]]; then
if [[ -z $(cat $EDITOR_CONFIG_FILE | grep $BLOCK_DELIMITER_PATTERN) ]]; then
echo "\" $BLOCK_DELIMITER_PATTERN:start
source $HOME/.env_goodies/extras.vim
\" $BLOCK_DELIMITER_PATTERN:end\n\n" >> $EDITOR_CONFIG_FILE.new
cat $EDITOR_CONFIG_FILE >> $EDITOR_CONFIG_FILE.new
mv $EDITOR_CONFIG_FILE $EDITOR_CONFIG_FILE.old
mv $EDITOR_CONFIG_FILE.new $EDITOR_CONFIG_FILE
fi
fi