1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

エディタ[nano]の設定なの!

Posted at

はじめに

Windowsでは「Atom」を使っていたが、raspberrypiでCUIエディタを使おうと思い、「nano」を選んだ。
初期設定ではプログラムを見やすくするインデントされない設定になっている。
名前がかわいいのでこのエディタを末永く愛し、使いこなすためにもプログラミングしやすい設定にする方法をメモする。

環境

raspbian 10.1

変更した設定

・自動インデント
プログラムを書く際、適切なインデントは必要。ディフォルトのままだと、メモ帳のように自動でインデントをつけてくれないので自動的にインデントがつくようにする。
・画面スクロールをスムーズに
デフォルトのままだと、3行ぐらい飛んで画面スクロールするので、(好みだと思うが)非常に見にくいので、一行下にスクロールするようにする。

設定方法

nanoの設定ファイルは\etcnanorcというファイルで設定する。
移動方法

pi@raspberrypi: ~ $ cd
pi@raspberrypi: ~ $ cd /etc
pi@raspberrypi: ~ $ sudo nano nanorc

nanorcは以下のようになっている。(2019/10/13現在)

# Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read!  Also note that this file should not be in
## DOS or Mac format, and that characters specially interpreted by the
## shell should not be escaped here.
(以下省略)

自動インデント
検索機能W+Ctrlを使ってautoindentと入力すると、以下のようなものが見つかる。

# set autoindent

#を削除することで自動インデントが有効になる。

スムーズな画面スクロール
検索機能W+Ctrlsmoothと入力すると以下のようなものが見つかる。

# set smooth

#を削除することでスムーズに画面スクロールするようになる。

保存方法
S+Ctrlで上書き保存、Z+Ctrlでnanoを終了。
もう一度nanoを開いて動作を確かめてください!動作が変わっているはずです!

さいごに

vimの方が一般的で様々な機能があるらしいが、いまのところnanoが使いやすいのでvimに移行するべき時がくるまで使っていきたい。

GNU nano公式サイト
https://www.nano-editor.org/docs.php

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?