Gibberish

Posts tagged ‘windows’

Run VIM

I’m a fan of SublimeText and it suits well for my work (I code Python, MATLAB, LaTeX and sometime C++). People often tell me that if something works well for me, I shouldn’t change it. However, I’m a curious guy and VIM is recommended to me several times in … 10 years and I was too lazy to try it. So I write this blog post as a simple tutorial, a simple first step for myself. If it isn’t suit my work-flow, it’s still nice to know about this tool. I also hope this would be useful for other people who want to learn VIM from zero.

There is a joke from linux users about Windows user: “The easiest way to generate a random string is telling a Windows User type in VIM”. Starting as a Windows user, it’s funny that it was true for me the first time I used VIM (long time ago) and I don’t have time to use it again, until recently.

To install vim:

 sudo apt-get install vim 

How to create a text file with vim:

Open vim by opening the terminal and input:

vim

Then press Enter, what we should have is like this:

To go to inter mode, press i, to return to command mode (default), press Esc.

We can navigate through text in the command mode with directional buttons as H-J-K-L, equivalent to left-up-down-right.

Now as told earlier, press i to go to Insert mode (VIM will tell us with INSERT at bottom left corner). Insert whatever text you like.

Now, to save it, we need

w

command, press Esc to quit Insert mode, type

:w testtxt.txt

and press Enter.

As a result, VIM will create a testtxt.txt file, note that because I run the terminal in Home folder, then the saved file is located there.

[to be continued…]

 

Chạy python qua CMD

Trong window, để bật python và ipython thông qua cửa sổ cmd, cần phải sửa mục path của hệ thống trước, sau đó, vào trong CMD, có thể chạy python bằng lệnh tắt python và enter. Quá trình làm như sau:

1. Control panel –> system –> Advanced .. –> Environment …

2. Tại đây trong cửa sổ PATH, thêm path của python vào. Ví dụ trong trường hợp python 2.7 được cài trong thư mục C:\Python27\python.exe thì giá trị path cần thêm vào là C:\Python27, để phân biệt path này với các path có sẵn, chỉ cần nhét dấu chấm phẩy (;) giữa các path, sau đó save lại. Có thể cần phải khởi động lại để thay đổi có hiệu lực.

Để test tính năng này có thể vào cửa sổ RUN, gõ cmd, sau đó bấm python để kiểm tra.

Python 3 làm tương tự.

Tag Cloud