Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to use vim in Android Studio, Useful customization IdeaVim

2,377 views

Published on

- How to use vim in Android Studio
- Useful keymapping .ideavimrc
- Useful customization IdeaVim

Published in: Software
  • Login to see the comments

  • Be the first to like this

How to use vim in Android Studio, Useful customization IdeaVim

  1. 1. kimkevin@DroidNights2018: ~ : How to use Vim in Android Studio useful customization IdeaVim ~ ~ ~ ~ ~ ~ kimkevin@DroidNights2018: ~
  2. 2. kimkevin@DroidNights2018: ~
  3. 3. kimkevin@DroidNights2018: ~ 1./** 2. * Created by kimkevin 3. * imkimkevin@gmail.com 4. * @imkimkevin 5. * github.com/kimkevin 6. */ 7. ~ ~ ~ ~ ~
  4. 4. kimkevin@DroidNights2018: ~ What is Vim? Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. Vim is often called a "programmer's editor," and so useful for programming that many consider it an entire IDE. Vim is perfect for all kinds of text editing, from composing email to editing configuration files. – Johnny Appleseed
  5. 5. kimkevin@DroidNights2018: ~ IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ platform. IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm, RubyMine, AppCode, DataGrip, GoLand, Cursive, and Android Studio. – Jetbrains ideavim GitHub What is IdeaVim?
  6. 6. kimkevin@DroidNights2018: ~ $ How to use Vim in Android Studio
  7. 7. kimkevin@DroidNights2018: ~ 1. Basic Vim Shortcuts 2. 3.
  8. 8. kimkevin@DroidNights2018: ~
  9. 9. kimkevin@DroidNights2018: ~
  10. 10. kimkevin@DroidNights2018: ~ https://cdn.pixabay.com/photo/2016/11/19/10/46/apple-1838564_1280.jpg navigate on a single line Easy navigation on a word a line a paragraph without using Mouse
  11. 11. kimkevin@DroidNights2018: ~ public void setUser(User user) // $ : the end of line public void setUser(User user) // 0 : the start of the line public void setUser(User user) // w : move forward word public void setUser(User user) // b : move backward word public void setUser(User user)
  12. 12. kimkevin@DroidNights2018: ~ public void setUser(User user) // 2w : move forward two words public void setUser(User user) // dw : delete forward word public void (User user) // u : undo public void setUser(User user) // db : delete backward word public setUser(User user)
  13. 13. kimkevin@DroidNights2018: ~ dd : delete a line [count]dd : delete [count] lines // ex) 4dd : delete 4 lines yy : copy a line [count]yy : copy [count] lines // ex) 4yy : copy 4 lines { : forward paragraph // ex) 2{ : forward 2 paragraphs } : backward paragraph // ex) 2} : forward 2 paragraphs
  14. 14. kimkevin@DroidNights2018: ~ 1. Basic Vim Shortcuts 2. Useful Mappings in .ideavimrc
  15. 15. kimkevin@DroidNights2018: ~ The Most Used Action is ‘Run’ Ctrl + Shift + r or in my case, rr
  16. 16. kimkevin@DroidNights2018: ~ vi ~/.ideavimrc File for your specific Vim initialization commands
  17. 17. kimkevin@DroidNights2018: ~ ./refactoring_by_keymap DEMO
  18. 18. kimkevin@DroidNights2018: ~ .ideavimrc Keymap nnoremap <leader>rr :action Run<cr> nnoremap <leader>dd :action Debug<cr> nnoremap <leader>cc :action CleanGradleProject<cr> nnoremap <leader>ss :action Android.SyncProject<cr> nnoremap <leader>fu :action FindUsages<cr> nnoremap <leader>su :action ShowUsages<cr> nnoremap <leader>ga :action GotoAction<cr> nnoremap <leader>lc :action ActivateLogcatToolWindow<cr> nnoremap <leader>sh :action ActivateTerminalToolWindow<cr> nnoremap <leader>R :action Refactorings.QuickListPopupAction<cr> nnoremap <leader>rm :action ExtractMethod<cr> nnoremap <leader>rn :action RenameElement<cr> nnoremap <leader>rf :action RenameFile<cr> nnoremap <leader>rv :action IntroduceVariable<cr> nnoremap <leader>rs :action ExtractSuperclass<cr> nnoremap <leader>ri :action Inline<cr> https://github.com/kimkevin/dotfiles/blob/master/.ideavimrc
  19. 19. kimkevin@DroidNights2018: ~ .ideavimrc Keymap nnoremap <leader>rr :action Run<cr> nnoremap <leader>dd :action Debug<cr> nnoremap <leader>cc :action CleanGradleProject<cr> nnoremap <leader>ss :action Android.SyncProject<cr> nnoremap <leader>fu :action FindUsages<cr> nnoremap <leader>su :action ShowUsages<cr> nnoremap <leader>ga :action GotoAction<cr> nnoremap <leader>lc :action ActivateLogcatToolWindow<cr> nnoremap <leader>sh :action ActivateTerminalToolWindow<cr> nnoremap <leader>R :action Refactorings.QuickListPopupAction<cr> nnoremap <leader>rm :action ExtractMethod<cr> nnoremap <leader>rn :action RenameElement<cr> nnoremap <leader>rf :action RenameFile<cr> nnoremap <leader>rv :action IntroduceVariable<cr> nnoremap <leader>rs :action ExtractSuperclass<cr> nnoremap <leader>ri :action Inline<cr>
  20. 20. kimkevin@DroidNights2018: ~ .ideavimrc Keymap nnoremap <leader>rr :action Run<cr> nnoremap <leader>dd :action Debug<cr> nnoremap <leader>cc :action CleanGradleProject<cr> nnoremap <leader>ss :action Android.SyncProject<cr> nnoremap <leader>fu :action FindUsages<cr> nnoremap <leader>su :action ShowUsages<cr> nnoremap <leader>ga :action GotoAction<cr> nnoremap <leader>lc :action ActivateLogcatToolWindow<cr> nnoremap <leader>sh :action ActivateTerminalToolWindow<cr> nnoremap <leader>R :action Refactorings.QuickListPopupAction<cr> nnoremap <leader>rm :action ExtractMethod<cr> nnoremap <leader>rn :action RenameElement<cr> nnoremap <leader>rf :action RenameFile<cr> nnoremap <leader>rv :action IntroduceVariable<cr> nnoremap <leader>rs :action ExtractSuperclass<cr> nnoremap <leader>ri :action Inline<cr>
  21. 21. kimkevin@DroidNights2018: ~ nnoremap <leader>rr :action Run<cr> n + nore + map normal mode + non-reculsive + map {cmd} {attr} {lhs} {rhs}
  22. 22. kimkevin@DroidNights2018: ~ nnoremap <leader>rr :action Run<cr> <leader> : (back slash) <space> : Space <C-A> : Ctrl + a <tab> : Tab {cmd} {attr} {lhs} {rhs}
  23. 23. kimkevin@DroidNights2018: ~ nnoremap <leader>rr :action Run<cr> // {lhs} : left hand side // {rhs} : right hand side :actionlist (Show all actions) ex) Run, RenameElement, FindUsages <cr> : carriage return {cmd} {attr} {lhs} {rhs}
  24. 24. kimkevin@DroidNights2018: ~ $ Useful Customization IdeaVim
  25. 25. kimkevin@DroidNights2018: ~ Write Codes
  26. 26. kimkevin@DroidNights2018: ~
  27. 27. kimkevin@DroidNights2018: ~ Search on Google
  28. 28. kimkevin@DroidNights2018: ~ Cmd + Tab
  29. 29. kimkevin@DroidNights2018: ~ Cmd + Tab Cmd + Tab Cmd + Tab Cmd + Tab
  30. 30. kimkevin@DroidNights2018: ~ The problem is So boring… What’s Wifi address?… and port… EVERYDAY EVERYTIME
  31. 31. kimkevin@DroidNights2018: ~ https://brunch.co.kr/@travel-heather/147 Be lazy wisely!
  32. 32. kimkevin@DroidNights2018: ~ OPEN
  33. 33. kimkevin@DroidNights2018: ~ :
  34. 34. kimkevin@DroidNights2018: ~ 1. EX mode is which is invoked using the ex command. 2. This is for the Ex commands, 3. ”:", the pattern search 4. commands, "?" and "/", and the 5. filter command, "!". ~ ~ ~ ~ :%s/command/cmd/g
  35. 35. kimkevin@DroidNights2018: ~ 1. EX mode is which is invoked using the ex cmd. 2. This is for the Ex cmds, 3. ”:", the pattern search 4. cmds, "?" and "/", and the 5. filter cmd, "!". ~ ~ ~ ~ ~
  36. 36. kimkevin@DroidNights2018: ~ !
  37. 37. kimkevin@DroidNights2018: ~ :! {command} EX mode Execute {command} with a shell
  38. 38. kimkevin@DroidNights2018: ~ :! adb tcpip 5555
  39. 39. kimkevin@DroidNights2018: ~
  40. 40. kimkevin@DroidNights2018: ~ VIM: Cannot run program “adb”:error=2
  41. 41. kimkevin@DroidNights2018: ~ WHAT?
  42. 42. kimkevin@DroidNights2018: ~ Make adb run in ideavim
  43. 43. kimkevin@DroidNights2018: ~ : adb tcpip 5555 EX command
  44. 44. kimkevin@DroidNights2018: ~ What should I do first? https://github.com/JetBrains/ideavim
  45. 45. kimkevin@DroidNights2018: ~ https://github.com/kimkevin/ideavim-as
  46. 46. kimkevin@DroidNights2018: ~ https://github.com/kimkevin/ideavim-as git git commands adb adb start <device_ip_address> adb start : Once it's connected, IP address will be existed. Google Search gg <query_string> gg : If clipboard has a string Supported:
  47. 47. kimkevin@DroidNights2018: ~ DEMO ./additional_ex_commands
  48. 48. kimkevin@DroidNights2018: ~ How it works?
  49. 49. kimkevin@DroidNights2018: ~ https://github.com/kimkevin/ideavim-as git git commands adb adb start <device_ip_address> adb start : Once it's connected, IP address will be existed. Google Search gg <query_string> gg : If clipboard has a string Supported:
  50. 50. kimkevin@DroidNights2018: ~ DataContext - Data Object by Identifier ExCommand - Command - Arguments Editor - Project (path, document) - EditorColorsScheme - EditorSettings
  51. 51. kimkevin@DroidNights2018: ~ 1. Create EX command Handler and Register CommandParser 2. Set command and flags on super class 3. Write codes in execute() 4. Run and Test
  52. 52. kimkevin@DroidNights2018: ~ $ What I learned
  53. 53. kimkevin@DroidNights2018: ~ 1. Fun to make something suitable for your taste 2. 3.
  54. 54. kimkevin@DroidNights2018: ~ 1. Fun to make something suitable for your taste 2. Pair Programming 3.
  55. 55. kimkevin@DroidNights2018: ~ Pair Programming - Disabled Vim Emulator
  56. 56. kimkevin@DroidNights2018: ~ 1. Fun to make something suitable for your taste 2. Pair Programming 3. Learning Curve
  57. 57. kimkevin@DroidNights2018: ~ https://pascalprecht.github.io/2014/03/18/why-i-use-vim Vim Learning Curve
  58. 58. kimkevin@DroidNights2018: ~ https://pascalprecht.github.io/2014/03/18/why-i-use-vim Normally
  59. 59. kimkevin@DroidNights2018: ~ Make you lazy!
  60. 60. kimkevin@DroidNights2018: ~ : wq! thankYou() ~ ~ ~ ~ ~ ~

×