Comments (6)
I took a look at this using echo getpos(".")
. I thought that it would be pretty straightforward to save off the cursor position to a variable, do whatever changes the position, and then setpos(".",foo)
, but it's tough to find where the position is initially correct (i.e. it seems reset very early in the process).
from slimux.
Ok, so I can fix this, but it's dirty and I don't like it.
command! -range -bar -nargs=0 SlimuxREPLSendLine let cur_pos=getpos(".")|<line1>,<line2>call s:SlimeSendRange()|call setpos(".",cur_pos)
At least, this works after setting the the target pane the first time. I suspect that's also resetting the cursor position.
But this seems like a gross way to fix the problem. I'm not an expert with vimscript, so I don't know why the cursor position is already reset to the beginning of the line once you go into the SlimeSendRange
function.
One alternative would be to pass the cursor position into these functions. That really seems like mixing functionality, though, so I'm not a big fan of that. I haven't poked at wrapping functions, but maybe that could work?
from slimux.
Try setting a mark (z) and jumping back to it:
nnoremap j mz:SlimuxREPLSendLine<CR>`z
from slimux.
Yup, saving cursor position into z and restoring afterwards seems to be a simple workaround.
I am using the below settings now, and it works as expected after setting the target pane:
nmap <Leader>n mz:SlimuxREPLSendLine<CR>`z
vmap <Leader>n :SlimuxREPLSendSelection<CR>
nmap <Leader>N :SlimuxREPLConfigure<CR>
# I configured iterm2 to send 🀄 when Cmd+N is pressed
imap 🀄 <Esc>mz:SlimuxREPLSendLine<CR>`za
nmap 🀄 mz:SlimuxREPLSendLine<CR>`z
vmap 🀄 :SlimuxREPLSendSelection<CR>
Thanks!
from slimux.
Setting a mark will work, but it also clobbers that mark. So if you ever use the mark z
, you'll lose it after doing a SlimuxREPLSendLine
. Probably not a big deal for your specific usage, but it'd be nice to not twiddle that.
from slimux.
Setting a mark will work, but it also clobbers that mark.
Yup, Agree.
I usually use marks a,s,d,f, and rarely need more marks. I guess z is one of the least likely mark I would use. In practice, I think this works fine; as a general solution, this is probably not very clean.
from slimux.
Related Issues (20)
- Julia for loop break HOT 6
- Allow users to filter out panes based on arbitrary strings
- Slimux not Affecting the Selected Tmux Pane HOT 13
- Don't try to send to pane that doesn't exist anymore
- Allow SendSelection to use marks and ranges HOT 2
- Error after sending visual selection to ipython with vim splits
- vim hanging when using SlimuxREPLSendLine HOT 12
- Sending selection by stripping comments HOT 1
- Slimux broken in IPython 5 HOT 8
- how to use the Slimux in tmux? HOT 1
- Slimux breaks when `g:slimux_tmux_path` is unset HOT 3
- Send text object to REPL HOT 1
- SlimuxSendKeys() bug? HOT 4
- IndentationError: unindent does not match any outer indentation level (Extra spaces produced in IPython) HOT 3
- mismatched quotes in slimux.vim
- Escaping R Code HOT 3
- Vim to Vim in Normal mode
- protocol version mismatch HOT 1
- Repl send line adds indentation
- Repository maintenance HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slimux.