LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-11-2016, 11:37 AM   #16
Fat_Elvis
Member
 
Registered: Oct 2016
Distribution: FreeDOS 1.2
Posts: 309

Rep: Reputation: 92

Quote:
Originally Posted by c0wb0y View Post
Well, you can actually. Hit 'v' and see.
Haha, awesome.
 
Old 12-11-2016, 06:39 PM   #17
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,148
Blog Entries: 4

Rep: Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232
The best text editor I ever used was a 300-baud Teletype machine with a paper-tape reader.

(And, yes, koff koff... I actually used one. Once.)

DECWriters were so much nicer.
 
Old 12-11-2016, 09:54 PM   #18
crazy-yiuf
Member
 
Registered: Nov 2015
Distribution: Debian Sid
Posts: 119

Rep: Reputation: 51
Well, someone has to represent emacs.

Just like others in the thread, I learned it first and it would be quite a bit of brain re-wiring to switch to vi. I like lisp and I frequently want to add formatting rules or commands. For example, if I press f5 twice it inserts:
cout << "debug point 0" << endl;
cout << "debug point 1" << endl;

I don't know if you can do that sort of thing in the vi family. I use the nox version with some basic mouse support and xsel stuff enabled.

I also keep a collection of sed commands handy for refactoring, and I basically have an IDE where I don't have to constantly move from file to file and expand classes, etc., to get to the code I want.
 
Old 12-12-2016, 09:24 AM   #19
Fat_Elvis
Member
 
Registered: Oct 2016
Distribution: FreeDOS 1.2
Posts: 309

Rep: Reputation: 92
Quote:
Originally Posted by crazy-yiuf View Post
Well, someone has to represent emacs.

Just like others in the thread, I learned it first and it would be quite a bit of brain re-wiring to switch to vi. I like lisp and I frequently want to add formatting rules or commands. For example, if I press f5 twice it inserts:
cout << "debug point 0" << endl;
cout << "debug point 1" << endl;

I don't know if you can do that sort of thing in the vi family. I use the nox version with some basic mouse support and xsel stuff enabled.

I also keep a collection of sed commands handy for refactoring, and I basically have an IDE where I don't have to constantly move from file to file and expand classes, etc., to get to the code I want.
I've actually just decided to learn emacs on a lark. Coming from years of vim, lol. How foolish an idea is this?

Any tips for an absolute beginner to emacs?
 
Old 12-12-2016, 12:21 PM   #20
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 417

Rep: Reputation: 74
I'm not a vim expert. But if that line is stored on register 'a' for example, you can:
Code:
"ap
or key-rebinding which I cant be bothered.
 
Old 12-12-2016, 02:25 PM   #21
Fat_Elvis
Member
 
Registered: Oct 2016
Distribution: FreeDOS 1.2
Posts: 309

Rep: Reputation: 92
With automatic numbering, I don't know. Might be able to vimscript it, but I haven't yet taken the time to learn that either.
 
Old 12-12-2016, 08:19 PM   #22
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 17,412
Blog Entries: 28

Rep: Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409Reputation: 5409
Quote:
Well, you can actually. Hit 'v' and see.
Cool! Am I correct in thinking that that's a vi window that opens?
 
Old 12-12-2016, 08:41 PM   #23
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 417

Rep: Reputation: 74
In Debian, it depends on the value of $EDITOR. In other distros, it depends on the user's default editor.
 
Old 12-13-2016, 01:16 PM   #24
crazy-yiuf
Member
 
Registered: Nov 2015
Distribution: Debian Sid
Posts: 119

Rep: Reputation: 51
Quote:
Any tips for an absolute beginner to emacs?
You're in for a lot of googling Other than that, F10 toggles the menu on and off. It's one way to browse commands and find settings.

Here are some snippets from my .emacs file that might be useful:
Code:
;;make tabs work right
(electric-indent-mode 0)
(c-set-offset 'case-label '+)

;; debug insert
(global-set-key (kbd "<f5>") 'my-cpp-debug)
(setq debug-num-cpp 0) 
(defun my-cpp-debug ()
  (interactive)
  (insert "cout << \"Debug point " (number-to-string debug-num-cpp) "\" << endl << flush;" )
  (setq debug-num-cpp (+ debug-num-cpp 1)))

;; Put autosave files (ie #foo#) and backup files (ie foo~) in ~/.emacs.d/.
(custom-set-variables
 '(auto-save-file-name-transforms '((".*" "~/.emacs.d/autosaves/\\1" t)))
 '(backup-directory-alist '((".*" . "~/.emacs.d/backups/"))))

