Skip to content

Conversation

@Raimondi
Copy link

  • funced and fish_indent always uses tabs for indentation, use
    fish#Indent() to fix it. Works better with the improved fish#Indent().
  • ftdetect should contain filetype detection code. Move autocmds to
    plugin/fish.vim.
  • Match new funced temp file name.
  • Add "else", "else if" and "case" to b:match_words to follow what's
    used by Vim's ftplugins.
  • Use "syn sync fromstart" for a more accurate highlighting.

@Raimondi Raimondi force-pushed the small_improvements branch from 40c5a6f to a93c82a Compare June 19, 2015 03:29
- funced and fish_indent always uses tabs for indentation, use
  fish#Indent() to fix it. Works better with the improved fish#Indent().
- ftdetect should contain filetype detection code. Move autocmds to
  plugin/fish.vim.
- Match new funced temp file name.
- Add "else", "else if" and "case" to b:match_words to follow what's
  used by Vim's ftplugins.
- Use "syn sync fromstart" for a more accurate highlighting.
@Raimondi Raimondi force-pushed the small_improvements branch from a93c82a to ab4ce9f Compare June 19, 2015 03:30
@chemzqm
Copy link

chemzqm commented Dec 4, 2015

👍

Copy link
Owner

@dag dag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good; I just have a few comments.

echo l:command
execute l:command
" Fix indentation and replace tabs with spaces if necessary.
normal! '[=']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably use :retab for this. Why do you feel you need to fix the indentation of the output from the program that is made for fixing indentation? Does it get something wrong?

endif

let b:match_words =
\ escape('<%(begin|function|if|switch|while|for)>:<end>', '<>%|)')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason you dropped this use of escape? I think it's more readable.

autocmd BufRead,BufNewFile *.fish setfiletype fish

" Set filetype when using funced.
autocmd BufRead fish_funced.* setfiletype fish
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should maybe try to keep support for old-style funced file names too.

autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly
"
" Move cursor to first empty line when using funced.
autocmd BufRead fish_funced.* exec "normal! gg=G" | call search('^\s*\zs$')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you forcing a reindent here?


" Mimic `funced` when manually creating functions.
autocmd BufNewFile ~/.config/fish/functions/*.fish
\ call setline(1, ['function '.expand('%:t:r'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for preferring setline over append here?

finish
endif

syntax sync clear
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary in a syntax file.

endif

syntax sync clear
syntax sync fromstart
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? It can be slow for large files, or Vim would just do it by default for all filetypes. It should only really be used for things like heredocs, which last I checked fish didn't have, but I guess it has multiline strings that can be used similarly. But how often do you have strings span more than a few lines? Do you really need to sync all the way from start?

blankname pushed a commit to blankname/vim-fish that referenced this pull request Jan 5, 2020
- funced and fish_indent always uses tabs for indentation, use
  fish#Indent() to fix it. Works better with the improved fish#Indent().
- ftdetect should contain filetype detection code. Move autocmds to
  plugin/fish.vim.
- Match new funced temp file name.
- Add "else", "else if" and "case" to b:match_words to follow what's
  used by Vim's ftplugins.

blankname:
- dropped the syntax changes (cc: dag#28)

Co-authored-by: blankname <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants