JC Web Concepts

My Switch to Neovim

Image of how my Neovim looks like

For the longest time I have been hopping from editor to editor. I have used Notepad++, Sublime Text, Atom, and recently Visual Studio Code. I have known so many people who keep telling me to try and use Vim. They say you will love it. So, for the past 6 months I have been using Neovim. It has been a long challenge to not go back, but it is growing on me as an editor. Now I am not here to tell you that Vim is better than any other editor. I am not here to tell you that you should use it. I want to tell you why I enjoy using it and then you can make your own decision.

Neovim

So the hardest part for me in using vim/neovim was learning the keyboard shortcuts. If you are not a keyboard shortcut person, then using Vim is out of the question. I like to use them but never train myself in them so this is one of the first things I had to do. I had to start memorizing them. The problem I ran into was there was just way too many. Then a friend of mine told me that instead of just opening a help document and learning them all, he told me to learn a new command a week. He told me that when I find a new command to learn, write it on a sticky note and put it on my monitor. So that is what I did, I found that I was hitting w or e to get to the beginning or ending of a line. So the first command set that I need helping getting into muscle memory was Shift+I and Shift+A.

So as I was watching others on YouTube and reading articles, they recommend learning h,j,k,land to do so they recommended, https://vim-adventures.com/. So I did that and learned to become a master of those keys. Man did that save my fingers so much. So then I had to train myself to not use the arrow keys to move. To do this, in my vimrc I put in a snippet to echo “Stop being stupid!”, thanks Nick Nisi.

The other big mistake I made when I first started to learn vim, was to use someone elses vimrc verbatim. You should never ever do this, ever. You should start off with an empty or bare essential vimrc. Then when things are not what you need it to be, then add it to your vimrc. When I first started I did this and man it made things so confusing. Half of the plugins, I never used, others caused weird behavior that I was not expecting. So after awhile. So soon I ended up with my Neovim/vim look like this:

Image of how my Neovim looks like

So if you want to look over my vimrc, you may do so but remember, don’t just copy it and use it as your own as it may not be what you need. Take pieces of it. Any questions, please comment below and I will try to answer them

Using TextMate Over Eclipse?

So as doing automation as my everyday job I find myself in the Eclipse IDE all day. Now there are lots of advantages of using Eclipse but I hate that it is so slow. One day I got so frustrated that I decided to try using my favorite editor TextMate, to do my job. So I thought I would discuss both applications and what I like and disliked. Please post comments or reply to me on twitter with your comments.

Eclipse
This is a very popular tool that a lot over developers use for Java programming. It has a lot of features to autocomplete method names. Code refactoring is another nice tool that it has. If you are working with Maven and TestNG it is also supported as well. The two biggest issues with Eclipse is that it is slow and a big resource hog. Other than that it is not that bad.

TextMate
This is a popular text editor for the Mac. With its bundle support it is a very nice tool to use. TextMate does have bundles that cover Maven and some TestNG. The issues that I come up with is that autocomplete is limited in TextMate. If I am referencing a page object and I want to call a method of that page object, there is no autocomplete for that. This is the biggest reason why I have trouble using TextMate as my editor for Selenium code. I like TextMate cause it is small and is not a resource hog.Again if I am missing something with TextMate, please let me know. I would love to be able to get rid of Eclipse all together.

TextMate

As a web developer one of the things you look for is a good editor to use to code your projects. When I was using Windows I would use and app called Notepad++ which was an awesome editor. When I switched to a mac finding an editor was a little difficult. Well I believe I have found it. TextMate is the app that had what I was looking for. As I am still learning it I have fallen in love with this application. It is not free but it is well worth it. I am even writing this blog post in it and able to upload it right to my blog all from TextMate. It is not free but it is well worth it. All the plugins which are called bundles make it easy for you to customize the app to you liking.

In a future post I will have some video on how to do things in TextMate. So stay tuned and thanks.

Bluefish IDE Editor

Well as a PHP, HTML, CSS, and jQuery designer one of the things I have been looking for is a good lightweight text editor. I have used many different types of editors and not found the right one. When I programmed in Windows I loved Notepad++, but there is no Mac/Linux equivalent. The editors that I have used in the past are as follows:

  • NVU
  • Dreamweaver
  • VIM
  • Eclipse
  • Bluefish

    The last editor I was and still will use is VIM. There is times I just want to click somewhere to move my cursor, I.E. Being lazy. I really like bluefish cause it is very lightweight and fast. Eclipse and Dreamweaver just are too slow for me. Bluefish will work in Mac, Linux, and Windows. The best thing I like about it, is it is free. So take a look at them, post some comments about what you think is the best. Maybe you have one that I just have not seen.

Setting Up Eclipse

