首页 > Elisp, 初级 > 在Emacs中使用vi的*和#命令

在Emacs中使用vi的*和#命令

2010年2月24日 ahei 发表评论 阅读评论


vi里有个很好用的功能就是, 在命令模式下, 按*向前搜索下一个单词, 按#向后搜索后一个单词. 那Emacs下有没有这样的功能呢? 抱歉, 还真没有。也许你会说C-s C-w不是可以解决吗?但是这个方法需要光标在单词起始处,光标在单词中间的话就不行了。不过不用怕, 有elisp, 啥不能实现呢? 代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
(defun isearch-cur-word (fun)
  "ISearch current word use function FUN."
  (let ((cur-word (current-word)))
    (if (not cur-word)
        (message "No word under cursor.")
      (call-interactively fun)
      (isearch-yank-string cur-word))))
 
(defun isearch-forward-cur-word (&optional backward)
  "`isearch-forward' current word."
  (interactive "P")
  (let ((fun (if backward 'isearch-backward 'isearch-forward)))
    (isearch-cur-word fun)))

原理很简单, 首先用current-word函数得到当前光标下的单词, 然后调用对应的isearch命令, 最后用isearch-yank-string把当前单词复制到搜索串里, 达到搜索当前单词的目的. C-u isearch-forward-cur-word则向后搜索当前单词.

上面实现的是增量搜索当前单词, 那怎么像vi中那样直接到达下一个单词, 而不启动增量搜索呢?

我曾写过一篇文章Emacs才是世界上最强的IDE - 高亮光标处单词, 这个用于高亮光标处单词的elisp包正好有个上面所说的功能, 命令是highlight-symbol-next和highlight-symbol-prev, 在view-mode下我把它们绑定到了N和P键上去了, 非常的方便.

分享家:Addthis中国
GD Star Rating
loading...
在Emacs中使用vi的*和#命令, 9.2 out of 10 based on 5 ratings 标签:cursor, Elisp, Emacs, emacser, emacser.com, highlight, highlight-symbol, IDE, lisp, mode, screenshot, vi, 光标

相关日志

