Giter Site home page Giter Site logo

ets-labs / python-vimrc Goto Github PK

View Code? Open in Web Editor NEW
641.0 41.0 346.0 318 KB

VIM Configuration for Python / Cython / C Development

License: BSD 3-Clause "New" or "Revised" License

Shell 18.68% Python 32.35% Vim Script 48.97%
python cython vim ide

python-vimrc's Introduction

PYTHON .VIMRC

VIM Configuration for Python / Cython / C Development.

Keep calm and use VIM!

Requirements

  • VIM 7.4
  • git
  • bash 3.2+

How does it look?

image

Installation

You can install it by using CLI just have next command executed:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ets-labs/python-vimrc/master/setup.sh)"

During execution of init script do not worry about error messages. When it occurs just press enter and wait till all plugins are installed.

Autocompletion

Current bundle use one of the most comprehensive plugins for autocompletion - Valloric/YouCompleteMe. YouCompleteMe autocompletion plugin requires additional installation that depends on environment and functionality you want to have. Detailed instructions could be found on plugin page: Valloric/YouCompleteMe.

Note: Installation for Mac OS with support of clang compiler looks like this:

~/.vim/bundle/YouCompleteMe/install.py --clang-completer

Key bindings

This configuration tends to use standard VIM and installed plugins key bindings, but there are some custom key bindings as well:

# Common key bindings:

inoremap jj     # Esc alternative
inoremap jk     # Esc alternative

nmap <F9>       # Jump to the previous buffer
nmap <F10>      # Jump to the next buffer

nmap <leader>q  # Delete buffer
nmap "          # Toggle NERDTree buffer 

# Python mode key bindings:

let g:pymode_doc_key='K'
let g:pymode_breakpoint_key='<leader>b'
let g:pymode_run_bind='<F5>'

nmap <leader>g :YcmCompleter GoTo<CR>
nmap <leader>d :YcmCompleter GoToDefinition<CR>

python-vimrc's People

Contributors

boonya avatar c0rdis avatar cydanil avatar rmk135 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-vimrc's Issues

Add ctags as a requirement

The idea is to add ctags as a requirement. Actions that are required:

  • update readme
  • add check in installation script and drop installation process if ctags is not installed

Keybindings to run a program

HI, this .vimrc works awesomely good on my arch linux with i3wm.

I just can't find how the keybindings work to run the python file? What would be the best way to just run the python file I'm working in.

Sorry for that idiotic question.

Cheers

Auto update

Suggestion is to implement some script that will be executed every time on startup terminal session. This script has to check whether current version of installed project is up to date or not. If it is not, then executes git pull and so on.

Change source of airline plugin

Airline plugin has been moved from https://github.com/bling/vim-airline to https://github.com/vim-airline/vim-airline, and we use an old link.

The idea is to update the link in vimrc to relevant one.

Calling tagbar#autoopen(0) on line 129 causes errors when editing python files

Line 129 causes errors
129: autocmd BufEnter *.py :call tagbar#autoopen(0)

Here are the errors I'm getting

