{"id":111,"date":"2020-05-09T09:34:42","date_gmt":"2020-05-09T08:34:42","guid":{"rendered":"https:\/\/blog.thomarite.uk\/?p=111"},"modified":"2020-07-22T12:01:57","modified_gmt":"2020-07-22T11:01:57","slug":"vim-python-linters","status":"publish","type":"post","link":"https:\/\/blog.thomarite.uk\/index.php\/2020\/05\/09\/vim-python-linters\/","title":{"rendered":"Vim + Python Linters"},"content":{"rendered":"\n<p>I was reading an article about tools to write python using VIM with good formatting. I am not a pro-user of VIM neither a pro-python programmer but I would like to be more efficient and write better formatted python code.<\/p>\n\n\n\n<p>So this is the link I was <a href=\"https:\/\/realpython.com\/python-code-quality\/\">reading<\/a> and ended <a href=\"https:\/\/realpython.com\/vim-and-python-a-match-made-in-heaven\/#syntax-checkinghighlighting\">here<\/a> for the specific details.<\/p>\n\n\n\n<p>At the end, my goal is to use more often inside VIM: splits (:sp), nerdtree (file browsing), autocompletion, git and be sure my code is formatted automatically if I make a mistake. <\/p>\n\n\n\n<p>So I enabled most of the plugins from the <a href=\"https:\/\/realpython.com\/vim-and-python-a-match-made-in-heaven\/#syntax-checkinghighlighting\">article<\/a> although I made some tweaks for me normal usage (I already had enabled some pluggins for jinja2). This is my <code>.vimrc<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">set nocompatible              \" be iMproved, required\nfiletype off                  \" required\n\n\" set the runtime path to include Vundle and initialize\nset rtp+=~\/.vim\/bundle\/Vundle.vim\n\n\" https:\/\/realpython.com\/vim-and-python-a-match-made-in-heaven\/#syntax-checkinghighlighting\nset splitbelow\nset splitright\n\"split navigations\nnnoremap <C-J> <C-W><C-K>\nnnoremap <C-K> <C-W><C-J>\nnnoremap <C-L> <C-W><C-L>\nnnoremap <C-H> <C-W><C-H>\n\n\" Enable folding\nset foldmethod=indent\nset foldlevel=99\n\" Enable folding with the spacebar\nnnoremap <space> za\n\n\" Automatic formating for tab, whitespace and max 80 chars per line, etc\nau BufNewFile,BufRead *.py\n    \\ set tabstop=4 |\n    \\ set softtabstop=4 |\n    \\ set shiftwidth=4 |\n    \\ set textwidth=79 |\n    \\ set expandtab |\n    \\ set autoindent |\n    \\ set fileformat=unix\n\nhighlight BadWhitespace ctermbg=red guibg=darkred\nau BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace \/\\s\\+$\/\n\nset encoding=utf-8\n\nlet python_highlight_all=1\n\n\" VUNDLE PLUGINGS\n\ncall vundle#begin()\n\" alternatively, pass a path where Vundle should install plugins\n\" call vundle#begin('~\/some\/path\/here')\n\n\" let Vundle manage Vundle, required\nPlugin 'VundleVim\/Vundle.vim'\n\" added nerdtree\nPlugin 'scrooloose\/nerdtree'\n\nPlugin 'ctrlp.vim'\n\nPlugin 'Jinja'\n\nPlugin 'tmhedberg\/SimpylFold'\n\nPlugin 'vim-scripts\/indentpython.vim'\n\nPlugin 'vim-syntastic\/syntastic'\n\nPlugin 'nvie\/vim-flake8'\n\nPlugin 'tpope\/vim-fugitive'\n\nPlugin 'Lokaltog\/powerline', {'rtp': 'powerline\/bindings\/vim\/'}\n\n\" Keep Plugin commands between vundle#begin\/end.\n\" All of your Plugins must be added before the following line\ncall vundle#end()            \" required\n\n\n\nfiletype plugin indent on    \" required\nsyntax on\n\nnmap <F9> :NERDTreeToggle<CR>\n\n\" To ignore plugin indent changes, instead use:\n\"filetype plugin on\n\"\n\" Brief help\n\" :PluginList       - lists configured plugins\n\" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate\n\" :PluginSearch foo - searches for foo; append `!` to refresh local cache\n\" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal\n\"\n\" see :h vundle for more details or wiki for FAQ\n\" Put your non-Plugin stuff after this line\n\n\nau BufNewFile,BufRead *.lmx set filetype=xml\nau BufNewFile,BufRead *.dump set filetype=sql\nau BufNewFile,BufRead *.j2 set filetype=jinja\n\n\"for case-insensitve searches\"\nset ignorecase\n\n\"Override the 'ignorecase' option if the search pattern contains upper\"\n\"case characters.  Only used when the search pattern is typed and\"\n\"'ignorecase' option is on.\"\nset smartcase\n\n\" I want to be able to resize the splits quickly so I want the mouse on\nset mouse=a\n\n\" Always show statusline - This makes powerline always on\nset laststatus=2\n\n\" autocmd vimenter * NERDTree\n<\/pre>\n\n\n\n<p>BTW, a quick reference for NerdTree (file browser) <a href=\"https:\/\/medium.com\/usevim\/nerd-tree-guide-bb22c803dcd2\">here<\/a>.<\/p>\n\n\n\n<p>Let&#8217;s see how I get on with these changes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was reading an article about tools to write python using VIM with good formatting. I am not a pro-user of VIM neither a pro-python programmer but I would like to be more efficient and write better formatted python code. So this is the link I was reading and ended here for the specific details. &hellip; <a href=\"https:\/\/blog.thomarite.uk\/index.php\/2020\/05\/09\/vim-python-linters\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Vim + Python Linters&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,25,26],"tags":[],"class_list":["post-111","post","type-post","status-publish","format-standard","hentry","category-unix","category-python","category-vim"],"_links":{"self":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/comments?post=111"}],"version-history":[{"count":4,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/111\/revisions"}],"predecessor-version":[{"id":131,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/111\/revisions\/131"}],"wp:attachment":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/media?parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/categories?post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/tags?post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}