Forum: PC-Programmierung vim-polyglot für vim (syntax highlighting)


von montagskind (Gast)


Lesenswert?

Ich möchte vim-polyglot (https://github.com/sheerun/vim-polyglot) für 
mein vim verwenden um den Python-Code zu highlighten. Ich verwende Vim 
Version 8 und ein plugin manager wird somit nicht mehr benötigt.

Das Plugin habe ich mit git in diesen Pfad geclont:
1
~/.vim/pack/color/start/vim_polyglot/

Im .vimrc habe ich alle highlighings eingeschaltet:
1
" syntax highlight on
2
syntax on
3
4
" choos one of vim's default color schemes
5
:colorscheme ron
6
7
" settings for vim-polyglot (file highlithing):
8
"let g:polyglot_disabled = ['markdown']
9
set nocompatible
10
let g:python_highlight_all = 1

Trotzdem sehe ich im python-skript keine Änderung, egal ob 
python_highlight_all  = 1 oder 0 ist. Hat jemand einen Tipp, was ich 
falsch mache?

von Nico T. (wurstnase)


Lesenswert?

Wahrscheinlich der falsche Ordner? In der Readme steht, dass man es nach 
~/.vim/pack/plugins/start/vim-polyglot installieren soll.

von foobar (Gast)


Lesenswert?

Ein Tipp um solche Probleme zu analysieren: strace.

  strace -etrace=file -olog.txt  vi file.py

und dann im log.txt nachschauen, auf welche Dateien/Pfade er versucht 
hat zuzugreifen.

von montagskind (Gast)


Lesenswert?

Danke euch für die Antworten.

Nico T. schrieb:
> ~/.vim/pack/plugins/start/vim-polyglot

Habe ich mal probiert, hat aber leider nichts geändert.

foobar schrieb:
> strace -etrace=file -olog.txt  vi file.py

Huhhh... steht ganz schön viel Zeug da drin :) Werde mal versuchen mich 
dort zurech zu finden...

von Daniel -. (root)


Lesenswert?

zeigt vim filetype richtig an?

von montagskind (Gast)


Lesenswert?

Daniel -. schrieb:
> zeigt vim filetype richtig an?

Woran sehe ich denn, welchen filetype vim erkennt?

von Yalu X. (yalu) (Moderator)


Lesenswert?

montagskind schrieb:
> Woran sehe ich denn, welchen filetype vim erkennt?

Mit dem Kommando
1
:se ft?

von montagskind (Gast)


Lesenswert?

Yalu X. schrieb:
> Mit dem Kommando
> :se ft?

Hey :) cooles Kommando. Gut zu wissen.

Die frage nach dem filetype kann ich somit beantworten:
Vim erkennt richtig, wenn es ein Pythonscript ist.

von montagskind (Gast)


Lesenswert?

Bei dem Versuch mit strace blicke ich leider gar nichts, sorry.

Wenn ich allerdings mit ":scriptnames" in vim nachsehe welche Module 
geladen wurden, sehe ich:
1
  1: /usr/share/vim/vimrc
2
  2: /usr/share/vim/vim80/debian.vim
3
  3: /usr/share/vim/vim80/syntax/syntax.vim
4
  4: /usr/share/vim/vim80/syntax/synload.vim
5
  5: /usr/share/vim/vim80/syntax/syncolor.vim
6
  6: /usr/share/vim/vim80/filetype.vim
7
  7: ~/.vimrc
8
  8: /usr/share/vim/vim80/syntax/nosyntax.vim
9
  9: /usr/share/vim/vim80/colors/ron.vim
10
 10: /usr/share/vim/vim80/plugin/getscriptPlugin.vim
11
 11: /usr/share/vim/vim80/plugin/gzip.vim
12
 12: /usr/share/vim/vim80/plugin/logiPat.vim
13
 13: /usr/share/vim/vim80/plugin/manpager.vim
14
 14: /usr/share/vim/vim80/plugin/matchparen.vim
15
 15: /usr/share/vim/vim80/plugin/netrwPlugin.vim
16
 16: /usr/share/vim/vim80/plugin/rrhelper.vim
17
 17: /usr/share/vim/vim80/plugin/spellfile.vim
18
 18: /usr/share/vim/vim80/plugin/tarPlugin.vim
19
 19: /usr/share/vim/vim80/plugin/tohtml.vim
20
 20: /usr/share/vim/vim80/plugin/vimballPlugin.vim
21
 21: /usr/share/vim/vim80/plugin/zipPlugin.vim
22
 22: ~/.vim/pack/plugins/start/vim-polyglot/plugin/polyglot.vim
23
 23: ~/.vim/pack/plugins/start/vim-polyglot/autoload/polyglot/init.vim
24
 24: ~/.vim/pack/plugins/start/vim-polyglot/filetype.vim
25
 25: ~/.vim/pack/plugins/start/vim-polyglot/ftdetect/polyglot.vim
26
 26: /usr/share/vim/vim80/ftplugin.vim
27
 27: /usr/share/vim/vim80/indent.vim
28
 28: /usr/share/vim/vim80/macros/matchit.vim
29
 29: /usr/share/vim/vim80/pack/dist/opt/matchit/plugin/matchit.vim
30
 30: /usr/share/vim/vim80/syntax/vim.vim
31
 31: /usr/share/vim/vim80/syntax/python.vim
32
 32: /usr/share/vim/vim80/ftplugin/vim.vim
33
 33: /usr/share/vim/vim80/indent/vim.vim
34
 34: ~/.vim/pack/plugins/start/vim-polyglot/autoload/polyglot/sleuth.vim

Dort sieht man, dass das Modul "31: 
/usr/share/vim/vim80/syntax/python.vim" nach meinem "22: 
~/....vim-polyglot..." geladen wird. Eventuell könnte das bedeuten, dass 
die Einstellungen meines gewünschten Moduls wieder überschrieben werden? 
Kann / sollte ich an der Reihenfolge der geladenen Module irgend etwas 
manipulieren?

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.