I wanted to talk about how to setup your Eclipse IDE to work with Selenium, Maven, and TestNG. For those who do not know what those are you can click on the link to learn more. I will be making some more posts/tutorials on how to use these items. Eclipse can run on Mac, Linux, and or Windows. You need to have Java installed and if you want to work with SVN then you need the command line SVN client. From the video below here is the list of the sites that you will need to add to Eclipse:


    
    
    
    
        org.apache.maven.plugins
        maven-surefire-plugin
        2.4.3
        
          
              
                  app.env
                  ${app.env}
              
          
        
            **/TestUtilities.java
        
        
    
    
        org.apache.maven.plugins
        maven-compiler-plugin
        
          1.5
          1.5
        
    
      
          org.apache.maven.plugins
          maven-checkstyle-plugin
          2.2
          
              checkstyle.xml
              true
              true
              true
              true
          
          
              
                  validate
                  
                      check
                  
              
          
      
    
    
    
    
    net.sf.jacob-project
    jacob
    1.14.3
    
    
      org.springframework
      spring
      2.5.5
    
    
      org.springframework
      spring-webmvc
      2.5.5
    
    
      org.springframework
      spring-test
      2.5.3
    
    
      javax.servlet.jsp
      jsp-api
      2.1
    
    
      log4j
      log4j
      1.2.14
      runtime
    
    
      javax.servlet
      servlet-api
      2.4
    
    
      oracle
      oracle
      14
      test
    
    
    org.testng
    testng
    5.11
    jdk15
    test
    
    
    org.seleniumhq.selenium
    selenium
    2.0a2
    
    
    org.seleniumhq.selenium
    selenium-server
    2.0a2
    
    

VIM Tutorial

When I first started working with Linux one of the tools I disregarded was VIM. I felt it to be too confusing and believed it was not worth it at all. I was so use too notepad, nano, pico, etc… Then a programmer finally convinced me one day to make a switch. I am so glad I did. So the first thing you have to get use to is that there are two modes to be in. One is command mode and the other is in insert mode. When in command mode you can save or do other things like find and replace. In insert mode you do like you normally do. You type away. I know it sounds confusing now but wait and I will show you what I mean.

VIM can be found in Mac, Linux, Unix, and or Windows. To start a file you bring up your terminal or if in Windows you open the application in your start menu. In the terminal type the following:

vim whateverfilename

Command Mode

Ok so lets get into some of the things you can do in command mode. So lets say you have to edit a document for work and you have to change the word Bob with the word John. hit ESC to make sure you are in command mode and hit the following:

:% s/Bob/John/g

The g at the end will make sure it goes thru the whole document. To search for some text is not that hard to do. So lets say we want to find all instance of the word happy. You will do the following:

/happy

When you find the first result you can hit n on your keyboard to go to the next instance that it finds the work happy. If there is none it will tell you that there is none. Now I am sure you are asking how do I search for multiple words? Well let me show you how to search for Happy Birthday

/Happy Birthday

As you can see you I did the same thing as above. VIM knew that you were looking for multiple words. Before you ask if there is a term in the document called Birthday of Happy, it will not bring that up as a result. The next thing I want to show you is if you need to get to line 10000 in a file all you have to do is the following:

:10000

Yep that is it. To wrap up this first tutorial on VIM I will show you how to quit without saving, saving but not exiting, and saving and exit. Here they are in order.

:q!

The q stands for quit. If you forget the ! you would be prompted about saving before quiting

:w

The w tells VIM that you want to save the changes

:wq

As you see we combined the w and the q to save the changes then quit. Now before you ask, if you would do :qw that would fail. Cause vim reads the commands from left to right. Well I think that is enough for now. If you have any questions about vim please post a comment. Below is a video on what I basically explained above.

Coda

Well I have been in search for a great text editor for my Mac and I might have found one. I have tried demos of BBEdit , Text Wrangler , and TextMate . These were ok editors but I really like an application called Coda . This app has what every web developer / IT guy needs.
Basically this application gives you several options in one application. If you are like me I so a lot of SSH work and have to open up the terminal and or putty. With Coda you can click on the Terminal tab and you can SSH into your server of need. Are you the type that you do not really like CSS and do not want to understand it? Well with the CSS tab you can add CSS styles the way Dreamweaver does it. It is self explaining and makes it easier. Now I do not use this function myself but it is very friendly. The last thing I need to discuss is the sites section. This will let you setup site folders for easy site management. I really like this feature. I do not use it cause I personally put everything in an SVN but it is a nice one. For more information visit their site.

Aptana

At work today a colleague and I were talking about software for web development. He then asked me about an application called Aptana . I have heard about and tried it in the past. In the past I did not like it. I felt that it was too heavy for me at the time. I should explain back when I tried this I just did HTML work and nothing else. Now I do things like XHTML, CSS, Javascript, PHP, BASH, and Flash. So now this IDE suite is something that I could really use.

Basically if you are a type that hits many programming languages this app is for you. If you have multiple websites that you manage then this app would be for you. They make many plugins for this suite that it is well worth it. Now before I started to use this I was a hugh fan of Adobe Dreamweaver . If anyone would try to tell me different I would tell them that they are nuts.
Now an app like Dreamweaver costs around $350.00 USD. Aptana is free but you can buy the professional version which gives you some more advance features. That would cost you $99.99 USD. I will give Aptana credit cause they do not cripple the free version like some others do. This app will run in Mac, Linux, and Windows. In the next day or two I am planning on making a tutorial on this app to give you a tour of it.