Exit code: 1 
Error detected while processing function tagbar#autoopen[9]..<SNR>113_IsValidFile:
line   29: 
E121: Undefined variable: s:known_types 
E116: Invalid arguments for function has_key(s:known_types, a:ftype) 
E15: Invalid expression: !has_key(s:known_types, a:ftype

Improve setup script

Make it like homebrew does:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Python files returns error

Hello

I'm using Kali Os in virtualbox
I have followed the installation structure, Everything works fine but when I try to open a python file
I get this weird error

line    2:
E319: Sorry, the command is not available in this version: python import sys, vim
line    3:
E319: Sorry, the command is not available in this version: python sys.path.insert(0, vim.eval('a:plugin
_root'))
line    4:
E319: Sorry, the command is not available in this version: python sys.path = vim.eval('a:paths') + sys.
path
Error detected while processing /root/.vim/bundle/python-mode/autoload/pymode/virtualenv.vim:
line    3:
E319: Sorry, the command is not available in this version: python from pymode.virtualenv import enable_
virtualenv
Error detected while processing function pymode#breakpoint#init:
line    9:
E319: Sorry, the command is not available in this version: python << EOF
line   11:
E492: Not an editor command: from pymode.libs.six import PY3
line   13:
E121: Undefined variable: PY3
E15: Invalid expression: PY3:
line   17:
E488: Trailing characters: else:
line   20:
E488: Trailing characters:         try:
line   31:
E170: Missing :endfor
Tagbar: Exuberant ctags not found!
Please download Exuberant Ctags from ctags.sourceforge.net and install it in a directory in your $PATH
or set g:tagbar_ctags_bin.
Error detected while processing function tagbar#autoopen[9]..<SNR>116_IsValidFile:
line   29:
E121: Undefined variable: s:known_types
E116: Invalid arguments for function has_key(s:known_types, a:ftype)
E15: Invalid expression: !has_key(s:known_types, a:ftype)
Press ENTER or type command to continue

E855: Autocommands caused command to abort

Using MacVIM 8, quitting vim produces the following error:

E855: Autocommands caused command to abort

I'm not sure how to troubleshoot this further. Quitting a second time appears to be OK.

$ sw_vers -productVersion
10.11.6
$ alias vi
alias vi='/Applications/MacVim.app/Contents/MacOS/Vim'
$ vi --version | head -4
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Aug  8 2017 03:24:50)
MacOS X (unix) version
Included patches: 1-891
Compiled by [email protected]

I installed python-vimrc from today, no additional plugins or any customization. Thanks!

syntax error when using f"string {my_var}"

really nice work here on this vimrc. really enjoying the work you put into it.

Would you know how to fix the syntax error when using the new f"string {}" format in python3.6+ I went through all the help pages for pymode and syntastic. I am completly lost. pretty new to vim in general (loving it though, omg my work flow is so much faster now that I learned vim)

can you point me in the right direction or maybe you have a solution?
when I change
let g:pymode_python='python'
to
let g:pymode_python='python3'
I get lots of errors.
Seen here: https://i.imgur.com/gif2Yze.png

Thanks.

omnicomplete still in .vimrc

Now that you configured to use YCM for autocompletion shouldn't you remove things related to omnicomplete like lines below?

" omnicomplete
set completeopt-=preview                    " remove omnicompletion dropdown

Error after opening a python file in vim

Every time I open a python file the vim shows some bunch of error (refer screenshot) and the python file contains
`import sys
print ("hello world!")
some_text = input ("Please enter some text ")
print (some_text)
~
~
. I have also attached the output of
Screenshot from 2020-09-05 02-20-33
Screenshot from 2020-09-05 02-21-04

vim --version. Kindle look it up and please explain why it is happening and how to fix it. Thanks in advance.

Changing color of default red 'set colorcolumn=80'

The red bar from set colorcolumn=80 is somewhat distracting and does not fit with the airline theme.

I propose implementing a soft and hard line wrap using a gray color scale color as an alternative.

let &colorcolumn=join(range(81,999),",")
highlight ColorColumn ctermbf=235 guibg=#2c2d27
let &colorcolumn="80,".join(range(120,999),",")

Cannot close only one tab when opening several files

When I open several files in one tab, I cannot close the active tab but keep the others opened. How could I do that?

For example, when I open 'train.py' and 'data.py' at the same time, once I wq 'train.py', the vim shutdown totally. But, I still want to edit 'data.py'. I'm new to vim, how could I get this?

Split this project up into the separate branches.

I'd prefer to split current project on two different branches like: master (just pure vim with basic configurations) and python (vim for python development)
It can be useful for people who want to have precofigured vim for their servers and so on.
By this way we can add more branches for different goals in the future.

Can't find hellopicture

Romans-Mac-Book-Air:~ romanmogilatov$ git clone https://github.com/rmk135/vimrc.git ~/.vim
Cloning into '/Users/romanmogilatov/.vim'...
remote: Counting objects: 285, done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 285 (delta 11), reused 0 (delta 0), pack-reused 255
Receiving objects: 100% (285/285), 276.99 KiB | 0 bytes/s, done.
Resolving deltas: 100% (49/49), done.
Checking connectivity... done.
Romans-Mac-Book-Air:~ romanmogilatov$ bash ~/.vim/init.sh
/Users/romanmogilatov/.vim/init.sh: line 27: hellopicture: No such file or directory

Initializing vim configuration...
Making simlink for ~/.vimrc ...
Installing Vundle...
Cloning into '/Users/romanmogilatov/.vim//bundle/Vundle.vim'...
remote: Counting objects: 2994, done.
remote: Total 2994 (delta 0), reused 0 (delta 0), pack-reused 2994
Receiving objects: 100% (2994/2994), 893.41 KiB | 596.00 KiB/s, done.
Resolving deltas: 100% (1034/1034), done.
Checking connectivity... done.
Done.
Are you ready to execute "vim +PluginInstall?" [Y/n]:n
Than finish. Bye bye.

Please update this repo. Fails on new Ubuntu 22.04 install with errors.

Getting the following errors on a new install of Ubuntu 22.04 after running the setup script.

Error 1

Error detected while processing /home/webdev/.vimrc[64]../usr/share/vim/vim82/syntax/syntax.vim[40]..FileType Autocommands for "*"..Syntax Autocommands for "*"..function <SNR>4_SynSet[25]..script /home/webdev/.vim/bundle/riv.vim/after/syntax/python.vim:
line   18:
E121: Undefined variable: g:riv_python_rst_hl

Error 2

Please download Exuberant Ctags from ctags.sourceforge.net and install it in a directory in your $PATH or set g:tagbar_ctags_bin.
Error detected while processing BufEnter Autocommands for "*.py"..function tagbar#autoopen[9]..<SNR>119_IsValidFile:
line   29:
E121: Undefined variable: s:known_types
E116: Invalid arguments for function has_key(s:known_types, a:ftype)
Press ENTER or type command to continue

System information for reference

webdev@webdev:~$ uname -a
Linux webdev 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
webdev@webdev:~$ cat /etc/issue
Ubuntu 22.04.1 LTS \n \l

vim --version for reference

webdev@webdev:~$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 13 2022 09:35:02)
Included patches: 1-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     -perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          -ruby              +wildignore
+cursorbind        -lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary
-farsi             -mouse_sysmouse    -tag_old_static
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-NA7QBf/vim-8.2.3995=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lsodium -lacl -lattr -lgpm -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -lpython3.10 -lcrypt -ldl -lm -lm

Improve NERDTree behaviour

NERDTree behaviour should support next cases:

  • if I open vim without specifying particular file, NERDTree should be collapsed.
  • if vim is opened for editing of commit message or similar cases, NERDTree should be collapsed.
  • if I open vim for particular file, NERDTree should be expanded.

Assessment of VIMRC

Checklist of things that should be an object of assessment:

  • Goals
  • Features
  • Automated testing
  • Performance
  • Memory efficiency
  • CI
  • Documentation
  • Usage Success Stories

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.