diff --git a/.vimrc b/.vimrc index f039431..2208227 100644 --- a/.vimrc +++ b/.vimrc @@ -4,11 +4,12 @@ filetype off " required " set the runtime path to include Vundle and initialise set rtp+=~/.vim/bundle/Vundle.vim/ call vundle#begin() - " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' " tree file explore Plugin 'preservim/nerdtree' +" git status flags on NERDTree +Plugin 'Xuyuanp/nerdtree-git-plugin' " code comment Plugin 'preservim/nerdcommenter' " auto complete @@ -19,10 +20,10 @@ Plugin 'tmhedberg/SimpylFold' Plugin 'itchyny/lightline.vim' " git integration Plugin 'tpope/vim-fugitive' +" indicates which lines have been modified in editor window +Plugin 'airblade/vim-gitgutter' " syntax check Plugin 'dense-analysis/ale' -" auto generates surround pairs -Plugin 'jiangmiao/auto-pairs' " All of the plugins must be added before the following line call vundle#end() " required @@ -41,17 +42,29 @@ syntax on " enable syntax highlighting colorscheme desert " set `desert` as default colour scheme set autoindent " indent when moving to the next while writing code set colorcolumn=80 " show 80 line indicator +set cursorline " show cursorline by default set encoding=utf-8 " show output in UTF-8 as YouCompleteMe requires set expandtab " expand tabs into spaces set fileencoding=utf-8 " save file with UTF-8 encoding set fileformat=unix " save file with LF line endings +set hlsearch " highlight the search results set laststatus=2 " show the statusline/tabline set number " show line numbers set shiftwidth=4 " shift lines by 4 spaces for indent +set shell=bash " set bash as default terminal set showmatch " show the matching part of the pair for [] {} & () set softtabstop=4 " for easier backspacing the soft tabs set tabstop=4 " set tabs to have 4 spaces +set timeoutlen=100 " reduce mapping & keycode delay for sanppy responses set tws=15x0 " set terminal windows size +set updatetime=100 " reduce Vim default delay time from 4000ms to 100ms + +" allow backspacing over everthing in insert mode +set backspace=indent,eol,start + +" auto-switch between case-sensitive & case-insensitive search +set ignorecase +set smartcase " split layout set splitbelow @@ -66,9 +79,16 @@ nnoremap " code folding set foldmethod=indent set foldlevel=99 + " enable folding with spacebar nnoremap za +" prevents `ftplugin` to enforce the textwidth while editing commit msg +au FileType gitcommit setlocal textwidth=0 + +" highlight colour for search results +highlight Search ctermbg=LightYellow ctermfg=DarkGrey + " highlight unneccessary whitespaces highlight BadWhitespace ctermbg=yellow guibg=yellow au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match @@ -76,7 +96,7 @@ au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match " hide colorcolumn in non-editor windows au FileType fugitive,help,qf setlocal nonumber colorcolumn= -au BufEnter * if &ft == '' | setlocal nonumber colorcolumn= | endif +au BufAdd * if &previewwindow | set nonumber colorcolumn= | endif " enable all Python syntax highlighting features let python_highlight_all=1 @@ -117,3 +137,9 @@ let g:ale_linters={ 'python': ['pylint'] } let g:ale_fixers={ 'python': ['yapf'] } let g:ale_open_list=1 let g:ale_linters_explicit=1 + +" plugin settings - vim-gitgutter +highlight! link SignColumn LineNr +highlight GitGutterAdd ctermfg=2 +highlight GitGutterChange ctermfg=3 +highlight GitGutterDelete ctermfg=1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 88c728d..9b0ee8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +## [2020.06.22] +### Added +- Auto case-sensitive & case-insensitive switch for searches +- Vim plugin `airblade/vim-gitgutter` to show Git diff in the sign column next +to line numbers in editor windows. +- Vim plugin `Xuyuanp/nerdtree-git-plugin` to show Git status flags on NERDTree. +- Highlight on search result & custom highlight colour. +- Added global git config `credential.helper cache` for macOS user as +`osxkeychain` is not available on Linux. + +### Changed +- Default shell for Vim to `bash`. +- Backspace to allow backspcaing over everthing in insert mode like most usual +editors. +- `cursorline` is now enabled by default. + +### Fixed +- Heavy delay on shortcut `<<` while decreasing indent by reducing the +`timeoutlen` to `100`(0.1s). +- Text being moved to new line automatically at position `72` as Vim setting +`textwidth` has been overriden by `ftplugin` for filetype `gitcomit. +Implemented an `autocmd` to override it back to `textwidth=0`. +- 1st file opened will notshow line numbers and colour column if Vim is +initialised with cmd `vi`/`vim` due to the `autocmd` set to hide those items +on `YouCompleteMe` preivew windo overrides the settings. Implemented a new +`autocmd` which fixed this issue. + +### Removed +- Vim plugin `jiangmiao/auto-pairs` as it somehow messes with the indents for +bracket closures. + ## [2020.06.19] ### Added - Vim plugin `dense-analysis/ale` (a.k.a. ALE) for much faster linting. @@ -38,7 +69,8 @@ found` by pinning the `pipenv` version to `2018.11.26`. - `.vimrc` configured for Python developemnt. - Ubuntu 20.04 based dockerfiles to build images for Python 3.7 & 3.8 variants. -[Unreleased]: https://github.com/devtography/pyvim/compare/2020.06.19...HEAD +[Unreleased]: https://github.com/devtography/pyvim/compare/2020.06.22...HEAD +[2020.06.22]: https://github.com/devtography/pyvim/compare/2020.06.19...2020.06.22 [2020.06.19]: https://github.com/devtography/pyvim/compare/2020.06.18...2020.06.19 [2020.06.18]: https://github.com/devtography/pyvim/compare/2020.06.17...2020.06.18 [2020.06.17]: https://github.com/devtography/pyvim/releases/tag/2020.06.17 diff --git a/README.md b/README.md index 98a6d05..1694358 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,14 @@ development. Included Vim plugins: - [Vundle.vim] - plugins management - [NERDTree] - tree file explore -- [NERD Commenter] - code comment +- [nerdtree-git-plugin] - plugin of [NERDTree] showing git status flags +- [NERD Commenter] - powerful code comment tool - [YouCompleteMe] - code completion - [SimpylFold] - cold folding for Python - [lightline.vim] - statusline/tabline - [fugitive.vim] - git integration - [Asynchronous Lint Engine] \(a.k.a. ALE) - linting -- [auto-pairs] - auto generates surround pairs +- [vim-gitgutter] - shows git diff in the sign column pyvim is good for remote Python development with iPad via `ssh`/`mosh` as plugins & settings preconfigured in `.vimrc` are fully tested on the iPad @@ -52,13 +53,14 @@ pyvim is licensed under the [Apache License, Version 2.0](LICENSE.md). [Vim]: https://www.vim.org [Vundle.vim]: https://github.com/VundleVim/Vundle.vim [NERDTree]: https://github.com/preservim/nerdtree +[nerdtree-git-plugin]: https://github.com/Xuyuanp/nerdtree-git-plugin [NERD Commenter]: https://github.com/preservim/nerdcommenter [YouCompleteMe]: https://github.com/ycm-core/YouCompleteMe [SimpylFold]: https://github.com/tmhedberg/SimpylFold [lightline.vim]: https://github.com/itchyny/lightline.vim [fugitive.vim]: https://github.com/tpope/vim-fugitive [Asynchronous Lint Engine]: https://github.com/dense-analysis/ale -[auto-pairs]: https://github.com/jiangmiao/auto-pairs +[vim-gitgutter]: https://github.com/airblade/vim-gitgutter [Blink]: https://blink.sh [Vundle]: https://github.com/VundleVim/Vundle.vim [latest]: https://github.com/Devtography/pyvim/blob/master/docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile index f732428..24966c1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -29,7 +29,8 @@ RUN apt-get install -y build-essential cmake curl git git-flow iputils-ping vim && git clone https://github.com/VundleVim/Vundle.vim.git \ /root/.vim/bundle/Vundle.vim \ && vim +PluginInstall +qall \ - && /root/.vim/bundle/YouCompleteMe/install.py --clangd-completer + && /root/.vim/bundle/YouCompleteMe/install.py --clangd-completer \ + && git config --global credentail.helper cache CMD ["bash"] diff --git a/docker/Dockerfile_py3.7 b/docker/Dockerfile_py3.7 index 1a718e0..7bccc09 100644 --- a/docker/Dockerfile_py3.7 +++ b/docker/Dockerfile_py3.7 @@ -33,7 +33,8 @@ RUN apt-get install -y build-essential cmake curl git git-flow iputils-ping vim && git clone https://github.com/VundleVim/Vundle.vim.git \ /root/.vim/bundle/Vundle.vim \ && vim +PluginInstall +qall \ - && /root/.vim/bundle/YouCompleteMe/install.py --clangd-completer + && /root/.vim/bundle/YouCompleteMe/install.py --clangd-completer \ + && git config --global credential.helper cache CMD ["bash"]