From e0cc8e67952385e4f548e76a1eae65b1fb63d454 Mon Sep 17 00:00:00 2001 From: Johannes Rothe Date: Fri, 27 Aug 2021 00:21:13 +0200 Subject: [PATCH] Add black formatting to vim --- roles/dotfiles/files/vimrc | 10 +++++++--- roles/dotfiles/tasks/main.yml | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/dotfiles/files/vimrc b/roles/dotfiles/files/vimrc index 086edcb..2640719 100644 --- a/roles/dotfiles/files/vimrc +++ b/roles/dotfiles/files/vimrc @@ -26,6 +26,7 @@ Plug 'vim-airline/vim-airline' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' Plug 'luochen1990/rainbow' +Plug 'psf/black' " Themes Plug 'crusoexia/vim-monokai' " Language specific @@ -35,9 +36,11 @@ call plug#end() " ale: apt install pylint flake8 " Ale -let g:ale_linters = { - \ 'python': ['flake8', 'pylint'], - \} +let g:ale_linters = {'python': ['flake8', 'pylint'],} +let g:ale_fixers = {} +let g:ale_fixers.python = ['black'] + +let g:black_linelength = 80 " NERDTREE " open nerdtree when no file is specified on startup @@ -45,6 +48,7 @@ autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " toggle nerdtree keyboard shortcut map :NERDTreeToggle +nnoremap :Black " RAINBOW_PARENTHESES au FileType c,cpp,py call rainbow#load() diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml index e449ef6..c3e3534 100644 --- a/roles/dotfiles/tasks/main.yml +++ b/roles/dotfiles/tasks/main.yml @@ -7,6 +7,7 @@ apt: name: - ack + - black # code formatting - feh # set background - fish - fzf @@ -18,6 +19,7 @@ - nitrogen - pass - polybar + - python3-pylint-common - pulseaudio-utils # pactl volume control - rofi # dmenu replacement - scrot # screenshot