You are not logged in.
I have installed the nnn file manager and I am having some problems with it -
I Cannot edit files. Pressing "e" on the keyboard doesn't open the file in my default text editor which is "mousepad"
I Cannot edit empty files/text files. When I press e on my keyboard nothing happens
Here is my .bashrc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
neofetch
export NNN_BMS='d:~/Desktop;p:~/Pictures;D:~/Downloads/'
export NNN_SSHFS="sshfs -o follow_symlinks" # make sshfs follow symlinks on the remote
export NNN_COLORS="2136" # use a different color for each context
export NNN_TRASH=1 # trash (needs trash-cli) instead of delete
Any help would be appreciated.
Last edited by RounakDutta (2022-06-06 14:42:30)
Offline
Judging from this topic text files should open in 'vim'.
https://github.com/jarun/nnn/wiki/Usage#program-options
EDIT: If you want text files to be opened with 'mousepad' by default, you have to set your mimetypes accordingly (try and press 'Right' or 'o' in nnn...)
Last edited by dogknowsnx (2022-06-06 12:08:03)
Judging from this topic text files should open in 'vim'.
https://github.com/jarun/nnn/wiki/Usage#program-optionsEDIT: If you want text files to be opened with 'mousepad' by default, you have to set your mimetypes accordingly (try and press 'Right' or 'o' in nnn...)
I set mousepad as my default editor.
I also tried setting vim as my default editor
When I set vim as my default text editor and I try to open the text file by pressing enter it opens it in a browser and when I set mousepad as my default text editor and I try to open the text file by pressing enter it opens it in firefox again.
When I try to edit a file by pressing "e" nothing happens.
Last edited by RounakDutta (2022-06-06 14:16:06)
Offline
I set mousepad as my default editor.
how / where did you do this, there is no EDITOR setting in the shellrc file you posted. If EDITOR is not set, nnn defaults to 'vi', and if 'vi' is not installed, pressing 'e' will indeed do nothing.
Last edited by Trilby (2022-06-06 14:19:26)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
RounakDutta wrote:I set mousepad as my default editor.
how / where did you do this, there is no EDITOR setting in the shellrc file you posted.
I changed it now -
#
# ~/.bash_profile
#
if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
exec startx
fi
export EDITOR=vimand ran the
source .bash_profilecommand.
And for mousepad I remove the EDITOR=vim line from .bash_profile and source the file. Then I ran -
xdg-mime default vim.desktop text/plainLast edited by RounakDutta (2022-06-06 14:21:38)
Offline
Why set it to vim? Do you want to use vim or mousepad? Does nnn now open the file in vim when you press 'e'?
Note that putting it after the exec startx in your bash_profile is almost completely useless - it will not be applied in most situations that you would want it applied. (It will in your currently running shell after your source'd .bash_profile, but it will not be anywhere else other than other ttys).
xdg-mime is irrelevant. Set EDITOR to the editor you want to use. That's it. (edit: though if it was relevant, setting the default mime handler for text files to vim.desktop would certainly not result in mousepad being used!)
Last edited by Trilby (2022-06-06 14:23:26)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Why set it to vim? Do you want to use vim or mousepad? Does nnn now open the file in vim when you press 'e'?
Nope pressing "e" does nothing. I cannot open any files when I press "e"
When I press enter the file open inside a browser instead of vim.
Note that putting it after the exec startx in your bash_profile is almost completely useless - it will not be applied in most situations that you would want it applied. (It will in your currently running shell after your source'd .bash_profile, but it will not be anywhere else other than other ttys).
Oh! From now on I will put my environment variables in bashrc then.
EDIT: I just restarted my pc and now nnn works!! It opens it vim. Thanks a lot @Trilby and @dogknowsnx for helping me on this. Marking the post as [SOLVED]
@dogknowsnx Thanks for giving me the mimetype link. I didn't knew that mimetype only sets default apps for GUI applications and for CLI apps like vim we have to use environment variables.
Last edited by RounakDutta (2022-06-06 14:46:12)
Offline
@RounakDutta I wouldn't recommend exporting a GUI editor... Please do some more reading: man nnn.
There are different ways/keybindings for opening files, e.g. 'e' for 'edit', 'l' and 'Right' for opening files with default applications...
EDIT: I just read your last post and saw that you exported 'vim'...
EDIT#2: Thank @Trilby, @Slithery didn't participate...
Last edited by dogknowsnx (2022-06-06 14:42:58)
EDIT#2: Thank @Trilby, @Slithery didn't participate...
Lol sorry. I made a mistake.
Offline
I didn't knew that mimetype only sets default apps for GUI applications and for CLI apps like vim we have to use environment variables.
Technically you can export every app, GUI apps just won't work outside a graphical environment, obviously...
I agree, setting EDITOR to a gui editor like 'mousepad' is not generally ideal*. However, the potential downsides are minimized if you are pretty much exclusively using your system from within an X11 session and you are not shelling into remote systems or using the tty much. But setting EDITOR is the only bit relevant to changing the 'e' key binding. Using other keys (like return) will most likely use mime-types, and for those options xdg-mime settings would likely be relevant.
*note: if I'm being completely honest, I'd not find using a gui editor like mousepad in any contenxt to be ideal! Learn vim! I'm (mostly) joking; of all the gui text-editors I've found mousepad to be one of the most tolerable - but once I learned vim, I never wanted to ever use any gui editor again.
Last edited by Trilby (2022-06-06 15:21:46)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I agree, setting EDITOR to a gui editor like 'mousepad' is not generally ideal*. However, the potential downsides are minimized if you are pretty much exclusively using your system from within an X11 session and you are not shelling into remote systems or using the tty much. But setting EDITOR is the only bit relevant to changing the 'e' key binding. Using other keys (like return) will most likely use mime-types, and for those options xdg-mime settings would likely be relevant.
*note: if I'm being completely honest, I'd not find using a gui editor like mousepad in any contenxt to be ideal! Learn vim! I'm (mostly) joking; of all the gui text-editors I've found mousepad to be one of the most tolerable - but once I learned vim, I never wanted to ever use any gui editor again.
Umm... I already use vim and emacs. I also learned how to use vim and emacs. The vim tutorials made by distrotube is the best if you want to learn about vim.
Btw as a gui text editor I use Mousepad and geany. I like both. Geany has more features. Sometimes I need graphical IDE/text editor for programming because customizing vim (adding themes and stuff) is so hard and there is no guide on how to customize your vimrc
. Geany is easier to use thats why I use geany
![]()
Last edited by RounakDutta (2022-06-06 17:20:52)
Offline
The vim tutorials made by distrotube is the best ... customizing vim (adding themes and stuff) is so hard and there is no guide on how to customize your vimrc
You don't see a contradiction here?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline