Как настроить автодополнение в tcsh на фре?

Проблемы установки, настройки и работы Правильной Операционной Системы

Модератор: terminus

Правила форума
Убедительная просьба юзать теги [cоde] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.
Гость
проходил мимо

Re: Как настроить автодополнение в tcsh на фре?

Непрочитанное сообщение Гость » 2008-05-02 13:12:15

если все равно не работает, то вывод tcsh --version и bindkey -l пожалуйста.

или эта команда просто не то, что ты искал?

Хостинговая компания Host-Food.ru
Хостинг HostFood.ru
 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

Аватара пользователя
vintovkin
ВДВ
Сообщения: 1288
Зарегистрирован: 2007-05-11 9:39:11
Откуда: CSKA

Re: Как настроить автодополнение в tcsh на фре?

Непрочитанное сообщение vintovkin » 2008-05-02 21:05:07

быдло-гость писал(а):@vintovkin,
опять патакаешь своей дурной привычке и не прочел комментарий? Там дано для shift+tab (он же backtab), чтобы было просто tab надо добавить ^I, т.е. bindkey ^I complete-word-fwd и перезагружать комп не обязательно, достаточно сделать source /etc/csh.cshrc (или что там у тебя).

после чего пишешь часть команды и жмякаешь по tab. Должно сразу дополниться до ближайшей по алфавиту.
сори :D не внимателен !
спасибо большое работает!всё супер!

Код: Выделить всё

root@bsd:~# tcsh --version
tcsh 6.14.00 (Astron) 2005-03-25 (i386-intel-FreeBSD) options wide,nls,dl,al,kan,rh,color,filec
root@bsd:~#

биндкей там много очень сторк - в путти не влазиит :D

зы
как настроить эту фишку во второй команде?
Junos OS kernel based on FreeBSD UNIX.

Гость
проходил мимо

Re: Как настроить автодополнение в tcsh на фре?

Непрочитанное сообщение Гость » 2008-05-02 22:12:43

@vintovkin,
ты о man'ах? я это решил таким образом:

Код: Выделить всё

# man(1)
set _manpath=(`manpath | sed 's/:/ /g; s|/man|/man/man*|g'`)
set _mancomp=(`\ls -R $_manpath | sed '/.*:$/d; s|\.[[:alnum:]]\{1,\}\(\.gz\)\{0,1\}$||' | sort -u`)
complete man 'n/*/$_mancomp/'
Но, блин, после этого у меня tcsh загружается по пять секунд.
остальные дополнения можно брать из /usr/share/examples/tcsh/complete.tcsh, однако, надо проверять, ибо не все из них там работают, а некоторые ориентированы на линух. Вобщем, вот целиком мой /etc/csh.comp (я его source'аю из /etc/csh.cshrc):

Код: Выделить всё

# -*-sh-*-
complete set		'c/*=/f/' 'p/1/s/=' 'n/=/f/'
complete unset		'n/*/s/'
complete setenv		'p/1/e/' 'c/*:/f/'
complete {unset,print}env	'n/*/e/'
complete alias		'p/1/a/'
complete unalias	'n/*/a/'
complete {,un}limit		'c/-/(h)/' 'n/*/l/'
complete -%*		'c/%/j/'
complete {fg,bg,stop}	'c/%/j/' 'p/1/(%)//'
complete bindkey	'C/*/b/'
complete k{,ill}	'c/-/S/' 'c/%/j/' 'n/*/`ps opid=`/'

# sysctl
complete sysctl		'n/*/`sysctl -Na`/'
complete env		'c/*=/f/' 'p/1/e/=/' 'p/2/c/'

# http://unixconsult.org/zfs_tcsh_completion
set zpool_cmd =	(create destroy add remove list iostat status\
		online offline clear attach detach replace scrub\
		import export upgrade history get set)

set zfs_cmd =	(create destroy snapshot rollback clone promote\
		rename list set get inherit mount unmount\
		share unshare send receive)

complete zpool \
	'p/1/$zpool_cmd/'\
	'n/destroy/`zpool list -Honame`/'\
	'n/add/`zpool list -Honame`/'\
	'n/remove/`zpool list -Honame`/'\
	'n/list/`zpool list -Honame`/'\
	'n/iostat/`zpool list -Honame`/'\
	'n/status/`zpool list -Honame`/'\
	'n/online/`zpool list -Honame`/'\
	'n/offline/`zpool list -Honame`/'\
	'n/clear/`zpool list -Honame`/'\
	'n/attach/`zpool list -Honame`/'\
	'n/detach/`zpool list -Honame`/'\
	'n/replace/`zpool list -Honame`/'\
	'n/scrub/`zpool list -Honame`/'\
	'n/import/`zpool list -Honame`/'\
	'n/export/`zpool list -Honame`/'\
	'n/upgrade/`zpool list -Honame`/'\
	'n/history/`zpool list -Honame`/'\
	'N/get/`zpool list -Honame`/'\
	'N/set/`zpool list -Honame`/'
	
complete zfs \
	'p/1/$zfs_cmd/'\
	'n/create/`zfs list -Honame`/'\
	'n/destroy/`zfs list -Honame`/'\
	'n/snapshot/`zfs list -Honame`/'\
	'n/rollback/`zfs list -Htsnapshot -oname`/'\
	'n/clone/`zfs list -Htsnapshot -oname`/'\
	'n/promote/`zfs list -Honame`/'\
	'n/rename/`zfs list -Honame`/'\
	'n/list/`zfs list -Honame`/'\
	'N/set/`zfs list -Honame`/'\
	'N/get/`zfs list -Honame`/'\
	'n/inherit/`zfs list -Honame`/'\
	'n/mount/`zfs list -Honame`/'\
	'n/unmount/`zfs list -Honame`/'\
	'n/share/`zfs list -Honame`/'\
	'n/unshare/`zfs list -Honame`/'\
	'n/send/`zfs list -Htsnapshot -oname`/'\
	'n/receive/`zfs list -Honame`/'
# end

# man(1)
set _manpath=(`manpath | sed 's/:/ /g; s|/man|/man/man*|g'`)
set _mancomp=(`\ls -R $_manpath | sed '/.*:$/d; s|\.[[:alnum:]]\{1,\}\(\.gz\)\{0,1\}$||' | sort -u`)
complete man 'n/*/$_mancomp/'

# info(1)
set _infocomp=(`\ls -R /usr/{share,local}/info | sed '/.*:$/d; /^dir$/d; s|\.info\(\.gz\)\{0,1\}||' | sort -u`)
complete info 'n/*/$_infocomp/'

# perldoc(1)
# foreach d (/usr/perl5 /usr/lib/perl5 /usr/local/perl5 /usr/local/lib/perl5)
#     if (-d "$d") then
# 	set _podcomp=('n@*@`\ls -1 '$d'/5.*/pod | sed | s%\\.pod.\*\$%%`@')
#     endif
# end
# complete perdoc 'n/*/$_podcomp'

complete	uncomplete	'p/*/X/'
Как видишь, я не особо заморачивался, ибо лениво.

Аватара пользователя
Alex Keda
стреляли...
Сообщения: 35426
Зарегистрирован: 2004-10-18 14:25:19
Откуда: Made in USSR
Контактная информация:

Re: Как настроить автодополнение в tcsh на фре?

Непрочитанное сообщение Alex Keda » 2008-05-02 22:22:22

2 гость.
может не стоит юзать такой ник? =)
Убей их всех! Бог потом рассортирует...


Аватара пользователя
Alex Keda
стреляли...
Сообщения: 35426
Зарегистрирован: 2004-10-18 14:25:19
Откуда: Made in USSR
Контактная информация:

Re: Как настроить автодополнение в tcsh на фре?

Непрочитанное сообщение Alex Keda » 2008-05-02 23:36:49

ProFTPD писал(а):это масив
массив гостей? =)
Убей их всех! Бог потом рассортирует...

Гость
проходил мимо

Re: Как настроить автодополнение в tcsh на фре?

Непрочитанное сообщение Гость » 2008-05-02 23:38:38

ProFTPD писал(а):это масив
+ @ в tcsh означает не массив, а арифметические операции.
@
@ name = expr
@ name[index] = expr
@ name++|--
@ name[index]++|--
The first form prints the values of all shell variables.

The second form assigns the value of expr to name. The third
form assigns the value of expr to the index'th component of
name; both name and its index'th component must already exist.

expr may contain the operators `*', `+', etc., as in C. If
expr contains `<', `>', `&' or `' then at least that part of
expr must be placed within `()'. Note that the syntax of expr
has nothing to do with that described under Expressions.

The fourth and fifth forms increment (`++') or decrement (`--')
name or its index'th component.

The space between `@' and name is required. The spaces between
name and `=' and between `=' and expr are optional. Components
of expr must be separated by spaces.
массивы там обозначаются
$name[selector]
${name[selector]}
Substitutes only the selected words from the value of name.
The selector is subjected to `$' substitution and may consist
of a single number or two numbers separated by a `-'. The
first word of a variable's value is numbered `1'. If the first
number of a range is omitted it defaults to `1'. If the last
member of a range is omitted it defaults to `$#name'. The
selector `*' selects all words. It is not an error for a range
to be empty if the second argument is omitted or in range.
, если их можно так обозвать.

или я что-то пропустил и речь не об этом?

Аватара пользователя
vintovkin
ВДВ
Сообщения: 1288
Зарегистрирован: 2007-05-11 9:39:11
Откуда: CSKA

Re: Как настроить автодополнение в tcsh на фре?

Непрочитанное сообщение vintovkin » 2008-05-03 10:28:18

Очень интересно!
давно собирался изучать язык программирования shell
теперь точно этим займусь!как только появится время.
да, и еще английский что бы маны курить)))))))))))))))
Junos OS kernel based on FreeBSD UNIX.