Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9175959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:00:14+00:00 2026-06-17T17:00:14+00:00

How I am suppose to use the the snip() function contained in the imaps.vim

  • 0

How I am suppose to use the the snip() function contained in the imaps.vim plugin in the latex package described below:

Snip: puts a scissor string above and below block of text {{{
Description:

this puts a the string “——–%<———” above and below the visually
selected block of lines. the length of the ‘tearoff’ string depends on the
maximum string length in the selected range. this is an aesthetically more
pleasing alternative instead of hard-coding a length.

function! <SID>Snip() range
    let i = a:firstline
    let maxlen = -2
    " find out the maximum virtual length of each line.
    while i <= a:lastline
      exe i
      let length = virtcol('$')
      let maxlen = (length > maxlen ? length : maxlen)
      let i = i + 1
    endwhile
    let maxlen = (maxlen > &tw && &tw != 0 ? &tw : maxlen)
    let half = maxlen/2
    exe a:lastline
    " put a string below
    exe "norm! o\<esc>".(half - 1)."a-\<esc>A%<\<esc>".(half - 1)."a-"
    " and above. its necessary to put the string below the block of lines
    " first because that way the first line number doesnt change...
    exe a:firstline
    exe "norm! O\<esc>".(half - 1)."a-\<esc>A%<\<esc>".(half - 1)."a-"
endfuntion
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:00:15+00:00Added an answer on June 17, 2026 at 5:00 pm

    Refer to the line immediately after the Snip() definition in imaps.vim:

    com! -nargs=0 -range Snip :<line1>,<line2>call <SID>Snip()
    

    This defines the command Snip, which can be invoked on any range. In visual mode, vim automatically inserts the range '<,'> when you enter a command, so typing : and then Snip, which results in :'<,'>Snip, will call the function on the current selection.

    Note that you can also manually specify ranges. For example, :1,5 Snip will snip lines 1 through 5, :'m,'n Snip will snip from mark m to mark n, and :Snip will apply only to the current line.

    In order to avoid having to type :Snip every time, you can map this command to a key of your choice. For example, you can map z in visual mode to call Snip on the current selection as follows:

    vnoremap z :Snip<CR>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a function like this (I use akka 2.0.2): def foo(message: String):
The question is: Suppose I use the function: (* env) -> GetByteArrayRegion (env, array,
Suppose I use a lambda as a callback function, and when creating the lambda,
I have cell formula like C1+C2.suppose i use getcellformula()method it returns the String C1+C2.
if I have a function: 8x+5y+20z=n I suppose to use exhaustive search to find
Let's suppose I use some onload animation for my pages, for example: $(document).ready(function() {
Suppose I use a custom :format to implement a gadget-oriented version of my site.
Suppose both parent and child use one pipe for writing and reading means when
Suppose I'm designing a robot that can pickup various tools and use them. I
Suppose I have 2 office locations which I want to use for my contact

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.