LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-21-2016, 06:12 PM   #1
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 699
Blog Entries: 1

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
vim on 14.2 issue with man files + workaround


In Slackware 14.2, I was having an issue with editing text files named *.man. When in command mode, if I pressed the letter 'q' vim would exit.

I located the issue in file
Quote:
/usr/share/vim/vim74/ftplugin/man.vim
If I comment out this line
Quote:
nnoremap <buffer> <silent> q :q<CR>
the issue is solved and I can use the letter 'q' to create on-the-fly macros in *.man files.

Anyway I do not know what that line is suppose to do, but posted the 'issue' here in case other people have this problem.

John
 
Old 12-21-2016, 10:11 PM   #2
glorsplitz
Senior Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 1,310

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
Maybe ask "Maintainer: SungHyun Nam" at the top of that file and point out your work around?
 
Old 12-22-2016, 06:13 PM   #3
ljb643
Member
 
Registered: Nov 2003
Posts: 526

Rep: Reputation: Disabled
It was added deliberately in November 2015 to vim-7.4 (between the Slackware-14.1 version and the Slackware-14.2 version), and is documented in the help for "filetype": "q same as :quit". So it isn't a bug. I'm not really sure what the reason is, because I'm not sure what filetype man is for. If it is meant for viewing manual pages, then mapping q to quit makes a lot of sense because that's how the 'less' pager for the 'man' command works too - quits when you press q. But when I tried to view a man page in vim (:runtime ftplugin/man.vim, then Man ls) it doesn't trigger those mappings. So I'm missing something. Sounds like you are using man mode for something else, though, which is why 'q' is interfering.
 
Old 12-23-2016, 03:00 PM   #4
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 699

Original Poster
Blog Entries: 1

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Quote:
Originally Posted by ljb643 View Post
It was added deliberately in November 2015 to vim-7.4
Based upon what I saw in the file it looked like it was put there on purpose but was more curious about the 'why'. In any event it set 'q' to a value that did not work for me.

Quote:
Originally Posted by ljb643 View Post
is documented in the help for "filetype": "q same as :quit". So it isn't a bug.
I did not see the help but I never considered a real bug, it just seemed an odd definitionfor 'q'.

Quote:
Originally Posted by ljb643 View Post
Sounds like you are using man mode for something else, though, which is why 'q' is interfering.
Filetype 'man' is a text file with manual page source. When I was creating/changing man pages, vim would exit when I wanted to create a macro. I finally had time to figure what was causing my issue and modified the file. Maybe as you seem to mention, it may be an attempt by vim to show formatted manuals, similar to what one can do in elvis using ':display man' and ':display normal'

John
 
Old 12-23-2016, 06:13 PM   #5
Xsane
Member
 
Registered: Jan 2014
Posts: 186

Rep: Reputation: 134Reputation: 134
Quote:
Originally Posted by jmccue View Post
Maybe as you seem to mention, it may be an attempt by vim to show formatted manuals, similar to what one can do in elvis using ':display man' and ':display normal'
Yes, that is what this plugin does. See:
Code:
vim "+help ft-man"
vim "+help manpage"
Unfortunately, it is in conflict with the 'man' file extension. Not only
will that file extension cause the 'man' plugin to load, it also sets
the filetype and syntax highlighting to 'man'. When editing man-page
source files you'll likely want the filetype set to nroff.

You can override this behavior on a per call basis with:

STOP THE KEY MAPPING
Code:
vim --cmd "let no_man_maps=1" somefile.man
SET THE FILE TYPE
Code:
vim "+set ft=nroff" somefile.man
OR BOTH
Code:
vim --cmd "let no_man_maps=1" "+set ft=nroff" somefile.man
To make the key mapping sticky add this to your ~/.vimrc file:
Code:
let no_man_maps=1
For other ways see:
Code:
vim "+help ftplugin-overrule"
vim "+help new-filetype"
 
2 members found this post helpful.
Old 12-24-2016, 09:31 AM   #6
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 699

Original Poster
Blog Entries: 1

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Quote:
Originally Posted by Xsane View Post
To make the key mapping sticky add this to your ~/.vimrc file:
Code:
let no_man_maps=1
I added the above and reverted the change I made to /usr/share/vim/vim74/ftplugin/man.vim and all works as I would like it to.

I will make this 'solved' since I believe your solution is much better then what I did.

John
 
  


Reply

Tags
man, plugin, vim



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] Fedora shows 'man vim' but when execute 'vim' got "bash: vim: command not found..." ? flash_os Linux - Newbie 19 01-03-2015 11:56 PM
Workaround for Vim ftp error cmnorton Programming 2 08-26-2009 08:04 AM
LXer: OpenBSD: the fvwm man page does not reveal all, but I have a workaround, plus m LXer Syndicated Linux News 0 02-14-2008 01:41 AM
Compiling packages on RH 7.1 causes man files to be named man.gz mmboam Linux - General 0 05-09-2001 06:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:00 AM.

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