Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-12-18 21:50:15 +08:00
commit 1dfc26d5f4
7 changed files with 232 additions and 241 deletions

View File

@ -1,18 +1,20 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12930-1.html)
[#]: subject: (Experience the useful features of the Xedit text editor)
[#]: via: (https://opensource.com/article/20/12/xedit)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
体验 Xedit 文本编辑器的实用功能
======
Xedit 是 X11 图形服务器的一部分,它没什么好看的,但却有足够的隐藏功能,使它成为一个严肃的文本编辑器。
![Computer screen with files or windows open][1]
X11 图形服务器由 [X.org][2] 发布,它有一些象征性的应用来展示如何使用它提供的工具进行编程。这些应用包括 [TWM][3] 桌面到愚蠢但催眠的 Xeyes。它还包括一个名为 Xedit 的文本编辑器,它是一个看似简单的应用,却有足够的隐藏功能,使其成为一个严肃的编辑器。
> Xedit 是 X11 图形服务器的一部分,它不算好看,但却有足够的隐藏功能,使它成为一个严肃的文本编辑器。
![](https://img.linux.net.cn/data/attachment/album/202012/18/075942uzhgjgxfxve7p2ot.jpg)
X11 图形服务器由 [X.org][2] 发布,它有一些象征性的应用来展示如何使用它提供的工具进行编程。这些应用包括从 [TWM][3] 桌面到愚蠢但催眠的 Xeyes。它还包括一个名为 Xedit 的文本编辑器,它是一个看似简单的应用,却有足够的隐藏功能,使其成为一个严肃的编辑器。
### 安装 Xedit
@ -22,77 +24,67 @@ X11 图形服务器由 [X.org][2] 发布,它有一些象征性的应用来展
### 启动 Xedit
如果它被列出的话,你可以从你的应用菜单中启动 Xedit。有些发行版将它视为命令而不是 GUI 应用,尽管它绝对是一个 GUI 应用,所以它可能不会被列在应用菜单中。这时,你可以从终端启动 Xedit。如果你输入 `xedit &` 来启动应用,它就会启动一个空的 Xedit 编辑器可以随时输入。如果你在输入启动命令的同时输入一个现有的文件名Xedit 启动时会将文件加载到缓冲区。
如果它被列在你的应用菜单的话,你可以从中启动 Xedit。尽管它绝对是一个 GUI 应用,但有些发行版将它视为命令而不是 GUI 应用,所以它可能不会被列在应用菜单中。这时,你可以从终端启动 Xedit。如果你输入 `xedit &` 来启动应用,它就会启动一个空的 Xedit 编辑器可以随时输入。如果你在输入启动命令的同时输入一个现有的文件名Xedit 启动时会将文件加载到缓冲区。
```
`$ xedit example.txt &`
$ xedit example.txt &
```
![Xedit][5]
(Seth Kenlon, [CC BY-SA 4.0][6])
### 加载文件
在打开的 Xedit 实例中,你可以在顶部文本输入框中输入文件的路径来加载文件。点击 **Load** 按钮(在文本输入框的左边),将文件读入 Xedit 窗口。
![Load Xedit][7]
(Seth Kenlon, [CC BY-SA 4.0][6])
你可以同时打开多个文件。当一个文件被加载时,它将获取焦点并出现在你的主 Xedit 缓冲区(主窗口中的大文本输入框),并将任何现有的文件切换到一个隐藏的缓冲区。
你可以使用组合键在缓冲区之间切换,这对 Emacs 用户而言很熟悉,但对其他用户会感到困惑。首先,按下 **Ctrl+X**。放开然后按 **Ctrl+B**
你可以使用组合键在缓冲区之间切换,这对 Emacs 用户而言很熟悉,但对其他用户会感到困惑。首先,按下 `Ctrl+X`。放开然后按 `Ctrl+B`
### 组合键
一开始执行需要连续_两_个键盘快捷键的操作感觉很奇怪,但过了一段时间,你就会习惯。事实上,作为一个经常使用 Emacs 的用户,我发现复合键组合很有节奏感。我很惊讶也很高兴地发现,我最喜欢的一些快捷键在 Xedit 中也有效。
一开始执行需要连续*两*个键盘快捷键的操作感觉很奇怪,但过了一段时间,你就会习惯。事实上,作为一个经常使用 Emacs 的用户,我发现复合键组合很有节奏感。我很惊讶也很高兴地发现,我最喜欢的一些快捷键在 Xedit 中也有效。
原来Xedit 从几个灵感源借用了键盘快捷键。如果你是 Emacs 用户,你会发现最常见的组合在 Xedit 中有效。例如,**C-x** **C-f** (即 **Ctrl+X** 后是 **Ctrl+F**)可以回到顶部的文本输入框来加载文件,而 **C-x** **C-s** **Ctrl+X** 后是 **Ctrl+S**)可以保存文件。令人惊讶的是,**C-x** **3** 甚至可以垂直分割窗口,而**C-x** **2** 则可以水平分割,**C-x** **0** 或 **1**则可以移除分割。
原来Xedit 从几个灵感源借用了键盘快捷键。如果你是 Emacs 用户,你会发现最常见的组合在 Xedit 中有效。例如,`C-x C-f` (即 `Ctrl+X` 后是 `Ctrl+F`)可以回到顶部的文本输入框来加载文件,而 `C-x C-s``Ctrl+X` 后是 `Ctrl+S`)可以保存文件。令人惊讶的是,`C-x 3` 甚至可以垂直分割窗口,而 `C-x 2` 则可以水平分割,`C-x 0` 或 `C-x 1` 则可以移除分割。
Emacs 或 Bash 用户熟悉的编辑命令也适用:
* **Ctrl+A** 移动到行首。
* **Ctrl+E** 移至行尾。
* **Alt+B** 向后移动一个单词。
* **Ctrl+B** 向后移动一个字符。
* **Ctrl+F** 向前移动一个字符。
* **Alt+F** 向前移动一个单词。
* **Ctrl+D** 删除下一个字符。
* `Ctrl+A` 移动到行首。
* `Ctrl+E` 移至行尾。
* `Alt+B` 向后移动一个单词。
* `Ctrl+B` 向后移动一个字符。
* `Ctrl+F` 向前移动一个字符。
* `Alt+F` 向前移动一个单词。
* `Ctrl+D 删除下一个字符。
还有更多,它们都在 Xedit 手册页面上列出。
### 使用行编辑模式
Xedit 还含有一个类似 **ex** 的行编辑器,这对 [Vi][8] 和 `ed` 甚至 `sed` 用户应该很熟悉。要进入行编辑模式,按下 **Esc** 键。这将使你处于顶部的文本输入框,但处于命令模式。编辑命令使用的语法是:_行号_后面跟着一个_命令_和_参数_
Xedit 还含有一个类似 `ex` 的行编辑器,这对 [Vi][8] 和 `ed` 甚至 `sed` 用户应该很熟悉。要进入行编辑模式,按下 `Esc` 键。这将使你处于顶部的文本输入框,但处于命令模式。编辑命令使用的语法是:*行号*后面跟着一个*命令*和*参数*
比如说你有这个文本文件:
```
ed is the standard Unix text editor.
This is line number two.
```
你决定将第 1 行的 `ed` 改为 `Xedit`。在 Xedit 中,移动到第 1 行,按下 **Esc**,然后输入 `.,s/ed/Xedit/`
你决定将第 1 行的 `ed` 改为 `Xedit`。在 Xedit 中,移动到第 1 行,按下 `Esc`,然后输入 `.,s/ed/Xedit/`
```
Xedit is the standard Unix text editor.
This is line number two.
```
不用将光标移到下一行,你可以将 `two` 改为 `the second`。按下 **Esc**,然后输入 `2,s/two/the second/`
不用将光标移到下一行,你可以将 `two` 改为 `the second`。按下 `Esc`,然后输入 `2,s/two/the second/`
可能的命令和有效的参数在 Xedit 的手册页中列出。
各种命令和有效的参数在 Xedit 的手册页中列出。
### 简单但稳定
Xedit 并没有什么好看的,它很简单,没有菜单可言,但它借鉴了一些最好的 Unix 编辑器的流行的便利性。下次你在寻找新的编辑器时,不妨试试 Xedit。
Xedit 并不算好看,它很简单,没有菜单可言,但它借鉴了一些最好的 Unix 编辑器的流行的便利性。下次你在寻找新的编辑器时,不妨试试 Xedit。
--------------------------------------------------------------------------------
@ -101,7 +93,7 @@ via: https://opensource.com/article/20/12/xedit
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,138 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions [Beginners Tip])
[#]: via: (https://itsfoss.com/run-c-program-linux/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions [Beginners Tip]
======
How do you program in C on Linux? It is indeed very easy and consists of three simple steps.
**Step 1**: You write your program and save the file with a .c extension. For example, my_program.c.
**Step 2**: You compile the program and generate the object file using gcc compiler in a terminal like this:
```
gcc -o my_program my_program.c
```
**Step 3**: You run the generated object file to run your C program in Linux:
```
./my_program
```
![][1]
This was just the quick summary on how to compile and run C program in Linux. If you are new to either C or Linux, Ill show these steps in detail so that you feel comfortable coding C program in Linux environment.
In fact, Ill discuss how to run C programs in Linux terminal as well as in code editor.
![][2]
### Method 1: How to run C programs in Linux terminal
In order to run a C program in Linux, you need to have a C compiler present on your systems. The most popular compiler is gcc ([GNU Compiler Collection][3]).
You can install gcc using your distributions package manager. In Debian and Ubuntu-based Linux distributions, use the apt command:
```
sudo apt install gcc
```
Switch to directory where you have kept your C program (or provide the path) and then generate the object file by compiling the program:
```
gcc -o my_program my_program.c
```
Keep in mind that it is optional to provide the output object file (-o my_program). If you wont do that, an object file named a.out will be automatically generated. But this is not good because it will be overwritten for each C program and you wont be able to know which program the a.out object file belongs to.
Once you have your object file generated, run it to run the C program. It is already executable. Simple use it like this:
```
./my_program
```
And it will display the desired output, if your program is correct. As you can see, this is not very different from [running C++ programs in Linux][4].
_**Every time you make a change in your program, you have to compile it first and then run the generated object file to run the C program.**_
### Method 2: How to run C programs in Linux using a code editor like Visual Studio Code
Not everyone is comfortable with command line and terminal and I totally understand that.
You can use a proper C/C++ IDE like Eclipse or Code Blocks but they are often too heavy programs and more suitable for large projects.
I recommend using an open source code editor like Visual Studio Code or Atom. These are basically text editors and you can install add-ons to compile and run programs directly from the graphical code editor.
I am using [Visual Studio Code editor][5] in this example. Its a hugely [popular open source code editor][6] from Microsoft.
First thing first, [install Visual Studio Code in Ubuntu][7] from the software center. For other distributions, please check your Linux distributions package manager or software center. You may also check the official website for more information.
Start Visual Studio Code and open/create a project and create your C program here. I am using a sample Hello World program.
![][8]
You must ensure that you have gcc compiler installed on your Linux system.
```
sudo apt install gcc
```
Next thing you would want is to use an extension that allows you to run the C code. Microsoft may prompt you for installing its own extension for C/C++ program but it is complicated to setup and hence I wont recommend it.
Instead, I suggest using the Code Runner extension. Its a no-nonsense extension and you can run C and C++ code easily without additional configuration.
Go to the Extensions tab and search for Code Runner and install it.
![Install Code Runner extension for running C/C++ program][9]
Restart Visual Studio Code. Now, you should be able to run the C code by using one of the following way:
* Using the shortcut Ctrl+Alt+N.
* Press F1 and then select or type Run Code.
* Right click the text editor and the click Run code from context menu.
![Right click the program file and choose Run Code][10]
When you run the program, it is compiled automatically and then run. You can see the output in terminal that is opened at the bottom of the editor. What could be better than this?
![Program output is displayed in the bottom section of the editor][11]
Which method do you prefer?
Running a few C programs in Linux command line is okay but using a code editor is much easier and saves time. Wont you agree?
I let you decide whichever method you want to use.
--------------------------------------------------------------------------------
via: https://itsfoss.com/run-c-program-linux/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-linux.png?resize=795%2C399&ssl=1
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/Run-C-Program-Linux.png?resize=800%2C450&ssl=1
[3]: https://gcc.gnu.org/
[4]: https://itsfoss.com/c-plus-plus-ubuntu/
[5]: https://code.visualstudio.com
[6]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
[7]: https://itsfoss.com/install-visual-studio-code-ubuntu/
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/c-program-visual-studio-code-linux.png?resize=800%2C441&ssl=1
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-in-linux-with-visual-studio-code.png?resize=800%2C500&ssl=1
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-in-linux-with-visual-studio-code.jpg?resize=800%2C500&ssl=1
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/run-c-program-in-linux-with-visual-studio-code.jpg?resize=800%2C500&ssl=1

View File

@ -1,67 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why Java developers love the jEdit text editor)
[#]: via: (https://opensource.com/article/20/12/jedit)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Why Java developers love the jEdit text editor
======
This editor packs the power of Java and offers plenty of plugins to
streamline your workflow.
![Person drinking a hot drink at the computer][1]
Java is a powerful language. Maybe because its often seen as an "industrial-strength" tool, you might not expect it to be the foundation of a text editor. After all, text editing is almost too easy for such power. In fact, in most modern programming toolkits, the component accepting text entry is a pre-programmed widget. Using a Java toolkit, a simple text editor can be written in about 100 lines of code. So what can [jEdit][2] possibly offer to justify its existence?
Well, quite a lot, actually! The jEdit application is a refreshing reminder of just how practical and useful Java can be for even everyday desktop apps. It deftly demonstrates the dynamism of its foundational technology, and ever true to Javas enduring promise, it does so on _all_ platforms.
### Installing jEdit
jEdit is written in Java, so its available for any platform. [Download it][3] in a generic installer or in a custom installer for the OS of choice. Once its downloaded (its small, so it wont take long), run the installer.
If you dont have Java installed, learn how to install Java on [Linux][4], [Mac, or Windows][5].
### Using jEdit
The way you edit text in jEdit is the same as editing text in any desktop text editor. If youve used one, youve basically used jEdit; all the common keyboard shortcuts and conventions apply. There are also some features commonly aimed at coders—line numbering, folding (in which sections of text are hidden so you can focus on other sections), and syntax highlighting.
But imagine, for a moment, text editors on a spectrum from [Vim simplicity][6] to [Emacs complexity][7], and youll find jEdit happily making its home alongside Emacs. While the editing component is typical of any desktop editing app, jEdits additional features include plugins, macros that you can record live during your editing session, features specific to certain editing modes, buffer options, and more. This is an editor that actively encourages you to make it your own.
There are three places you can go for jEdit customization: buffer options, global options, and the plugins manager.
Buffer options (in the Utilities menu) allow you to adjust settings associated with your current document. Usually, jEdit auto-detects the appropriate mode to use for what youre doing. For instance, writing XML triggers jEdits XML highlighting. Sometimes, though, you want to override what jEdit has detected or failed to detect. You can also turn on Explicit Folding mode, which allows you to manually define sections of text you want jEdit to treat as foldable sections.
Global options (in the Utilities menu) offer dozens of preferences that get treated as jEdits defaults. This can include anything from its appearance to custom shortcuts.
Plugins extend jEdit in ways its developers, literally, never intended. Plugins offer ways of working that just arent "normal" for jEdit, but that just might transform a laborious task into something easy or even fun. It practically transformed XML workflow with its excellent XML parsing, its _Outline_ plugin available for its dockable _Sidekick_ panel, and XSLT integration. If I were not already using Netbeans for Java code, I can imagine using jEdit instead.
### jEdit for programmers
Which text editor you choose depends on what you intend to do in your editor. This one calls itself the "programmers text editor," and I feel its a very strong contender for serious Java and XML work. However, it doesnt have quite the same feature set when editing Lua code and Bash scripts. Compared to something like Emacs, for instance, jEdits code folding is less flexible (I couldnt get it to fold a Lua function without additional markup). While it does have a rich plugin selection, I was unable to find anything particularly persuasive for work in AsciiDoc and other non-code formats.
The most appealing feature of jEdit, for me, is its foundation in Java. Because it runs in a JVM, you can be confident that you can use it regardless of your platform and possibly regardless of whether you have permission to install applications outside your own home directory. Java is a popular and active language, so jEdits features and plugins are well-maintained.
You should try jEdit if youre a fan of consistency, or a Java developer, or just an XML geek trying desperately to get out of oXygen. Its easy to get started, and its a lot of fun to explore.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/12/jedit
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hot drink at the computer)
[2]: http://jedit.org
[3]: http://www.jedit.org/index.php?page=download
[4]: https://opensource.com/article/19/11/install-java-linux
[5]: http://adoptopenjdk.org
[6]: https://opensource.com/article/20/12/vi-text-editor
[7]: https://opensource.com/article/20/12/emacs

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,138 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Write, Compile and Run a C Program in Ubuntu and Other Linux Distributions [Beginners Tip])
[#]: via: (https://itsfoss.com/run-c-program-linux/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
如何在 Ubuntu 和其它的 Linux 发行版中编写,编译和运行一个 C 程序 [Beginners Tip]
======
你是如何在 Linux 上使用 C 编写你的程序的?它确实是非常简单的,它由三个简单的步骤组成的。
**步骤 1**: 你编写你的程序,并使用一个 .c 的扩展名进行保存。例如my_program.c 。
**步骤 2**: 你在一个终端中使用 gcc 编译器来编译程序并生成目标文件,像这样:
```
gcc -o my_program my_program.c
```
**步骤 3**: 在 Linux 中,你以运行生成的对象文件的方式来运行你的 C 程序:
```
./my_program
```
![][1]
这只是如何在 Linux 中编译和运行 C 程序的简要总结。假设你是 C 语言或 Linux 系统的新手,我将仔细演示这些步骤,以便你能在 Linux 环境中舒服地编写 C 程序。
事实上,我将讨论如何在 Linux 终端中以及在代码编辑器中运行 C 程序。
![][2]
### 方法 1: 在 Linux 终端中运行 C 程序
为了在 Linux 中运行一个 C 程序,你需要在你的系统上有一个 C 编译器。最流行的编译器是 gcc [GNU 编译器套件][3])。
你可以使用你发行版的软件包管理器来安装 gcc 。在基于 Debian 和 Ubuntu 的 Linux 发行版中,使用 apt 命令:
```
sudo apt install gcc
```
切换到你保存你的 C 程序的目录(或者提供路径),然后通过编译程序生成对象文件:
```
gcc -o my_program my_program.c
```
记住,提供输出对象文件(-o my_program是可选的。如果你不提供那么将自动生成一个名称 a.out 的对象文件。但是这样并不好,因为它将会覆盖每一个已生成的 C 程序,而且你也不知道这个 a.out 对象文件究竟属于哪个程序。
在你的对象文件生成后,运行它来运行 C 程序。它已经能够可执行了。像这样简单地使用它:
```
./my_program
```
接下来,如果你的程序是正确的,它将显示出你所期望的输出。正如你所能够看到的,[在 Linux 中运行 C++程序][4] 并不是很难。
_**每更改一次你的程序,你都被必须先重新编译它,然后再次运行生成的对象文件来运行这个新的 C 程序。**_
### 方法 2: 如何在 Linux 中使用一个诸如 Visual Studio Code 之类的代码编辑器来运行 C 程序
并不是每一个人都能适应命令行和终端,我完全理解这一点。
你可以使用一个诸如 Eclipse 或 Code Blocks 之类的真正的 C/C++ IDE ,但是它们是很重量级的程序,通常更适合于大型的工程。
我建议使用一个开放源码的代码编辑器,像 Visual Studio Code 或 Atom 。总体来说它们是文本编辑器,但是你可以通过安装附加组件来直接在图形化代码编辑器中编译和运行程序。
在这个示例中,我使用 [Visual Studio Code ][5] 编辑器。它是来自微软的一个非常 [流行的开放源码的代码编辑器][6] 。
首先,在 Ubuntu 的 [软件中心中安装 Visual Studio Code ][7] 。对于其它发行版来说,请检查你的 Linux 发行版的软件包管理器或软件中心。你可以检查它的官方网站来查看更多的信息。
启动 Visual Studio Code ,打开/创建一个工程,接下来创建你的 C 程序。我使用一个简单的 Hello World 程序作为示例。
![][8]
你必须确保你已经在你的 Linux 系统上安装了 gcc 编译器。
```
sudo apt install gcc
```
接下来你想做事是使用一个允许你运行 C 代码的扩展。微软可能会提示你安装它自己的 C/C++ 程序扩展,但是安装是很复杂的,因此我不建议你使用它。
作为替换,我建议你使用 Code Runner 扩展。它是一个简单直接的扩展,你可以在不使用额外配置的情况下轻松地运行 C 和 C++ 代码。
转到扩展标签页,在其中搜索和安装 Code Runner
![安装 Code Runner 扩展来运行 C/C++ 程序][9]
重新启动 Visual Studio Code 。现在,你能够使用下面方法中的其中一个来运行 C 代码:
* 使用快捷键 Ctrl+Alt+N 。
* 按下 F1 ,接下来选择或输入 Run Code 。
* 在文本编辑器中右键单击,从上下文菜单中单击 Run code 。
![右键单击程序文件,然后选择 Run Code][10]
当你运行这个 C 程序时,它将会被自动编译和运行。你可以在编辑器底部打开的终端中看到输出。还有比这更好的吗?
![程序输出显示在编辑器的底部][11]
你更喜欢哪一种方法?
在 Linux 命令行中运行一些 C 程序是没有问题的,但是使用一个代码编辑器会更容易一些,而且会节省时间。你不同意吗?
我让你来决定你想使用哪一种方法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/run-c-program-linux/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-linux.png?resize=795%2C399&ssl=1
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/Run-C-Program-Linux.png?resize=800%2C450&ssl=1
[3]: https://gcc.gnu.org/
[4]: https://itsfoss.com/c-plus-plus-ubuntu/
[5]: https://code.visualstudio.com
[6]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
[7]: https://itsfoss.com/install-visual-studio-code-ubuntu/
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/c-program-visual-studio-code-linux.png?resize=800%2C441&ssl=1
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-in-linux-with-visual-studio-code.png?resize=800%2C500&ssl=1
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/running-c-program-in-linux-with-visual-studio-code.jpg?resize=800%2C500&ssl=1
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/run-c-program-in-linux-with-visual-studio-code.jpg?resize=800%2C500&ssl=1

View File

@ -0,0 +1,66 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why Java developers love the jEdit text editor)
[#]: via: (https://opensource.com/article/20/12/jedit)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
为什么 Java 开发者喜欢 jEdit 文本编辑器
======
这款编辑器打包了 Java 的功能,并提供了大量的插件来简化你的工作流程。
![Person drinking a hot drink at the computer][1]
Java 是一门强大的语言。也许因为它经常被看作是一种“工业级”的工具,你可能不会想到它会成为文本编辑器的基础。毕竟,对于如此能力,文本编辑几乎是太容易了。事实上,在大多数现代编程工具包中,接受文本输入的组件是一个预编程的小部件。使用 Java 工具箱,一个简单的文本编辑器可以在 100 行左右的代码中编写出来。那么 [jEdit][2] 能提供什么来证明它的存在呢?
实际上它有很多功能jEdit 应用是一个令人耳目一新的提醒,提醒人们 Java 对于日常桌面应用是多么的实用和有用。它巧妙地展示了它的基础技术的活力,并且永远忠于 Java 的持久承诺在_所有_的平台上都能使用。
### 安装 jEdit
jEdit 是用 Java 编写的,所以它适用于任何平台。[下载][3]通用安装程序或为所选的操作系统下载自定义安装程序。下载完成后(它很小,因此不会花费很长时间),请运行安装程序。
如果你没有安装 Java请学习如何在 [Linux][4]、[Mac 或 Windows][5] 上安装 Java。
### 使用 jEdit
在 jEdit 中编辑文本的方式和在任何桌面文本编辑器中编辑文本的方式是一样的。如果你使用过一个编辑器,那么你基本上已经使用了 jEdit。所有常用的键盘快捷键和惯例都适用。也有一些通常针对编码者的功能如行号、折叠文本的部分被隐藏这样你就可以把注意力放在其他部分和语法高亮。
但是,想象一下,从 [Vim 的简单性][6]到 [Emacs 的复杂性][7]的文本编辑器,你会发现 jEdit 与 Emacs 类似。虽然编辑组件和任何典型桌面编辑应用一样,但 jEdit 的附加功能包括插件、可以在编辑会话中实时录制的宏、特定编辑模式的功能、缓冲区选项等。这是一个积极鼓励你把它变成你自己的编辑器。
你可以在三个地方对 jEdit 进行自定义:缓冲区选项、全局选项和插件管理器。
缓冲区选项(在 “Utilities” 菜单中使你可以调整与当前文档关联的设置。通常jEdit 会自动检测用于你正在执行的操作的适当模式。例如,编写 XML 会触发 jEdit 的 XML 高亮显示。但是,有时你想覆盖 jEdit 已检测到或未能检测到的内容。你还可以打开“显式折叠”模式,该模式允许你手动定义希望 jEdit 视为可折叠部分的文本。
全局选项(在 “Utilities” 菜单中)提供了数十种首选项,这些首选项被视为 jEdit 的默认值。这包括从外观到自定义快捷方式的所有内容。
插件扩展了 jEdit 的功能,实际上,它的开发者从未想过要这样。插件提供的工作方式对 jEdit 而言并非“正常”,但可能会将繁琐的任务转变为简单甚至有趣的事情。它以其出色的 XML 解析、可停靠 _Sidekick_ 面板中的 _Outline_ 插件和 XSLT 集成,实际上改变了 XML 工作流程。如果我还没有使用 Netbeans 来编写 Java 代码,我可以想象使用 jEdit 来代替。
### 面向程序员的 jEdit
选择哪种文本编辑器取决于你打算在编辑器中做的事。它称自己为“程序员的文本编辑器”,并且我认为它是认真的 Java 和 XML 工作的有力竞争者。但是,在编辑 Lua 代码和 Bash 脚本时,它的功能不尽相同。例如,与 Emacs 之类相比jEdit 的代码折叠不那么灵活(我无法在没有附加标记的情况下折叠 Lua 函数)。尽管确实有丰富的插件选择,但我找不到能在 AsciiDoc 和其他非代码格式下工作的特别有说服力的东西。
对我来说jEdit 最吸引人的特点是它是以 Java 为基础。因为它在 JVM 中运行所以你可以有信心可以使用它而无论你使用的平台是什么也可以不管你是否有权限在自己的主目录之外安装应用。Java 是一种流行且活跃的语言,因此 jEdit 的功能和插件维护得很好。
如果你是一贯的忠实拥护者、Java 开发人员,或者只是 XML 极客而拼命试图摆脱 oXygen那么你应该试试 jEdit。它很容易上手并且探索起来很有趣。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/12/jedit
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hot drink at the computer)
[2]: http://jedit.org
[3]: http://www.jedit.org/index.php?page=download
[4]: https://opensource.com/article/19/11/install-java-linux
[5]: http://adoptopenjdk.org
[6]: https://opensource.com/article/20/12/vi-text-editor
[7]: https://opensource.com/article/20/12/emacs