V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
kkklk
V2EX  ›  Python

nvim 怎么设置跳转的光标的位置

  •  1
     
  •   kkklk · 1 天前 · 475 次点击
    用 lsp 时 gd 跳转到函数定义处,默认光标都会在屏幕中间,怎么配置它的偏移?让光标出现在屏幕的三分之二位置
    2 条回复    2025-03-18 15:15:35 +08:00
    pooorguy
        1
    pooorguy  
       1 天前 via Android
    vim.lsp.buf.definition 后面跟个 nvim_win_set_cursor()
    kkklk
        2
    kkklk  
    OP
       1 天前
    @pooorguy 好像这样需要跳转两次吧?
    内容好像不会跟着移动
    而且 lsp 的快捷键好多快捷键,每个都需要这样配好像挺麻烦的

    我的需求是这样的:
    默认光标都会在屏幕中间,跳转后函数定义也是从中间开始往下展开的,
    这样看不到函数的整体内容,每次跳转后我都需要按一下 ctrl d 移动一下,
    还要往上调一点点,这样才能看到函数名和更多的函数内容,
    我想尽可能看到更多的内容,因为上半部分很多东西都不需要看到
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4952 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:41 · PVG 17:41 · LAX 02:41 · JFK 05:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.