-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra spaces in front processing? (not a bug but a feature add?) #77
Comments
Here's a dumb/simple solution. If 1st line contains whitespace as the 1st character then |
Thanks for the issue. I'm really glad this helps you out. I need to invest some time in iron, which was not possible during the previous months. I was hoping I could get the lua port done this year and I'll try to get this right from beginning in lua if possible. Otherwise, I'll just try to fix the python verison before migrating. Cheers, |
I hope you can! This is a really something I would gladly spend time with you to help any way I can.
It's not pretty but works. Issue is testing for white spaces or presence & if True then,
and adding hacky `>ajGpj0 as the post process Also nice add if possible (but not expecting):
or
etc... I attempted to copy scala.py to python.py but did not go far. |
Oh, this might make the whole job easier.
https://amir.rachum.com/blog/2018/06/23/python-multiline-idioms/ |
Here's a solution that strips the indent: repl_definition = {
-- python = require("iron.fts.python").ipython,
python = {
-- Remove indent, ref Vigemus/iron.nvim/issues/77
format = function(lines, extras)
-- Find common (i.e. minimal, non-zero) indent width
local nIndent = 999
for _, line in ipairs(lines) do
local indent = string.match(line, "^%s*")
if indent then
nIndent = math.min(nIndent, #indent)
end
end
-- Strip indent
for i, line in ipairs(lines) do
if not string.match(line, "^%s*$") then
lines[i] = string.sub(line, nIndent + 1)
end
end
-- Apply default `format` (rm empty lines, add CR, make windows-compatible)
lines = require("iron.fts.common").bracketed_paste(lines)
-- lines = require("iron.fts.common").bracketed_paste_python(lines) -- does not work for me
return lines
end,
-- Prefer ipython, fallback to python:
command = function(_meta)
-- meta.current_bufnr
if vim.fn.executable("ipython") == 1 then
return require("iron.fts.python").ipython.command
else
return require("iron.fts.python").python.command
end
end,
}, |
It's awesome but when compared to Emacs or Atom, I miss the ability to take code chunk with extra spaces in front. (visual selection)
can be sent directly to repl vs visual selection, but not:
with extra spaces in front. Some simple processing to remove extra spaces in front would be great.
Wishful but not a show stopper.
Thanks u much for making ssh work so much easier!
The text was updated successfully, but these errors were encountered: