On Sunday, July 1, 2012 8:34:36 AM UTC-3, JohnBeckett wrote:
> Gerardo Marset wrote:
> > I have sofftabstop (and shiftwidth) set to 4, and expandtab
> > enabled. Thus, when deleting groups of spaces, vim treats
> > them as tabs and deletes them 4 at a time. I want vim to do
> > that only if from the start of the line and up to the
> > cursor's position there's only spaces and nothing else.
>
> I'm not sure exactly what the issue is, but are you aware that
> in insert mode you can press Ctrl-D to unindent the current line
> (remove one level of shiftwidth)? Does that help?
>
> I recently cleaned this up, although I don't think it helps
> your problem:
> http://vim.wikia.com/wiki/Shifting_blocks_visually
>
> John
No, that doesn't help. Thanks anyway.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Sunday, July 1, 2012
Re: Treat spaces as tabs only at the start of the line
On Saturday, June 30, 2012 5:34:35 PM UTC-5, Gerardo Marset wrote:
> I have sofftabstop (and shiftwidth) set to 4, and expandtab enabled. Thus, when deleting groups of spaces, vim treats them as tabs and deletes them 4 at a time. I want vim to do that only if from the start of the line and up to the cursor's position there's only spaces and nothing else.
> Currently I'm doing the following:
>
> inoremap <silent> <BS> <C-R>=fbs()<CR>
>
> function fbs()
> if getline('.') =~ '^ \{' . (col('.') - 1) . '}'
> return "\<BS>"
> endif
> return "\<Left>\<Del>"
> endfunction
>
> It works, but it breaks the repeat (dot) command, and I don't want that :). I think it's because of the <Left>. Any help (either modifying the previous code so that it doesn't break the dot command or coming up with a new one that doesn't) is appreciated.
You might try determining how many characters got deleted (getline in combination with your cursor position command may help here) and insert enough characters after the BS to make up for the difference. The thing interrupting your undo sequence (and therefore messing up your repeat command, '.') is the <Left> key, so you just need to avoid doing that. Dropping out of insert mode (even temporarily with <C-O>) will do the same thing unfortunately, and using setline() or setpos() is possible but will not be reflected in the repeat sequence without a lot of effort and additional mappings.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
> I have sofftabstop (and shiftwidth) set to 4, and expandtab enabled. Thus, when deleting groups of spaces, vim treats them as tabs and deletes them 4 at a time. I want vim to do that only if from the start of the line and up to the cursor's position there's only spaces and nothing else.
> Currently I'm doing the following:
>
> inoremap <silent> <BS> <C-R>=fbs()<CR>
>
> function fbs()
> if getline('.') =~ '^ \{' . (col('.') - 1) . '}'
> return "\<BS>"
> endif
> return "\<Left>\<Del>"
> endfunction
>
> It works, but it breaks the repeat (dot) command, and I don't want that :). I think it's because of the <Left>. Any help (either modifying the previous code so that it doesn't break the dot command or coming up with a new one that doesn't) is appreciated.
You might try determining how many characters got deleted (getline in combination with your cursor position command may help here) and insert enough characters after the BS to make up for the difference. The thing interrupting your undo sequence (and therefore messing up your repeat command, '.') is the <Left> key, so you just need to avoid doing that. Dropping out of insert mode (even temporarily with <C-O>) will do the same thing unfortunately, and using setline() or setpos() is possible but will not be reflected in the repeat sequence without a lot of effort and additional mappings.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Re: nosmartindent
On Sunday, July 1, 2012 7:19:12 AM UTC-5, Lyuben Petrov wrote:
> au FileType py set autoindent
> au FileType py set smartindent
> I added these lines to my vimrc file but still when I open a python file smartindent is not set. Autoindent though is.
Probably it's because Vim detects *.py files as "python" filetype, not "py".
See the output of :set filetype? to determine the filetype of the current buffer.
If it actually is "py" and not "python", check the output of :verbose set smartindent? autoindent? to see where the options were set.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
> au FileType py set autoindent
> au FileType py set smartindent
> I added these lines to my vimrc file but still when I open a python file smartindent is not set. Autoindent though is.
Probably it's because Vim detects *.py files as "python" filetype, not "py".
See the output of :set filetype? to determine the filetype of the current buffer.
If it actually is "py" and not "python", check the output of :verbose set smartindent? autoindent? to see where the options were set.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Re: print vim syntax highlighted text to stdout using ansi color
>MacOS X (unix) version
>Compiled by root@peng-yus-macbook-pro.local
I'm sorry but the only thing I know about terminals in macos is that
they doesn't work.
Can you try it in something that is not terminal.app or iterm? Something
like an xterm.
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 29 2012 19:25:34)
Included patches: 1-353
Compiled by wolly - Fri Jun 29 19:25:31 CEST 2012
Huge version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset
+cindent +clientserver +clipboard +cmdline_compl +cmdline_hist
+cmdline_info +comments +conceal -cryptv +cscope +cursorbind
+cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval
+ex_extra +extra_search +farsi +file_in_path +find_in_path +float
+folding -footer +fork() -gettext -hangul_input +iconv +insert_expand
+jumplist +keymap -langmap +libcall +linebreak +lispindent +listcmds
+localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse
+mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme
-netbeans_intg +path_extra -perl +persistent_undo +postscript +printer
+profile -python -python3 +quickfix +reltime +rightleft -ruby
+scrollbind +signs +smartindent -sniff +startuptime +statusline
-sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl
+terminfo +termresponse +textobjects +title -toolbar +user_commands
+user_commands_lowercase +vertsplit +virtualedit +visual +visualextra
+viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11
+xfontset -xim -xsmp +xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "~/etc/vim/vimrc"
2nd user vimrc file: "$VIMRUNTIME/vimrc"
3rd user vimrc file: "~/.vimrc"
stracing what's happening can be an idea, and maybe the -D flag for vim
can be useful.
Have you asked about your issue in the #vim channel on freenode?
There's a lot of mac{,vim} users, so someone might have an idea.
--
Magnus Woldrich
m@japh.se, woldrich@cpan.org
irc: japh on freenode, oftc
uri: http://japh.se
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
>Compiled by root@peng-yus-macbook-pro.local
I'm sorry but the only thing I know about terminals in macos is that
they doesn't work.
Can you try it in something that is not terminal.app or iterm? Something
like an xterm.
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 29 2012 19:25:34)
Included patches: 1-353
Compiled by wolly - Fri Jun 29 19:25:31 CEST 2012
Huge version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset
+cindent +clientserver +clipboard +cmdline_compl +cmdline_hist
+cmdline_info +comments +conceal -cryptv +cscope +cursorbind
+cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval
+ex_extra +extra_search +farsi +file_in_path +find_in_path +float
+folding -footer +fork() -gettext -hangul_input +iconv +insert_expand
+jumplist +keymap -langmap +libcall +linebreak +lispindent +listcmds
+localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse
+mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme
-netbeans_intg +path_extra -perl +persistent_undo +postscript +printer
+profile -python -python3 +quickfix +reltime +rightleft -ruby
+scrollbind +signs +smartindent -sniff +startuptime +statusline
-sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl
+terminfo +termresponse +textobjects +title -toolbar +user_commands
+user_commands_lowercase +vertsplit +virtualedit +visual +visualextra
+viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11
+xfontset -xim -xsmp +xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "~/etc/vim/vimrc"
2nd user vimrc file: "$VIMRUNTIME/vimrc"
3rd user vimrc file: "~/.vimrc"
stracing what's happening can be an idea, and maybe the -D flag for vim
can be useful.
Have you asked about your issue in the #vim channel on freenode?
There's a lot of mac{,vim} users, so someone might have an idea.
--
Magnus Woldrich
m@japh.se, woldrich@cpan.org
irc: japh on freenode, oftc
uri: http://japh.se
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Re: print vim syntax highlighted text to stdout using ansi color
> Did you check the content of ./v? Is it the same with
> the online version? Did you chmod the script to add the execution bit?
>
> I just tried the latest version and it works for me.
> Just note that it has been renamed to `_v`.
Obviously, I did what you have mentioned.
~/dvcs_src/utils$ ./_v _v ; echo xxx
xxx
I also tired to use the script by vim directly.
~/dvcs_src/utils$ vim -e -X -R "_v" -c "source _v" -c "visual" -c
"bufdo call AnsiHighlight()" -c qa
All I got was a flash of the screen (with non content) and then exit.
So I guess may be related with my vim setup. Could anybody try the
above command and let me know what you get? Thanks!
My OS is Mac OS X snow leopard.
~/dvcs_src/utils$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 18 2012 01:05:44)
MacOS X (unix) version
Included patches: 1-244, 246-556
Compiled by root@peng-yus-macbook-pro.local
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm -mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg
+path_extra -perl +persistent_undo +postscript +printer -profile +python
-python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "/opt/local/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/gcc-4.2 -c -I. -Iproto -DHAVE_CONFIG_H
-I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp -pipe -O2 -arch
x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/gcc-4.2 -L/opt/local/lib -arch x86_64
-L/usr/local/lib -o vim -lm -lncurses -liconv -lintl -framework
Cocoa -L/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
-lpython2.7 -framework CoreFoundation -u _PyMac_Error
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
--
Regards,
Peng
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
> the online version? Did you chmod the script to add the execution bit?
>
> I just tried the latest version and it works for me.
> Just note that it has been renamed to `_v`.
Obviously, I did what you have mentioned.
~/dvcs_src/utils$ ./_v _v ; echo xxx
xxx
I also tired to use the script by vim directly.
~/dvcs_src/utils$ vim -e -X -R "_v" -c "source _v" -c "visual" -c
"bufdo call AnsiHighlight()" -c qa
All I got was a flash of the screen (with non content) and then exit.
So I guess may be related with my vim setup. Could anybody try the
above command and let me know what you get? Thanks!
My OS is Mac OS X snow leopard.
~/dvcs_src/utils$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 18 2012 01:05:44)
MacOS X (unix) version
Included patches: 1-244, 246-556
Compiled by root@peng-yus-macbook-pro.local
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm -mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg
+path_extra -perl +persistent_undo +postscript +printer -profile +python
-python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "/opt/local/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/gcc-4.2 -c -I. -Iproto -DHAVE_CONFIG_H
-I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp -pipe -O2 -arch
x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/gcc-4.2 -L/opt/local/lib -arch x86_64
-L/usr/local/lib -o vim -lm -lncurses -liconv -lintl -framework
Cocoa -L/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
-lpython2.7 -framework CoreFoundation -u _PyMac_Error
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
--
Regards,
Peng
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
nosmartindent
au FileType py set autoindent
au FileType py set smartindent
I added these lines to my vimrc file but still when I open a python file smartindent is not set. Autoindent though is.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
au FileType py set smartindent
I added these lines to my vimrc file but still when I open a python file smartindent is not set. Autoindent though is.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
RE: Treat spaces as tabs only at the start of the line
Gerardo Marset wrote:
> I have sofftabstop (and shiftwidth) set to 4, and expandtab
> enabled. Thus, when deleting groups of spaces, vim treats
> them as tabs and deletes them 4 at a time. I want vim to do
> that only if from the start of the line and up to the
> cursor's position there's only spaces and nothing else.
I'm not sure exactly what the issue is, but are you aware that
in insert mode you can press Ctrl-D to unindent the current line
(remove one level of shiftwidth)? Does that help?
I recently cleaned this up, although I don't think it helps
your problem:
http://vim.wikia.com/wiki/Shifting_blocks_visually
John
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
> I have sofftabstop (and shiftwidth) set to 4, and expandtab
> enabled. Thus, when deleting groups of spaces, vim treats
> them as tabs and deletes them 4 at a time. I want vim to do
> that only if from the start of the line and up to the
> cursor's position there's only spaces and nothing else.
I'm not sure exactly what the issue is, but are you aware that
in insert mode you can press Ctrl-D to unindent the current line
(remove one level of shiftwidth)? Does that help?
I recently cleaned this up, although I don't think it helps
your problem:
http://vim.wikia.com/wiki/Shifting_blocks_visually
John
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Subscribe to:
Posts (Atom)