;; create the autosave dir if necessary, since emacs won't.
(make-directory "~/.emacs.d/autosaves/" t)

;; use Shift+arrow_keys to move cursor around split panes
(windmove-default-keybindings)

;;clipboard
(setq x-select-enable-clipboard t)
(unless window-system
  (when (getenv "DISPLAY")
    (defun xsel-cut-function (text &optional push)
      (with-temp-buffer
	(insert text)
	(call-process-region (point-min) (point-max) "xsel" nil 0 nil "--clipboard" "--input")))
    (defun xsel-paste-function()
      (let ((xsel-output (shell-command-to-string "xsel --clipboard --output")))
	(unless (string= (car kill-ring) xsel-output)
	  xsel-output )))
    (setq interprogram-cut-function 'xsel-cut-function)
    (setq interprogram-paste-function 'xsel-paste-function)
     ))

;; poor man's refactoring
(defun query-replace-in-open-buffers (arg1 arg2)
  "query-replace in open files"
  (interactive "sQuery Replace in open Buffers: \nsquery with: ")
  (mapcar
   (lambda (x)
     (find-file x)
     (save-excursion
       (beginning-of-buffer)
       (query-replace arg1 arg2)))
   (delq
    nil
    (mapcar
     (lambda (x)
       (buffer-file-name x))
     (buffer-list)))))
(put 'downcase-region 'disabled nil)
Note that this is largely cobbled together from stackoverflow answers. I can replace the code with links if the moderators think it's necessary.
 
Old 12-13-2016, 01:35 PM   #25
crazy-yiuf
Member
 
Registered: Nov 2015
Distribution: Debian Sid
Posts: 119

Rep: Reputation: 51
Also, some of the commands you'll probably use the most:
Code:
ctrl+x 0            Close all but one frame. That's a zero, not a capital o.
ctrl+x+f            Open file in new buffer
ctrl+x right arrow  Next buffer
ctrl+x left arrow   Last buffer
ctrl+x b            Type buffer (use tab to auto complete)
ctrl+s              Search forward for string
ctrl+r              Search backwards for string
ctrl+g              Quit whatever command you're doing
ctrl+w              Cut
alt+w               Copy
ctrl+y              Paste
ctrl+space          Start selecting (note that you can turn on basic mouse support, even in the nox version, to select that way)
 
1 members found this post helpful.
Old 12-16-2016, 09:29 AM   #26
jkirchner
Member
 
Registered: Apr 2007
Location: West Virginia
Posts: 859

Rep: Reputation: 246Reputation: 246Reputation: 246
Quote:
Originally Posted by Fat_Elvis View Post
I've actually just decided to learn emacs on a lark. Coming from years of vim, lol. How foolish an idea is this?

Any tips for an absolute beginner to emacs?
Great video tutorials on emacs here on youtube. I have been following along on them and have learned a good bit. It also has a great built in tutorial as well.

Here is a game to play to learn VIM VIM Adventures
 
Old 12-16-2016, 10:43 AM   #27
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by frankbell View Post
Cool! Am I correct in thinking that that's a vi window that opens?
options!
Code:
export EDITOR="vi"
 
Old 12-16-2016, 10:48 AM   #28
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,600

Rep: Reputation: 1944Reputation: 1944Reputation: 1944Reputation: 1944Reputation: 1944Reputation: 1944Reputation: 1944Reputation: 1944Reputation: 1944Reputation: 1944Reputation: 1944
Quote:
Originally Posted by Fat_Elvis View Post
I've actually just decided to learn emacs on a lark. Coming from years of vim, lol. How foolish an idea is this?

Any tips for an absolute beginner to emacs?
This could be interesting for you: From Vim to Emacs in Fourteen Days
 
Old 12-16-2016, 01:19 PM   #29
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 4,179

Rep: Reputation: Disabled
Stick with vi/vim as it is on (nearly) every system that runs Linux, BSD, or other unix.

Emacs is more like a mini desktop environment!
 
Old 12-16-2016, 09:20 PM   #30
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
I forgot about v.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] return text from geany or other editor to IDE after saving and closing the editor mtdew3q Programming 4 05-15-2013 10:40 PM
[SOLVED] vi / vim editor - how to display text file one line on one row ? masuch Linux - Newbie 3 08-06-2012 09:14 AM
LXer: Personalize and Optimize Vim editor using Packtís new Vim 7.2 book LXer Syndicated Linux News 0 05-20-2010 10:20 PM
Editor comparison: vim VS vim-lite, Cleaning vim Ruler2112 *BSD 4 04-13-2009 04:26 PM
Which light text editor can copy text from file and paste in browser? davidas Linux - Software 9 03-06-2006 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration