Skip to content

Commit

Permalink
Merge pull request #43 from rmariano/develop
Browse files Browse the repository at this point in the history
Release 0.6
  • Loading branch information
rmariano authored Nov 1, 2017
2 parents 0b3e30f + 2f51e64 commit b9da9b4
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 96 deletions.
19 changes: 6 additions & 13 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"" Vim configuration
" Maintainer: Mariano Anaya
" Version: v0.5
" Version: v0.6
" Created: 01 Jan 2014
""""""""""""""""""""""""""""""

Expand All @@ -15,8 +15,6 @@ set incsearch
set wildmenu
set showmatch
set history=50
"" New escaping sequence, double-tab for returning to normal mode
inoremap <Tab><Tab> <Esc>

"" \t handled properly & PEP8
set expandtab
Expand All @@ -39,6 +37,8 @@ set cursorline
set wildignore=*.pyc,**/__pycache__*
set showmode
set autoread
set autowrite
set autowriteall
set hidden

"" Where to open new windows
Expand Down Expand Up @@ -168,15 +168,8 @@ map <F2> :call ToggleLangCheck()<CR>
set pastetoggle=<F4>

nnoremap <leader>e :set number!<CR>
"" autocmd`s for python only
augroup Python
autocmd!
"" Shortcut for commenting out lines in python files
autocmd FileType python nnoremap <buffer> <localleader>c I# <ESC>
"" Remove trailing white spaces on saving *.py files
autocmd BufWritePre *.py :%s/\s\+$//e
augroup END
"" autocmd`s for other file types
autocmd FileType xml map <F3> :call FormatXML()<CR>
"" Remove trailing white spaces upon saving
autocmd BufWritePre * :%s/\s\+$//e
"" Python: Highlight everything
let g:python_highlight_all = 1
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ DIRS = \
$(HOME)/.vim/autoload \
$(HOME)/.vim/plugin \
$(HOME)/.vim/ftplugin \
$(HOME)/.vim/after/ftplugin \
$(PACKAGES_DIR)

BRANCH := master
REPO_HOME := https://github.com/rmariano/vim-config
REPO_URL := https://raw.github.com/rmariano/vim-config
REMOTELOC := $(REPO_URL)/$(BRANCH)

