Hot answers tagged editors
There are many color schemes which are usually distributed together with vim. You can select them with the :color command. You can see the available color schemes in vim's colors folder, for example in my case: $ ls /usr/share/vim/vimNN/colors/ # where vimNN is vim version, e.g. vim74 blue.vim darkblue.vim default.vim delek.vim desert.vim elflord.vim ...
To change the default editor at the system level: sudo update-alternatives --config editor and then follow the onscreen prompts.
As you are using a dark background in your terminal, you simply need to set :set background=dark instead of the default :set background=light The colors are then automatically correctly set. If you want to have this permanently, add the line set background=dark to your $HOME/.vimrc file.
vim is a modal editor. Hit the ESC key to get into Normal (command) mode then type :q and press Enter. To quit without saving any changes, type :q! and press Enter. See also Getting out in Vim documentation.
vim can easily do that: ctrl+ws - Split windows ctrl+ww - switch between windows ctrl+wq - Quit a window ctrl+wv - Split windows vertically :sp filename will open filename in new buffer and split a window.
You can do that via scp like this: vim scp://user@myserver[:port]//path/to/file.txt Notice the two slashes // between server and path, which is needed to correctly resolve the absolute path. [:port]is optional. This is handled by vim's netrw.vim standard plugin. Several other protocols are supported.
You could do this by mounting the remote folder as a file-system using sshfs. To do this, first some pre-requisites: sudo apt-get install sshfs #for Debian based OS, use yum or zypper depending on your OS sudo adduser <username> fuse Now, do the mounting process: mkdir ~/remoteserv sshfs -o idmap=user <username>@<ipaddress>:/...
See edit-command-line in zshcontrib. bindkey -M vicmd v edit-command-line
A normal, "modeless" editor is like Notepad on Windows: there is only one mode, where you input text. Vi, and it's successor Vim, are modal: there are two primary modes1, insert mode where you type text into the editor and it is committed to the document, and normal mode where you enter arguments via the keyboard that perform a variety of functions, ...
I've had the most luck with this: :%!xmllint --format % It's strict about your tags, though, so it will error out if your opening and closing tags don't match. It also adds an XML declaration at the top of your file, if you don't have one as well. This page recommends the following, although I can't get it to work: :set filetype=xml :filetype indent on ...
You can do :100,200w filename Of course 100,200 is the range of lines you want to write.
This works (in the .vimrc file) for all files: autocmd BufWritePre * :%s/\s\+$//e This works for just ruby(.rb) files: autocmd BufWritePre *.rb :%s/\s\+$//e
In case you prefer Emacs keybindings: autoload -z edit-command-line zle -N edit-command-line bindkey "^X^E" edit-command-line
Cut 2 kilobytes from end of file: truncate -s-2K file
I use pdftk mainly. But here are some others to consider: pdfsam (PDF Split and Merge): "pdfsam is an open source tool (GPL license) designed to handle pdf files" PDFJam "A small collection of shell scripts which provide a simple interface to much of the functionality of the excellent pdfpages PDF file package (by Andreas Matthias) for pdfLaTeX." (You can ...
It's easier to learn than Vi, faster to start than Emacs, and more powerful than Pico/Nano (e.g. it has ctags support for programming). But it's unlikely to be installed everywhere, so you should still know the basics of Vi and Emacs.
To keep cursor position use something like: function! <SID>StripTrailingWhitespaces() let l = line(".") let c = col(".") %s/\s\+$//e call cursor(l, c) endfun else cursor would end up at beginning of line of last replace after save. Example: You have a space at end of line 122, you are on line 982 and enter :w. Not restoring position,...
You can do it manually with this command: :hi Comment guifg=#ABCDEF Where ABCDEF is an appropriate color hex code. To make it permanent, you will need to add these lines to your ~/.vimrc file (using green as an example): syntax on :highlight Comment ctermfg=green
You can use fc to edit the last command in history. It's not the same as editing the same command, but a quick hit on the Enter key makes your current command the last command in history.
The most general: Move cursor to first line of the group you want to write. Hit m and a sequentiall. That's "set mark named 'a'". Move cursor to last line of the group, hit 'm' and 'b'.' Change over to command mode hit: as a sequence do :'a,'b w filename then hit return. That will work in vi, nvi and vim. Another method, works in more modern vim: Put ...
This can be done using Emacs. It works in GUI and in terminal mode. You can even split multiple times. Here are some basic key combinations: C-x 2 Split the selected window into two windows, one above the other (split-window-below). C-x 3 Split the selected window into two windows, positioned side by side (split-window-right). C-Mouse-2 ...
From the command line, you could try paste -d '\0' file1 file2 > file3 That does exactly what you want. Visual Block mode in vim is also perfectly suited for this task. Are you sure you did it correctly? You should Go to visual block mode Select text and press y for yanking Go to the other file, on the upper left corner of the to be paste data (last ...
You can pick any editor you like by setting the $EDITOR variable before calling crontab -e e.g. $ EDITOR=emacs crontab -e will run emacs as your editor. If you have a favourite editor then you can select that. Many programs that call an external editor may also use this $EDITOR variable so you may find it useful to set it permanently in your .profile ...
Emacs/Vim/Eclipse/... - Personally I am an Emacs user. If you find the control sequences tire your pinky, just Viper-Mode it up. Emacs is so well integrated into unix, making it very easy to control everything all from one place. Vim also does a good job here, but I find Elisp to be a much more powerful extension language than Vim Script. One could talk ...
I know two programs for manipulating PDFs under Linux: PDEedit "Pdf Editor is primary created for simple editation and manipulation with objects of documents in PDF format and storing them as new version of document. Editation and manipulation with objets is by graphical and by commandline interface too. For simple use command line is using script language, ...
I love Geany It's a quick GUI editor that can manage small projects if necessary (it can remember list of files and a few other neat things). It supports many syntax highlighting including Shell scripting. It supports plug-ins, and I have used the VC (version control) plug-in once, but the basic features of Geany are enough for most of the work I do with ...
Menu Search->Replace (or Ctrl+h). Fill in find and replace boxes, expand Replace All, click In Session Step-by-step: Select "Replace" from Search menu. Expand "Replace All" Click "In Session"
With vim, you can use split or vsplit. The first one will split horizintally and the second one will split vertically. CTRLw then to navigate through split screens. You can also use tab. tabnew filename will open filename in a new tab. You can use tabnext and :tabprevious to navigate between tabs. I personnaly maps the left and right arrows to navigate ...
For editing/creating files from shell: Most linux distros come with nano which is quite friendly. Another alternative would be vi, but that's a little more complicated. For a '.bat' equivalent for sequencing commands: Depending on the shell you are using (most likely bash) you will need to write shell script, traditionally with a .sh extension (or with ...
For vim, you have powerful scripting available. For example, in my .vimrc, I have: " Stolen from http://www.debian-administration.org/articles/571 " Sets +x on stuff starting with the magic shebang. au BufWritePost * if getline(1) =~ "^#!" | silent !chmod a+x <afile> If you want to do it by filename only, instead of looking for the #! line, you ...
Only top voted, non community-wiki answers of a minimum length are eligible