• <small id='id4W3'></small><noframes id='id4W3'>

      <bdo id='id4W3'></bdo><ul id='id4W3'></ul>
    <tfoot id='id4W3'></tfoot>
    1. <i id='id4W3'><tr id='id4W3'><dt id='id4W3'><q id='id4W3'><span id='id4W3'><b id='id4W3'><form id='id4W3'><ins id='id4W3'></ins><ul id='id4W3'></ul><sub id='id4W3'></sub></form><legend id='id4W3'></legend><bdo id='id4W3'><pre id='id4W3'><center id='id4W3'></center></pre></bdo></b><th id='id4W3'></th></span></q></dt></tr></i><div id='id4W3'><tfoot id='id4W3'></tfoot><dl id='id4W3'><fieldset id='id4W3'></fieldset></dl></div>

        <legend id='id4W3'><style id='id4W3'><dir id='id4W3'><q id='id4W3'></q></dir></style></legend>

      1. 使用单次击键从 Vim 中的 HTML 文件跳转到 CSS 文件中的 CSS 选择器

        jump to CSS selector in a css file from the HTML file in Vim using a single keystroke(使用单次击键从 Vim 中的 HTML 文件跳转到 CSS 文件中的 CSS 选择器)
        <i id='alDbD'><tr id='alDbD'><dt id='alDbD'><q id='alDbD'><span id='alDbD'><b id='alDbD'><form id='alDbD'><ins id='alDbD'></ins><ul id='alDbD'></ul><sub id='alDbD'></sub></form><legend id='alDbD'></legend><bdo id='alDbD'><pre id='alDbD'><center id='alDbD'></center></pre></bdo></b><th id='alDbD'></th></span></q></dt></tr></i><div id='alDbD'><tfoot id='alDbD'></tfoot><dl id='alDbD'><fieldset id='alDbD'></fieldset></dl></div>
          <legend id='alDbD'><style id='alDbD'><dir id='alDbD'><q id='alDbD'></q></dir></style></legend>

          <small id='alDbD'></small><noframes id='alDbD'>

            <tbody id='alDbD'></tbody>

            • <tfoot id='alDbD'></tfoot>
                <bdo id='alDbD'></bdo><ul id='alDbD'></ul>

                  本文介绍了使用单次击键从 Vim 中的 HTML 文件跳转到 CSS 文件中的 CSS 选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  请注意:我已经通过此链接 跳转到在 VIM 中编辑 HTML 时的 CSS 定义,但对我没有帮助.

                  Please note: I have been through this link Jump to CSS definition when editing HTML in VIM, but it couldn't help me.

                  我希望跳转到 CSS 定义或 html 文件中的 javascript 函数.我很想点击单词下方的组合键来跳转到它的定义,而不仅仅是定义所在的文件.

                  I am looking to jump to the CSS definition or for that matter a javascript function from the html file. I would love to hit a key combo below the word to jump to its definition, not just the file in which the definition resides.

                  我目前需要在打开的缓冲区中搜索单词,然后到达所需缓冲区中的所有搜索结果.这非常耗时.

                  I currently need to search the word in opened buffers and then reach to all the search results in the required buffer. It is very time consuming.

                  请帮我解决这个非常常规的要求.

                  Please help me with this very regular requirement.

                  推荐答案

                  这个快速而肮脏的函数似乎对 *.html -> *.css 有用:

                  This quick and dirty function seems to do the trick for *.html -> *.css:

                  function! JumpToCSS()
                    let id_pos = searchpos("id", "nb", line('.'))[1]
                    let class_pos = searchpos("class", "nb", line('.'))[1]
                  
                    if class_pos > 0 || id_pos > 0
                      if class_pos < id_pos
                        execute ":vim '#".expand('<cword>')."' **/*.css"
                      elseif class_pos > id_pos
                        execute ":vim '.".expand('<cword>')."' **/*.css"
                      endif
                    endif
                  endfunction
                  
                  nnoremap <F9> :call JumpToCSS()<CR>
                  

                  • test.html

                    <html>
                      <body>
                        <div class="foo" id="bar">lorem</div>
                        <div id="bar" class="foo">ipsum</div>
                        <div id="bar">dolor</div>
                        <div class="foo">sit</div>
                      </body>
                    </html>
                    

                  • foo/foo.css

                    .foo {
                      background-color: red;
                    }
                    

                  • bar/bar.css

                    #bar {
                      border-color: gold;
                    }
                    

                  • 将光标放在 test.html 中的任意 foobar 属性值上,点击 <F9> 跳转到正确文件中的正确定义.可以修改该函数以拆分打开目标文件,仅搜索链接的样式表……或者被 ZyX 完全嘲笑和破坏;-).

                    With the cursor on any foo or bar attribute value in test.html, hitting <F9> jumps to the right definition in the right file. The function could be modified to open the target file in a split, search only the linked stylesheets… or be completely ridiculed and destroyed by ZyX ;-).

                    编辑

                    一些额外的指针:

                    • :help iskeyword 让这个函数使用破折号连接的名字
                    • :help expand()
                    • :help searchpos():help search() 了解参数的含义
                    • :help starstar 用于使用 ** 通配符
                    • :help iskeyword for this function to work with dash-joined names
                    • :help expand()
                    • :help searchpos() and :help search() for the meanings of the arguments
                    • :help starstar for the use of the ** wildcard

                    这篇关于使用单次击键从 Vim 中的 HTML 文件跳转到 CSS 文件中的 CSS 选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                    本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)

                    <tfoot id='wcKWZ'></tfoot>

                    <small id='wcKWZ'></small><noframes id='wcKWZ'>

                          <tbody id='wcKWZ'></tbody>

                        • <bdo id='wcKWZ'></bdo><ul id='wcKWZ'></ul>
                          <i id='wcKWZ'><tr id='wcKWZ'><dt id='wcKWZ'><q id='wcKWZ'><span id='wcKWZ'><b id='wcKWZ'><form id='wcKWZ'><ins id='wcKWZ'></ins><ul id='wcKWZ'></ul><sub id='wcKWZ'></sub></form><legend id='wcKWZ'></legend><bdo id='wcKWZ'><pre id='wcKWZ'><center id='wcKWZ'></center></pre></bdo></b><th id='wcKWZ'></th></span></q></dt></tr></i><div id='wcKWZ'><tfoot id='wcKWZ'></tfoot><dl id='wcKWZ'><fieldset id='wcKWZ'></fieldset></dl></div>

                            <legend id='wcKWZ'><style id='wcKWZ'><dir id='wcKWZ'><q id='wcKWZ'></q></dir></style></legend>