Expand All @@ -26,17 +28,19 @@ RED := \e[91m
all: install

.PHONY: dev-deploy
dev-deploy:
dev-deploy: dirs
@echo "Symlinking files..."
ln -sfn $(PWD)/.vimrc $(HOME)/.vimrc
ln -sfn $(SOURCE_COLORS) $(TARGET_COLORS)
ln -sfn $(SOURCE_SYNTAX) $(TARGET_SYNTAX)
ln -sfn $(PWD)/after/ftplugin/*.vim $(HOME)/.vim/after/ftplugin/

.PHONY: deploy
deploy: dirs clean
cp -f $(PWD)/.vimrc $(HOME)/.vimrc
cp -f $(SOURCE_COLORS) $(TARGET_COLORS)
cp -f $(SOURCE_SYNTAX) $(TARGET_SYNTAX)
cp -fa $(PWD)/after/ftplugin $(HOME)/.vim/after

.PHONY: dirs
dirs:
Expand Down Expand Up @@ -73,10 +77,10 @@ extras: flake8 fugitive nerdtree
# make install BRANCH=<branch>
.PHONY: install
install: dirs
echo "Getting files from $(REMOTELOC)"
@wget -O $(HOME)/.vimrc $(REMOTELOC)/.vimrc
@wget -O $(TARGET_COLORS) $(REMOTELOC)/colors/tromso.vim
@wget -O $(TARGET_SYNTAX) $(REMOTELOC)/syntax/python.vim
rm -fr /tmp/vimconfig && mkdir -p /tmp/vimconfig
@wget -O /tmp/vimconfig/vimconfig.zip $(REPO_HOME)/archive/$(BRANCH).zip
@unzip -d /tmp/vimconfig /tmp/vimconfig/vimconfig.zip
@cd /tmp/vimconfig/vim-config-$(BRANCH) && make deploy && cd -

# make changelog TAG=<tag>
.PHONY: changelog
Expand All @@ -101,4 +105,7 @@ release: $(PRECHANGELOG)

.PHONY: clean
clean:
rm -f $(HOME)/.vimrc $(TARGET_COLORS) $(TARGET_SYNTAX)
rm -fr $(HOME)/.vimrc \
$(TARGET_COLORS) \
$(TARGET_SYNTAX) \
$(HOME)/.vim/after/ftplugin
106 changes: 56 additions & 50 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,68 +65,28 @@ want to start over, you could simply run ``make clean``, which will remove the
files for this project (not the extra packages, though).


Colour scheme
-------------

The colour scheme requires the terminal to support 256 colours. Most of the
terminals already support this, but some terminal multiplexers like ``tmux``
might require to be run as: ``tmux -2`` in order to support this.

In addition, just the command-line classic Vim version is supported, so no
support for ``Gvim`` or graphical versions is included for the colour scheme,
although pull requests are welcomed.

Captures
^^^^^^^^

Here are some examples of how the colour scheme looks like.

.. image:: https://rmariano.github.io/itarch/vim-capture1.png
:target: https://rmariano.github.io/itarch/vim-capture1.png
:width: 883px
:height: 391px
:alt: Vim capture 1
:align: center

Please note this might depend on the configuration of your terminal as well.

.. image:: https://rmariano.github.io/itarch/vim-capture2.png
:target: https://rmariano.github.io/itarch/vim-capture2.png
:width: 574px
:height: 596px
:alt: Vim capture 2
:align: center


Contributing
------------

If you want to try the project, and tweak the settings, I would recommend you
to clone the repository, and use the development deployment, which creates
symlinks of the files in this project, like:

.. code:: bash
make dev-deploy
In addition, take a moment to read the contributing guidelines.


Features
--------

* Mapping double ``<tab>`` to ``<Esc>`` for faster access.

* `PEP-8 <https://www.python.org/dev/peps/pep-0008/>`_ general rules of text:
automatically handling spaces instead of tabs, proper indentation, wrap text
to 79 columns, margin set (toggle-able), etc.

* ``<leader>`` + ``tw`` will highlight trailing white spaces.

* ``<leader>`` + ``w`` will remove them (they'll also be automatically removed
when saving :-)

* ``autoindent`` & ``smartindent``.

* Function keys

* ``<F2>``: toggle spell check.
* ``<F3>``: auto indent/format files (currently only XML support).
* ``<F3>``: Correct files automatically

* XML: auto-format & indent.
* Python: PEP-8, sort imports, and run ``flake8`` checks.

* ``<F4>``: toggle paste mode

* ``<leader>`` + ``nh`` as a shortcut for ``:nohlsearch``
Expand Down Expand Up @@ -173,6 +133,52 @@ Features
* Silent bells
* Set hidden buffers

Colour scheme
-------------

The colour scheme requires the terminal to support 256 colours. Most of the
terminals already support this, but some terminal multiplexers like ``tmux``
might require to be run as: ``tmux -2`` in order to support this.

In addition, just the command-line classic Vim version is supported, so no
support for ``Gvim`` or graphical versions is included for the colour scheme,
although pull requests are welcomed.

Captures
^^^^^^^^

Here are some examples of how the colour scheme looks like.

.. image:: https://rmariano.github.io/itarch/vim-capture1.png
:target: https://rmariano.github.io/itarch/vim-capture1.png
:width: 883px
:height: 391px
:alt: Vim capture 1
:align: center

Please note this might depend on the configuration of your terminal as well.

.. image:: https://rmariano.github.io/itarch/vim-capture2.png
:target: https://rmariano.github.io/itarch/vim-capture2.png
:width: 574px
:height: 596px
:alt: Vim capture 2
:align: center


Contributing
------------

If you want to try the project, and tweak the settings, I would recommend you
to clone the repository, and use the development deployment, which creates
symlinks of the files in this project, like:

.. code:: bash
make dev-deploy
In addition, take a moment to read the contributing guidelines.

Dependencies
------------

Expand Down
17 changes: 17 additions & 0 deletions after/ftplugin/python.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"" Settings for Python

"" Shortcut for commenting out lines in python files
nnoremap <buffer> <localleader>c I# <ESC>
function! AutofixPy()
echom "Correcting Python file"
if executable("autopep8")
execute ":silent %!autopep8 - 2> /dev/null"
endif
if executable("isort")
execute ":silent %!isort - 2>/dev/null"
endif
call Flake8()
endfunction

map <F3> :call AutofixPy()<CR>
16 changes: 16 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Change Log
==========

v0.6 (2017-11-01)
-----------------
* Documentation: corrections & formatting, describe new installation process,
new functions, and mappings.
* Installation changed: ``deploy.sh`` removed and new Makefile instructions for
local and remote installation support.
* Python syntax highlighting: extended support for ``Python 3.6``.
* New mapping: ``<F3>`` automatically corrects & formats the current file.
* Moves Python-specific configuration.
* ``deploy.sh`` deleted.
* Python: Highlight for ``__dict__``
* Remove trailing white spaces in all files upon saving (not just ``*.py``
files).
* ``autowrite`` & ``autowriteall``.
* Removed double tab mapping (``<tab><tab>`` no longer equals ``<esc>``).

v0.5 (2017-03-18)
-----------------
* Makefile: Improved installation and more (deploy, install extras, etc.).
Expand Down
14 changes: 0 additions & 14 deletions deploy.sh

This file was deleted.

43 changes: 30 additions & 13 deletions syntax/python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ else
syn match pythonStatement "\<async\s\+for\>" display
endif

syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonBuiltinObj,pythonBuiltinFunc

"
" Decorators (new in Python 2.4)
"
Expand Down Expand Up @@ -276,6 +278,11 @@ else
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell

syn region pythonFString start=+[fF]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonFString start=+[fF]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonFString start=+[fF]"""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonFString start=+[fF]'''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
endif

if s:Python2Syntax()
Expand Down Expand Up @@ -326,8 +333,9 @@ if s:Enabled("g:python_highlight_string_format")
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
else
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString,pythonFString
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
syn region pythonStrInterpRegion start="{"he=e+1,rs=e+1 end="\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}"hs=s-1,re=s-1 extend contained containedin=pythonFString contains=pythonStrInterpRegion,@pythonExpression
endif
endif

Expand Down Expand Up @@ -370,28 +378,34 @@ if s:Python2Syntax()

syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display
syn match pythonBinError "\<0[bB][01]*[2-9]\d*[lL]\=\>" display

syn match pythonFloat "\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
syn match pythonFloat "\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=" display
else
syn match pythonHexError "\<0[xX]\x*[g-zG-Z]\x*\>" display
syn match pythonOctError "\<0[oO]\=\o*\D\+\d*\>" display
syn match pythonBinError "\<0[bB][01]*\D\+\d*\>" display

syn match pythonHexNumber "\<0[xX]\x\+\>" display
syn match pythonOctNumber "\<0[oO]\o\+\>" display
syn match pythonBinNumber "\<0[bB][01]\+\>" display
syn match pythonHexNumber "\<0[xX][_0-9a-fA-F]*\x\>" display
syn match pythonOctNumber "\<0[oO][_0-7]*\o\>" display
syn match pythonBinNumber "\<0[bB][_01]*[01]\>" display

syn match pythonNumberError "\<\d\+\D\>" display
syn match pythonNumberError "\<0\d\+\>" display
syn match pythonNumberError "\<\d[_0-9]*\D\>" display
syn match pythonNumberError "\<0[_0-9]\+\>" display
syn match pythonNumberError "\<\d[_0-9]*_\>" display
syn match pythonNumber "\<\d\>" display
syn match pythonNumber "\<[1-9]\d\+\>" display
syn match pythonNumber "\<\d\+[jJ]\>" display
syn match pythonNumber "\<[1-9][_0-9]*\d\>" display
syn match pythonNumber "\<\d[jJ]\>" display
syn match pythonNumber "\<[1-9][_0-9]*\d[jJ]\>" display

syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*\>" display
syn match pythonBinError "\<0[bB][01]*[2-9]\d*\>" display
endif

syn match pythonFloat "\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
syn match pythonFloat "\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=" display
syn match pythonFloat "\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=\>" display
syn match pythonFloat "\<\d\%([_0-9]*\d\)\=[eE][+-]\=\d\%([_0-9]*\d\)\=[jJ]\=\>" display
syn match pythonFloat "\<\d\%([_0-9]*\d\)\=\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=" display
endif

"
" Builtin objects and types
Expand Down Expand Up @@ -479,6 +493,7 @@ endif

syn keyword pythonConvention self
syn keyword pythonConvention cls
syn keyword pythonConvention __dict__


if s:Enabled("g:python_slow_sync")
Expand Down Expand Up @@ -540,6 +555,8 @@ if version >= 508 || !exists("did_python_syn_inits")
HiLink pythonBytesError Error
HiLink pythonBytesEscape Special
HiLink pythonBytesEscapeError Error
HiLink pythonFString String
HiLink pythonStrInterpRegion Special
endif

HiLink pythonStrFormatting Special
Expand Down

0 comments on commit b9da9b4

Please sign in to comment.