分类: Elisp, 初级
  1. 2016年4月6日22:59 | #1

    Edmund Slevin, Lincoln: Carried the ball 29 times for 179 yards and two touchdowns, leading the Cardinals to a 42-14 victory against Grants Pass. http://www.raybanoutlet.name In that story, the novelist explains himself by saying: “We work in the dark we do what we can we give what we have. q michael kors handbags
    On a recent Friday afternoon, we started our Phil’s lunch with a large order of Chicken Fajita Nachos ($11. http://www.raybansunglassesbuy.co.uk At the time of rescue she had a rubber band around her neck.
    Patrol cars blocked off the section of Isabella between Wood and Ambrosia streets and multiple officers searched for evidence on Sophia Street and Isabella. A vacant lot next to the Community Party Store on Wood Street was cordoned off with police tape. cheap nfl jerseys Saturday at Veterans Park. e michael kors handbags
    L. coach bags “Among the new coasters debuting are Manta at SeaWorld San Diego, which will simulate underwater flight; and Superman-themed launch coasters at Six Flags Discovery Kingdom in Vallejo, Calif.
    f Yocelyn Figueroa, Yocelyn Delgado and William Delgado to William Ramirez, 40 Washington Ave., $158,500. http://www.raybansunglasses.name Don’t leave it to chance, or depend only on your judgment. coach factory
    She compliments them. louis vuitton handbags com 400 When: 10 a. http://o.westboroughpolice.com
    “It’s an area where people appreciate good food,” Eisenacher said about Ann Arbor. “We have a pretty good following amongst college students as well.” michael kors outlet online Judge Chris Piazza set a preliminary hearing for April 7 for the trial that’s to begin April 25. q michael kors outlet online
    Howard, a nine-year veteran of the organization, previously served as director of programs and fund development for CCC subsidiary Community Clinics Health Network (CCHN), has now been elevated to executive vice president for CCHN and chief advancement officer for CCC, and is tasked with developing a research strategy to positively affect health outcomes. michael kors outlet online “LIKE A FATHERLopez has been like a father to Mireles, who moved from Nogales, Arizona, at age 10 to live with his uncle in Tucson.
    Finish with the most points in phase 3 and win. louis vuitton handbags edu/tickets.
    And imagine! I could rideuntil the bicycle needed to be charged again. coach outlet online 400 Platt, MAR, 1:03.
    American qualifier Nicole Gibbs routed Alexandra Dulgheru of Romania, 6-1, 6-0, and Vania King beat qualifier Taylor Townsend 6-2, 6-3, in an all-American battle. michael kors online Heritage Missionary Baptist Church at 2309 S.
    p “I’ve been told I can make a full recovery, and I have no doubt that I will. cheap ray ban sunglasses Another, less mature player, might have landed that punch Jason Terry missed 17 years ago.
    In that time he put Kiribati, a grouping of about 30 islands with a population of 100,000, at the centre of the global climate change debate. coach handbags To view the videos visit . e http://www.michaelkorshandbagstrade.us.com
    The Highlanders boasted a 90% free throw percentage, going 18-20 at the line, forcing 14 UH turnovers and grabbing seven steals coach factory outlet Docents will learn about the museum, art and history, American Indian culture and be able to speak about the works on display.
    v The grant was achieved through an interactive festival activation and social media campaign implemented at music festivals nationwide including Lollapalooza, Outside Lands, Nocturnal Wonderland, Life is Beautiful and Voodoo Music + Arts Experience. wholesale nfl jerseys WOMEN’S TEAM FAVORITES No. f
    This one seemed torun a bit smaller. coach outlet store online “Did you see when the Bishops held hands through the fence?” she asked. coach outlet online
    “Lake Hamilton Corporation is to sell the building to LRMU, LP, and currently development and redesign work is occurring that will bring approximately 142 market rate apartments to the downtown area,” the memo states. coach factory outlet The designation came from the Women’s Choice Award, which identifies the country’s best health care institutions on the basis of evidencebased criteria that consider patient satisfaction and clinical excellence among female patients. q michael kors outlet online
    The National Housing Quality award winning company and recipient of the National Gold Winning Home of the Year has built over 12,000 homes since its founding by Paul Schumacher in 1992 – each one unique to the needs and lifestyle of the owners. ray ban glasses Getting good margins is a lot about making sure that all the cancer has been taken out and doesn’t come back.
    C: Garret Hartung, Reynolds, senior coach outlet online Increasing additive usage rates in developing countries, as well as a broader shift to higher performing specialty additives, will further support advances in additive demand. z michael kors outlet online
    Only two bulls have lived longer, led by the nine-year run that ended in March 2000. 锘?a href=http://www.michaelkors.us.org>michael kors outlet Oberzaucher and a group of researchers won for using mathematical techniques to determine how the emperor of Morroco could have bore 888 children during his lifetime.

    [回复]

  2. 2016年4月7日20:08 | #2

    “We missed some big plays early, shot ourselves in the foot a couple of times,” Ruecker said. “To our players’ credit, we kept playing, and we played harder and harder. You could see as the second quarter got going, all of the sudden, things were turning a little bit.” [url=http://www.louisvuittonbagsbuy.us.com]http://www.louisvuittonbagsbuy.us.com[/url] The Democrats’ faceoff, in comparison, was a more civil if heated affair. w [url=http://www.raybansunglasses.name]ray ban glasses[/url]
    Some systems can take the car to a complete stop without any aid from the driver [url=http://www.michaelkorshandbagsbuy.us.com]michael kors outlet online[/url] But Espinoza Valdez has said Morales’ arrest “is the first of multiple options to make sure those who defrauded the confidence of the citizens face Sonoran justice.
    Michigan Lottery advises the winner to visit a local lottery claim center to collect the prize. [url=http://www.coachhandbags.com.co]coach outlet[/url] “My concern is that the future of America’s health care system under the current regime is the VA. o [url=http://www.michaelkorshandbagsrack.us.com]michael kors outlet[/url]
    Legal is a managed benefit, not a referral service, which means it pays virtually 100 percent of attorneys fees for all covered services. [url=http://www.louisvuittonhandbagsbuy.us.com]cheap louis vuitton bags[/url] Officer Hopps is trying to help the animals that are going “savage,” and the 3D effects make viewers feel a sense of adrenaline as the giant predators come leaping off the screen.
    q Which is why LGBT advocate and lawyer Dana Nessel is wondering if some are trying to “sabotage” a proposed statewide petition drive to expand the state’s civil rights act to include the gay community. [url=http://www.michaelkorshandbagsoutletup.us.com]michael kors bags[/url] Historians [url=http://www.coachhandbags.com.co]coach outlet online[/url]
    There’s no middle ground anymore [url=http://www.michaelkorshandbagsup.us.com]michael kors online[/url] “I think it is better than nothing,” said Chairman Thomas Chenal. http://o.storeonlinecc.com
    On the third Tuesday of every month, there’s Paint Social Art. Paint Social Art is a painting party, not a painting class, where you can sip cocktails, listen to music and paint. You need not have any experience in the art world and beginners are actually encouraged. All you have to do is show up as all the supplies will be there for you to use. Artist guides will be there to lead you to completing a painting in two hours. [url=http://www.michaelkorsbags.me]michael kors bags[/url] “He’s a young man who came in three years ago with a goal to play college football and he’s got the opportunity now to fulfill his dream. f [url=http://o.storeonlinecc.com]oakley glasses[/url]
    Open Wednesdays, Thursdays and Sundays from 5 p. [url=http://www.coachhandbags.me]http://www.coachhandbags.me[/url] Hughes said he could not comment on the litigation.
    Hollister is a great and safe community and those doing large-scale outdoor growing (over 6 plants) are people who already don’t respect the law or their neighbors right to not be drowned in skunk fumes 5-6 months of the year. [url=http://www.coachoutletssonline.us.org]coach outlet online[/url] I will return only in a coffin,” he said.
    We just can’t discount or marginalize a game. [url=http://www.louisvuittonhandbagsbuy.us.com]louis vuitton handbags[/url] Mickelson had a two-shot lead at Pebble Beach going into the final round.
    Black Cooper Sander Funeral Home and Gavilan Hills Crematory. [url=http://www.raybanoutlet.name]ray ban sunglasses[/url] Van Horn said he’s unsure whether Knight will be in the starting rotation again next weekend.
    c The materials are easily integrated into teaching science, language arts, social studies, math, art and other curriculum areas, as well as program by non-formal educators. [url=http://www.michaelkorsbags.me]michael kors handbags[/url] Harang struck out four and walked one.
    Politics & GovernmentElectionsMichiganSanders [url=http://www.michaelkorshandbagsup.us.com]michael kors outlet[/url] The mother will care for it. j [url=http://www.michaelkorshandbagsoutletbuy.us.com]michael kors outlet online[/url]
    She will also have to register as a sex offender [url=http://www.coachstoresonline.com]coach outlet store online[/url] Kosmicki would better serve San Benito County Today if he spent more time focused on what Council Member Luna is doing RIGHT to help the community thrive instead of trying to tearing her down with negative innuendo.
    b “I want to thank Coach Andersen for the opportunity at Oregon State and wish all of my teammates outstanding success in the future,” Mitchell said in a release. [url=http://www.coachhandbags.com.co]coach outlet[/url] completing enrollment in the pivotal Phase 3 clinical study of SGX301 in the treatment of CTCL and reporting of preliminary results; t
    Update: That suitwas withdrawn, a Little League spokesman confirmed Friday [url=http://www.michaelkorshandbagsoutletbuy.us.com]michael kors outlet[/url] The press release only mentions that “Muslim American law enforcement officers responded to the scene in San Bernardino. [url=http://www.louisvuittonhandbagsrack.us.com]louis vuitton outlet[/url]
    Carlos Guerra to Federal National Mortgage Association, 30 Shadowbrook Estates, $173,845. [url=http://www.coachoutletstoreonline.me]http://www.coachoutletstoreonline.me[/url] “I think it’s fair to say that no one no one has done more for Little Rock, for Arkansas, for the education in libraries than Bobby Roberts,” Rutherford told a crowd gathered last week to hear Roberts speak about his experiences. j [url=http://www.cheapjordanshoes.us.org]cheap jordan shoes[/url]
    RELATED LINK: VIDEO: Erin Andrews’ father: ’she feared for her own life’ over peeping Tom stalker [url=http://www.louisvuittonhandbagsbuy.us.com]cheap louis vuitton bags[/url] “It’s really important for people to know their presence makes a huge impact.
    Happy Veterans Day to every veteran, and if you receive your care with us, thank you! We are proud to serve those who have served. [url=http://o.storeonlinecc.com]oakley outlet[/url] He said he was uncomfortable with how the auditor’s office was being run and quit on July 23. t [url=http://www.louisvuitton-outlet.us.org]www.louisvuitton-outlet.us.org[/url]
    Gantt, an eighth-grader, said We the People taught him how government works and inspired him to teach other students. [url=http://www.raybansunglasses.name]ray ban sunglasses outlet[/url] Every one of them has an option fordesigning a room.

    [回复]

  3. 2016年4月7日23:13 | #3

    Like many other chains, are relying on pumpkin’s popularity as the lynchpin of their holiday season menu features. [url=http://www.coachoutletstoreonline.me]coach outlet store online[/url] But as prices for regular have dropped sharply in the past six months, the gap has increased. i [url=http://www.louisvuittonhandbagsbuy.us.com]cheap louis vuitton bags[/url]
    Nurse Stephen Nicolosi(left) plays Old Maid with patient Landon Knepp and his parents Katie, and Adam at the Penn State Hershey Children’s Hospital. [url=http://www.coachoutletstores.net.co]http://www.coachoutletstores.net.co[/url] STROLL.
    “I probably would have ended up signing somewhere else,” . “Think about it. I was the last option out of those guys, so they both would have gotten max deals, and they wouldn’t have given me my deal. They only signed me because I was the only low post threat left on the team. If they had Greg, they don’t give me the number I wanted, and I’m somewhere else. I think about it all the time. I wouldn’t even be here had Greg not gotten hurt.” [url=http://www.coachoutletssonline.us.org]http://www.coachoutletssonline.us.org[/url] No matter what the legal arguments, I believe that the three vendors mentioned can have an impact, but I hardly believe that impact, at the far end of the event area, is the make or break issue fir an unpaid $90,000 bill. l [url=http://www.michaelkorshandbags.us.org]michael kors handbags[/url]
    Fellow Senior Malalay Khalid says the club has changed her perspective. [url=http://www.coachoutletsonlines.us.org]coach outlet online[/url] But they’re the lasting lessons that continue with those individuals.
    n Complete results can be . [url=http://www.coachoutletstores.net.co]www.coachoutletstores.net.co[/url] “Coach Robb Smith . [url=http://www.coachoutletonlinebuy.us.com]coach factory outlet[/url]
    The latest polls out of Florida Monday showed Rubio trailing Trump substantially, and the most recent Ohio polling had Kasich about five points behind [url=http://www.michaelkorshandbagstrade.us.com]michael kors outlet store[/url] All events are free unless otherwise noted. http://www.michaelkorshandbags.us.org
    This wasthe second time in six days the teams have played each other. The Blazers defeated the Lakers 107-93 Sunday night in Los Angeles thanks to Lillard’s 30 points and career-high 13 assists. [url=http://www.cheapjordanshoes.us.org]cheap jordan shoes[/url] Hill, 18, of Ashdown, were injured and taken to Christus St. q [url=http://www.coachfactorysoutlet.com]http://www.coachfactorysoutlet.com[/url]
    “It’s a really natural fit for us as far as the kind of player we look for, elite athlete, tremendous makeup, and whoever you ask, it’s universal, this guy’s a big-time competitor, plays hard, runs hard, pushes other players,” Daniels said. [url=http://www.louisvuittonhandbagsrack.us.com]http://www.louisvuittonhandbagsrack.us.com[/url] The Ducks snapped the Kings’ four-game road playoff winning streak dating to their 0-3 comeback in the first round against San Jose.
    It’s like trying to fit the story in a box. [url=http://www.michaelkorshandbagstrade.us.com]michael kors outlet online[/url] Tuesday’s announcement is the second time the department has freed up unused earmarks.
    There is a moment when the film looks like it won’t take the predictable turn. [url=http://www.coachoutlet.cc]coach factory outlet[/url] It added to a memorable day at the AT&T Pebble Beach Pro-Am, where Kang and Hiroshi Iwata of Japan wound up tied for the lead.
    The Compute Stick is a fine streaming device, which could help some people overlook its weaker points. [url=http://www.coachhandbags.me]http://www.coachhandbags.me[/url] Add the remaining tablespoon of oil to the skillet; reduce the heat to medium, then add the onion and carrot.
    r Paritaprevir has been developed by AbbVie for use in combination with AbbVie s other investigational medicines for the treatment of chronic hepatitis C [url=http://o.storeonlinecc.com]oakley outlet[/url] “We could fight off battle after battle.
    Really hard. [url=http://www.coachstoresonline.com]coach outlet online[/url] Around 17,000 U. r [url=http://www.louisvuittonbagsbuy.us.com]louis vuitton bags[/url]
    Fastweb lets students create personalized profiles that can be matched against its expansive databases of colleges and scholarships. [url=http://www.michaelkorshandbagsoutletbuy.us.com]http://www.michaelkorshandbagsoutletbuy.us.com[/url] This legislation serves minority groups in California to ensure their votes aren’t being diluted in at-large elections.
    t It was Kronwall’s first goal since March 29, ending a 28-game drought. [url=http://www.michaelkors.us.org]michael kors outlet[/url] She went to a very small college with no reputation, has no master’s degree, yet she makes at least twice my salary. g
    Defensively, they’re long, they’re active. [url=http://www.coachhandbags.com.co]coach outlet online[/url] In four districts, median values declined. [url=http://www.coachoutletssonline.us.org]coach outlet[/url]
    Frances M. Capone, Susan Lafond, Sherri Capone, Paul Capone and Karen Barrett to Michael B. Gallagher, 133 Manchester Terrace, $154,900. [url=http://www.coachoutletssonline.us.org]www.coachoutletssonline.us.org[/url] Approximately 100 middleschool girls came to Lexmark s global headquarters in Lexington, Kentucky, to learn what it s like to be an engineer. y [url=http://www.coachoutletsonlines.us.org]coach outlet online[/url]
    Gil Kerlikowske is head of U. [url=http://www.louisvuittonhandbagsbuy.us.com]cheap louis vuitton bags[/url] Kellis, 3:45 p.
    Deutsche Bank Trust Co. America, trustee, to Joseph Basile, 83-85 Granby St., $110,000. [url=http://www.coachoutletstoreonline.me]coach outlet store online[/url] And even when they make mistakes or go against our advice, they are still our children, and we still love them and want what is best for them. t [url=http://www.coachfactorysoutlet.com]coach factory outlet[/url]
    Other goodies include a festival lanyard, free poster, shirt and program [url=http://www.michaelkorshandbagsoutletbuy.us.com]michael kors outlet[/url] I can move better than Ihave been able to in a long time and it is just a greatfeeling.

    [回复]

  4. 2016年2月13日14:55 | #4
  5. 2016年2月13日14:56 | #5

    @e,

    [回复]

评论分页
1 2 40743
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
:wink: :-| :-x :twisted: :) 8-O :( :roll: :-P :oops: :-o :mrgreen: :lol: :idea: :-D :evil: :cry: 8) :arrow: :-? :?: :!: