แสดงบทความที่มีป้ายกำกับ Vi แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Vi แสดงบทความทั้งหมด

วันพฤหัสบดีที่ 13 ตุลาคม พ.ศ. 2554

Vi and Emac

Vi editor is the first edit I used in Unix when I was in the university. Even though it does not have an impressive user interface and not easy to use at the first time like the others but it is powerful and fast in searching text in a editing file. If you remember main keys of Vi, you can edit a file without using a mouse. It can open very hug file  , more than 100 MB or may be several GB that some editors cannot do. The other thing I like are that the command mode that enable you to move lines around file or replace text with a few efforts.

Present, I still use Vi for sometimes and learning to use another editor called Emac. I heard about this editor since I was in the university as well. My prof. told me that it is an elegant editor that most Unix developers use. It has many features that enable coding and editing more easy and productive. Not surprise, after learning it for a few days now I understand what my prof. means. With combination of control and character keys, it provide a lot of ways of editing experience; file and directory searching, multiple windows for editing, shell command running and buffer handling. Also, integrated with famous version control systems and diff tools. I just begin using and learning all basics and tips to get the most out of it.

วันอาทิตย์ที่ 18 กรกฎาคม พ.ศ. 2553

Keyboard Shortcuts สิ่งสำคัญที่เรามักจะลืม

Vi เป็น Text Editor ตัวแรกที่ผมใช้เขียนโปรแกรม เหตุผลที่ผมใช้ Vi ก็เพราะว่าตอนที่เรียนอยู่ในมหาวิทยาลัยปีแรกๆ อาจารย์อนุญาติให้เขียนโปรแกรมบนระบบปฎิบัติการ Linux เท่านั้น ซึ่ง Linux ที่ใช้ตอนนั้นก็เป็นเวอร์ชั่นที่มหาวิทยาลัยทำขึ้นเอง เป็นแบบ Console Mode

การใช้ Vi ผ่าน Console Mode จะต้องใช้คีย์บอร์ดในการสั่งงานทั้งหมด ไม่ว่าจะเป็นการเพิ่ม ลบ ตัวอักษร การค้นหา หรือ ไปยังบรรทัดที่ต้องการ ตอนเริ่มใช้งานใหม่ๆ อาจจะยากเพราะว่าจะต้องจำปุ่มที่ใช้สั่งงานในคีย์บอร์ด แต่เมื่อใช้งานไปสักระยะหนึ่งผมก็พบว่ามันสะดวกมาก ไม่ต้องยกมือจากคีย์บอร์ดก็สามารถที่จะเขียนโปรแกรมได้อย่างรวดเร็ว

หลังจากที่ย้ายมาเขียนโปรแกรมบน MS Windows มากขึ้น ก็ทำให้ติดการใช้เมาส์มากกว่าการสั่งงานทางคีย์บอร์ดไปโดยปริยาย แต่อันที่จริงแล้วถ้าเราลองใช้ ปุ่มลัด (Keyboard shortcuts) ในการสั่งงานดูก็จะพบว่ามันสะดวกและทำงานได้รวดเร็วกว่าการใช้เมาส์ ทำไมถึงเป็นเช่นนั้นละ ลองมาดูเหตุผลกัน

การใช้เมาส์เลื่อนไปยังเมนูต่างๆ นั้นกินเวลาระดับหนึ่งเมื่อเทียบกับการใช้ปุ่มลัด อีกทั้งทำให้เราต้องย้ายมือไปมาระหว่างคีย์บอร์ดและเมาส์ เราอาจจะมองว่ามันเป็นเวลาเพียงเล็กน้อยมาก แต่ถ้าเราลองนับจำนวนครั้งในแต่ละวันที่เราย้ายไปมาระหว่างคีย์บอร์ดและเมาส์ ก็จะพบว่ามันใช้เวลาพอสมควรเลยละ

ดังนั้นถ้าเราใช้งานคำสั่งใดบ่อยๆ เราก็ควรจะจำปุ่มลัดไว้หรือสร้างปุ่มลัดสำหรับคำสั่งนั้น Text Editor เกือบทุกตัวในปัจจุบันมีปุ่มลัดและสามารถที่จะสร้างปุ่มลัดได้ วันนี้ผมเอาปุ่มลัดที่ใช้กันบ่อยๆใน Eclipse มาแนะนำกัน
  • Ctrl + O ใช้เปิดกล่องค้นหา Member ของคลาสที่อยู่ในไฟล์ที่เรากำลังทำงานอยู่
  • Ctrl + Shift + T ใช้เปิดกล่องค้นหา Type ที่เราสนใจ
  • Ctrl + M ใช้ย่อขยายหน้าต่างที่กำลังทำงานอยู่
  • Ctrl + Space ใช้เปิดกล่องตัวช่วยเดาชื่อตัวแปร คลาส หรือ เมดทอด ขณะที่เราพิมพ์อยู่
  • Ctrl + Shift + F ใช้จัดซอร์สโค้ดให้อยู่ในรูปแบบที่เป็นมาตราฐาน
  • Ctrl + D ใช้ลบบรรทัดปัจจุบันที่เราทำงานอยู่
  • Ctrl + Left ใช้เลื่อนเคอเซอร์ไปทางด้านซ้ายที่ละหนึ่งคำ
  • Ctrl + Right ใช้เลื่อนเคอเซอร์ไปทางด้านขวาที่ละหนึ่งคำ