SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
Auto-closing parenthesis 
2014/11/5 VimConf 2014 
cohama / @c0hama
About me 
cohama 
❖ Twitter @c0hama 
❖ from Nagoya 
➢ Nagoya.vim 
❖ Agit.vim, 
the-ocamlspot.vim 
❖ JavaScript, Haskell
Introduction 
reverse(range(1, winnr('$' 
How many ) do we need to type?
Introduction 
while (true) { 
if (p == 1) { 
foo(); 
break; 
How about } ?
Introduction 
❖ We need auto-closing. 
reverse(range(1, winnr('$'))) 
while (true) { 
if (p == 1) { 
foo(); 
break; 
} 
}
For example 
❖ Atom
For example 
❖ Sublime Text
For example 
❖ Eclipse
In Vim...
Table of Contents 
❖ Pure Vim way 
❖ Some Plugins 
❖ About lexima.vim
Table of Contents 
❖ Pure Vim way 
❖ Some Plugins 
❖ About lexima.vim
Pure Vim way 
inoremap ( ()<Left> 
inoremap [ []<Left> 
inoremap " ""<Left> 
Very easy but ...
Pure Vim way but ... 
let w = winnr()) 
let w = winnr) 
let leftparen = "()" 
We need Plugin Power! 
I'm'
Auto-closing requirements 
Before Input After 
| ( (|) 
(|) ) ()| 
(|) <BS> | 
I| 'm I'm| 
syntax-specific rules 
filetype-specific rules
Table of Contents 
❖ Pure Vim way 
❖ Some Plugins 
❖ About lexima.vim
delimitMate 
Raimondi/delimitMate 
❖ some useful features 
<C-G>g 
("foo|") ("foo")| 
❖ unable to dot-repeat
Unable to dot-repeat 
"foo" 
"bar" 
A, "x"<Esc> 
"foo, "x" 
"bar"
Unable to dot-repeat 
j. 
"foo", "x" 
"barx" 
"foo, "x" 
"bar"
vim-smartinput 
kana/vim-smartinput 
❖ highly customizable 
call smartinput#define_rule({ 
 'at': '<%#', 
 'char': '%', 
 'input': '% %><Left><Left><Left>'}) 
❖ unable to dot-repeat 
<% | %> 
% 
<|
Table of Contents 
❖ Pure Vim way 
❖ Some Plugins 
❖ About lexima.vim
About lexima.vim 
cohama/lexima.vim 
❖ highly customizable (inspired by vim-smartinput) 
❖ dot-repeatable 
❖ unstable
lexima.vim's rule definition 
inspired by kana/vim-smartinput 
call lexima#add_rule({ 
 'at': '<%#', 
 'char': '%', 
 'input': '% ', 
 'input_after': ' %>'}) 
