推荐学习书目
› 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 · Mar 18, 2025 · 2194 views
    This topic created in 556 days ago, the information mentioned may be changed or developed.
    用 lsp 时 gd 跳转到函数定义处,默认光标都会在屏幕中间,怎么配置它的偏移?让光标出现在屏幕的三分之二位置
    2 replies  •  2025-03-18 15:15:35 +08:00
    pooorguy
        1
    pooorguy  
       Mar 18, 2025 via Android
    vim.lsp.buf.definition 后面跟个 nvim_win_set_cursor()
    kkklk
        2
    kkklk  
    OP
       Mar 18, 2025
    @pooorguy 好像这样需要跳转两次吧?
    内容好像不会跟着移动
    而且 lsp 的快捷键好多快捷键,每个都需要这样配好像挺麻烦的

    我的需求是这样的:
    默认光标都会在屏幕中间,跳转后函数定义也是从中间开始往下展开的,
    这样看不到函数的整体内容,每次跳转后我都需要按一下 ctrl d 移动一下,
    还要往上调一点点,这样才能看到函数名和更多的函数内容,
    我想尽可能看到更多的内容,因为上半部分很多东西都不需要看到
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2644 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 02:19 · PVG 10:19 · LAX 19:19 · JFK 22:19
    ♥ Do have faith in what you're doing.