You are not logged in.
Hi all,
I am trying to enable terminal vim as my default text editor, and have arch associate text files with vim, and open them in a terminal window (I'm using Termite) when the files are opened.
I have succeeded in having arch launch vim after opening a text file.
I did this by creating a vim.desktop file in ~/.local/share/applications and then setting: export EDITOR=vim export VISUAL=vim. And finally I associated vim.desktop with plain text using xdg-mime default vim.desktop text/plain.
But the problem is that now, when I double click on a plain text file, vim opens, but at its initial screen; the contents of the file are no-where to be seen.
Is there something I'm missing here?
Here's the contents of my vim.desktop file.
[Desktop Entry]
Name=Vim Text Editor
Comment=Edit text files
Exec=vim
Terminal=true
Type=Application
Icon=terminal
Categories=Utility;TextEditor;
StartupNotify=true
MimeType=text/plain;
Thanks!
Last edited by maxemillian (2017-06-02 01:05:36)
Offline
Your desktop file tells vim to open, but doesn't tell it what file to open.
Try
Exec=vim %f
or
Exec=vim %u
Last edited by 2ManyDogs (2017-06-02 01:15:15)
Offline
Neither of those have had any effect after editing the file then rebooting.
Is there another command I need to enter to commit have those edits into the system?
Or perhaps something else I can do?
Here's my vim.desktop file as it now stands:
[Desktop Entry]
Name=Vim Text Editor
Comment=Edit text files
Exec=vim %f
Terminal=true
Type=Application
Icon=terminal
Categories=Utility;TextEditor;
StartupNotify=true
MimeType=text/plain;
Thanks again
Offline
Does the one that ships with Vim not work? https://github.com/vim/vim/blob/master/ … im.desktop
Offline
No that didn't work either.
I feel like there's something I've done wrong that's probably a very simple fix, but I have no idea what it is.
Anything else I should look into?
thanks a lot
Offline
Do I need to be re-entering any commands after editing the vim.desktop file? Or is a logout/reboot sufficient for the system to pick up on the changes?
Thanks,
Offline
Have you change vim colorscheme or your terminal theme recently??
Arch is home!
https://github.com/Docbroke
Offline
I have installed some vim colorschemes. I don't have any termite themes.
here is a paste of my .vimrc, is there anything which stands out to you?
set nocompatible " be iMproved, required
filetype off " required
filetype plugin indent on
syntax on
"BASIC SETTINGS
set encoding=utf-8
set nu
"set spell spelllang=en_gb
set nocompatible " be iMproved, required
filetype off " required
set tabstop=4
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
"MY PLUGINS
Plugin 'VundleVim/Vundle.vim'
Plugin 'junegunn/goyo.vim'
Plugin 'jakykong/vim-zim'
Plugin 'reedes/vim-pencil'
"Plugin 'joanrivera/vim-zimwiki-syntax'
"COLORSCHEMES
Plugin 'robertmeta/nofrils'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
"Plugin 'tpope/vim-fugitive'
" plugin from [url]http://vim-scripts.org/vim/scripts.html[/url]
" Plugin 'L9'
" Git plugin not hosted on GitHub
"Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
"Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
"Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
Last edited by maxemillian (2017-06-02 02:36:49)
Offline
Please use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Co … s_and_code
Offline
Oops, sorry!
Offline
Does the
TryExec=vim
command need to be there?
Offline
You can help yourself here: https://specifications.freedesktop.org/ … nized-keys
Offline
You may try starting vim without reading .vimrc with
vim -u NONE
, if this works it will confirm that problem is with .vimrc.
I don't use vundle or those plugins, so I am not sure what may be wrong there.
Arch is home!
https://github.com/Docbroke
Offline
Open a file and run
ps -Ao comm,args | grep vim
What's the output?
"vim %u" will btw. likely not work.
Offline
I had the same issue and in my case the problem was that my terminal wasn't supported by gtk-launch (i.e. not in the hard-coded list of terminals), prompting me to implement solution 2 from here to fix this. After that I was in the same state as OP.
The problem: That solution doesn't pass any additional arguments given to gtk-launch (such as the filename) onto vim, explaining everything that was happening. In my case I fixed it by changing $1 in the script from the above link to "$@", to pass all arguments.
Last edited by hejas (2024-10-26 19:04:14)
Offline