compatible with vim-smartinput 
<% | %> 
% 
<|
lexima.vim's endwise-rule 
❖ inspired by tpope/vim-endwise 
❖ Of course, dot-repeatable 
def foo 
| 
end 
<CR> 
def foo|
Mechanism 
In case of (foo<Esc> 
(| 
(|) 
(foo|) 
(foo| 
(foo)| 
(foo|) 
input ( 
call setline() 
input foo 
call setline() 
input ) 
call setpos()
Demo
Thanks

Contenu connexe

Similaire à Auto closing parenthesis @vim conf2014

Introduction to Vim plugins developed by non-Japanese Vimmer (English version)
Introduction to Vim plugins developed by non-Japanese Vimmer (English version)Introduction to Vim plugins developed by non-Japanese Vimmer (English version)
Introduction to Vim plugins developed by non-Japanese Vimmer (English version)deris0126
 
Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11John Wilker
 
Vim Script Programming
Vim Script ProgrammingVim Script Programming
Vim Script ProgrammingLin Yo-An
 
Cranking Floating Point Performance To 11 On The iPhone
Cranking Floating Point Performance To 11 On The iPhoneCranking Floating Point Performance To 11 On The iPhone
Cranking Floating Point Performance To 11 On The iPhoneNoel Llopis
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchinaguestcf9240
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaLin Yo-An
 
Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vimsambismo
 
Get Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsGet Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsDavey Shafik
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scalaRuslan Shevchenko
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.VimLin Yo-An
 
A Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on RailsA Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on RailsRafael García
 
Scalalable Language for a Scalable Web
Scalalable Language for a Scalable WebScalalable Language for a Scalable Web
Scalalable Language for a Scalable WebTimothy Perrett
 
Start Vim script @Ujihisa.vim 2011/11/19
Start Vim script @Ujihisa.vim 2011/11/19Start Vim script @Ujihisa.vim 2011/11/19
Start Vim script @Ujihisa.vim 2011/11/19Akihiro Okuno
 
week5_giveup_pwn.pdf
week5_giveup_pwn.pdfweek5_giveup_pwn.pdf
week5_giveup_pwn.pdfssuser83af16
 

Similaire à Auto closing parenthesis @vim conf2014 (20)

Introduction to Vim plugins developed by non-Japanese Vimmer (English version)
Introduction to Vim plugins developed by non-Japanese Vimmer (English version)Introduction to Vim plugins developed by non-Japanese Vimmer (English version)
Introduction to Vim plugins developed by non-Japanese Vimmer (English version)
 
Vim Hacks
Vim HacksVim Hacks
Vim Hacks
 
Vim Hacks
Vim HacksVim Hacks
Vim Hacks
 
Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11
 
Vim Script Programming
Vim Script ProgrammingVim Script Programming
Vim Script Programming
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
Cranking Floating Point Performance To 11 On The iPhone
Cranking Floating Point Performance To 11 On The iPhoneCranking Floating Point Performance To 11 On The iPhone
Cranking Floating Point Performance To 11 On The iPhone
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchina
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchina
 
Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vim
 
Get Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsGet Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP Streams
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scala
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.Vim
 
Gashuku Presen
Gashuku PresenGashuku Presen
Gashuku Presen
 
Gashuku Presen
Gashuku PresenGashuku Presen
Gashuku Presen
 
Vim再入門
Vim再入門Vim再入門
Vim再入門
 
A Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on RailsA Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on Rails
 
Scalalable Language for a Scalable Web
Scalalable Language for a Scalable WebScalalable Language for a Scalable Web
Scalalable Language for a Scalable Web
 
Start Vim script @Ujihisa.vim 2011/11/19
Start Vim script @Ujihisa.vim 2011/11/19Start Vim script @Ujihisa.vim 2011/11/19
Start Vim script @Ujihisa.vim 2011/11/19
 
week5_giveup_pwn.pdf
week5_giveup_pwn.pdfweek5_giveup_pwn.pdf
week5_giveup_pwn.pdf
 

Plus de cohama

Vim の話
Vim の話Vim の話
Vim の話cohama
 
2016 04-15 nl-nagoya_vim8
2016 04-15 nl-nagoya_vim82016 04-15 nl-nagoya_vim8
2016 04-15 nl-nagoya_vim8cohama
 
2015 12-04 about_neovim
2015 12-04 about_neovim2015 12-04 about_neovim
2015 12-04 about_neovimcohama
 
2014 12-06 ngk2014-b_2014年のvim
2014 12-06 ngk2014-b_2014年のvim2014 12-06 ngk2014-b_2014年のvim
2014 12-06 ngk2014-b_2014年のvimcohama
 
How to use git from vim @vim conf2013
How to use git from vim @vim conf2013How to use git from vim @vim conf2013
How to use git from vim @vim conf2013cohama
 
(初心者向け) Vim の機能紹介@nagoya.vim #1
(初心者向け) Vim の機能紹介@nagoya.vim #1(初心者向け) Vim の機能紹介@nagoya.vim #1
(初心者向け) Vim の機能紹介@nagoya.vim #1cohama
 
Vim script と vimrc の正しい書き方@nagoya.vim #1
Vim script と vimrc の正しい書き方@nagoya.vim #1Vim script と vimrc の正しい書き方@nagoya.vim #1
Vim script と vimrc の正しい書き方@nagoya.vim #1cohama
 
すごいVimでhaskellを書こう@なごやまつり
すごいVimでhaskellを書こう@なごやまつりすごいVimでhaskellを書こう@なごやまつり
すごいVimでhaskellを書こう@なごやまつりcohama
 

Plus de cohama (8)

Vim の話
Vim の話Vim の話
Vim の話
 
2016 04-15 nl-nagoya_vim8
2016 04-15 nl-nagoya_vim82016 04-15 nl-nagoya_vim8
2016 04-15 nl-nagoya_vim8
 
2015 12-04 about_neovim
2015 12-04 about_neovim2015 12-04 about_neovim
2015 12-04 about_neovim
 
2014 12-06 ngk2014-b_2014年のvim
2014 12-06 ngk2014-b_2014年のvim2014 12-06 ngk2014-b_2014年のvim
2014 12-06 ngk2014-b_2014年のvim
 
How to use git from vim @vim conf2013
How to use git from vim @vim conf2013How to use git from vim @vim conf2013
How to use git from vim @vim conf2013
 
(初心者向け) Vim の機能紹介@nagoya.vim #1
(初心者向け) Vim の機能紹介@nagoya.vim #1(初心者向け) Vim の機能紹介@nagoya.vim #1
(初心者向け) Vim の機能紹介@nagoya.vim #1
 
Vim script と vimrc の正しい書き方@nagoya.vim #1
Vim script と vimrc の正しい書き方@nagoya.vim #1Vim script と vimrc の正しい書き方@nagoya.vim #1
Vim script と vimrc の正しい書き方@nagoya.vim #1
 
すごいVimでhaskellを書こう@なごやまつり
すごいVimでhaskellを書こう@なごやまつりすごいVimでhaskellを書こう@なごやまつり
すごいVimでhaskellを書こう@なごやまつり
 

Dernier

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Dernier (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Auto closing parenthesis @vim conf2014