vim

Convert entire (Python) file from 2-space indent to 4-space indent

Convert entire (Python) file from 2-space indent to 4-space indent Question: I regularly work with Python files that are provided to me as templates, which use an indentation of 2. However, I personally prefer working with an indentation width of 4, which is what I’ve set in my .vimrc. However, because of the indentation-sensitivity of …

Total answers: 4

How to get my Vim and MacVim to find python3?

How to get my Vim and MacVim to find python3? Question: When I use a plugin that requires python, it can’t find it and barfs. The places that seem to being searched are: Using -version I see both: +python/dyn +python3/dyn However :echo has("python3") returns 0. I’m not sure if this is compile time config, or …

Total answers: 2

How to return a list from a class

How to return a list from a class Question: How would I get to return a list from the class, right now its just returning the location class ListNode: def __init__(self, val=[]): self.val = val def __iter__(self): return iter(self.val) def file_reader(file_path): list_of_num = [] with open(file_path, "rt") as fout: reader = csv.reader(fout, delimiter=",") for line …

Total answers: 1

Build a custom vim binary with python support and syntax highlighting

Build a custom vim binary with python support and syntax highlighting Question: Background The Debian 11 vim package doesn’t include python3 support. See the section titled "No python support in Debian 11 vim – evidence" below I need vim with python3 support for the YouCompleteMe vim plugin. Syntax highlighting is also required. To build a …

Total answers: 3

How can I install MacVim on OSX 12.5 and get it to run the REPL for Lisp?

How can I install MacVim on OSX 12.5 and get it to run the REPL for Lisp? Question: Update: Due to a change in the default build of vim and a change in directory structure on MacOS 12.5 no longer having Python frameworks installed, SLIMV initiated REPL doesn’t work with vim of MacVim when installing …

Total answers: 2

Where is `filetype plugin` defined and how to override it?

Where is `filetype plugin` defined and how to override it? Question: I am trying set python indentation to use 2 spaces instead of 4 (or 8) spaces. I put the following in my ~/.vimrc: set expandtab set shiftwidth=2 set softtabstop=2 set tabstop=2 This works well, as long as I do not put filetype plugin on …

Total answers: 2

Should I avoid using "str" as a variable name in Python?

Should I avoid using "str" as a variable name in Python? Question: I’ve noticed that certain variable names in Python get flagged up by Vim in blue highlight, whereas others do not. I’m familiar with the concept of reserved words, per this question, but from looking it up, "str" does not appear to be one …

Total answers: 3

Yank/copy selected text to clipboard in IPython Vi mode

Yank/copy selected text to clipboard in IPython Vi mode Question: I can’t figure out how to copy lines that I selected/highlighted in IPython in Vim mode to the normal clipboard (to be pasted outside of the IPython shell). Normally, in vim I can yank text using “+y and paste it somewhere else, but hitting those …

Total answers: 3