GithubHelp home page GithubHelp logo

cosco.vim's Introduction

Hi there ๐Ÿ‘‹

I'm Luiz. I like people and software.

  • ๐Ÿ”ญ I am currently a Sr. Engineering Manager managing a few teams at Coursera
  • ๐Ÿ“ซ How to reach me: https://luiz.dev
  • ๐Ÿ˜„ Pronouns: he/him
  • โšก Fun fact: Andean condors can fly for ~5 hours and only flap their wings ~1% of the time, covering about 172km (107 miles)! Now that is TP99 efficient! (source).

Recruiters:

  • Only remote roles will get my attention.
  • 4-day work week will get my interest.

cosco.vim's People

Contributors

ammarnajjar avatar kronik907 avatar lfilho avatar roryokane avatar tandrewnichols avatar viniarck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cosco.vim's Issues

Semicolons are added to comment lines

I'm not sure why but when coding with php and using the auto add (which works amazingly well) it is adding semicolons to the end of my comments.

Is there something we can add in to check for // and # at the beginnings of lines (depending on language)

Allow users to ignore semicolon insertion based on a regex pattern

Hi Luiz,

I code in C++ so, I'm using cosco.vim to auto insert semicolons. It turns out that when I inserted an include statement, such as #include <iostream>, then cosco.vim auto inserted the semicolon, which is undesirable.

I believe if you could allow the users to have a variable to ignore some patterns based on regex that'd be great to workaround such minor exceptions. What do you say? I patched the code, viniarck@a845301, and I'm using this variable to ignore C/C++ include statements:

let g:cosco_ignore_pattern="^#"

Let me know if I should open a PR for this or if you have an ideia for a better or more robust approach to ignore patterns. Once again, thanks for cosco.vim, it's really awesome!

print "test"; # here's a comment (adds ; here)

Hello. Just wanna report this small issue which adds a semicolon on lines even if preceded by a hash #

print "test"; # here's a comment;
#                               ^ adds a semicolon even if preceded by a #
if ( $whatever ) {;
#                 ^ same is true for constructs

s:strip(string) not working on neovim

my vim version info

 # vim --version
NVIM v0.5.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az242-526

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

filetypes/c.vim

here is a working example on my laptop, but when I change trim(str) to s:strip(str), it's not working

" c behaves like so:  if it's pre-processing, do nothing
function! filetypes#c#parse()
    if trim(b:currentLine) =~ "^#"
        let b:wasExtensionExecuted = 1
        return
    endif
endfunction

Pass end symbol to the command as a fallback option

Hi, nice plugin.

Can we add ability to pass end symbol to the command as a fallback option? I'm not very much into Vim Script, but maybe we can add mappings like this:

autocmd FileType javascript,css,YOUR_LANG nmap <silent> <Leader>; <Plug>(cosco-commaOrSemiColon)
autocmd FileType javascript,css,YOUR_LANG nmap <silent> <Leader>;; <Plug>(cosco-commaOrSemiColon(";"))
autocmd FileType javascript,css,YOUR_LANG nmap <silent> <Leader>;, <Plug>(cosco-commaOrSemiColon(","))

So, we can press default mapping, see what the plugin did, if the result is incorrect then press ";" or "," to force the plugin to insert or replace the symbol at the end of line.

colon support, in addition to comma or semicolon

Question, or an enhancement request:
Just wondering if you may have considered adding "colon" in addition to comma or semicolon (I'm asking with python in mind).
Is that not feasible?
Thanks.

Make the action repeatable with `.`

When I have :call cosco#commaOrSemiColon()<CR> bound to a mapping like <Leader>;, I might want to repeat that command with .. For example, I might want to do <Leader>;j. to add semicolons to two consecutive lines. Currently, the plugin does not support that โ€“ย . just repeats the last command I did before calling cosco.

You can use tpopeโ€™s repeat.vim to easily add . support to your plugin as long as the user has repeat.vim installed.

New "Undefined variable" error when invoking on Neovim

Hey there. Long time user of this wonderful plugin. After a recent update, I started getting the below error.

Error detected while processing function cosco#commaOrSemiColon[31]..<SNR>194_hasUnactionableLines:
line    2:
E121: Undefined variable: g:cosco_ignore_comment_lines
E15: Invalid expression: (g:cosco_ignore_comment_lines == 1)

NVIM v0.2.1-596-g5a0acd09c

Config file here:
https://github.com/bugeats/dotfiles/blob/master/src/config/nvim/init.vim

g:auto_comma_or_semicolon needs "cosco" prefix for consistency

Thanks for the plugin, just started playing with it. I'm using the auto option, but I noticed that unlike g:cosco_ignore_comment_lines, and global options in most other plugins, it does not prefix the option with cosco, making it more likely to conflict with user's other variables and harder to find in vim file. Is that something that makes sense to add?

When undoing, the cursor do not persist position

Opening first Cosco issue on the Halloween ๐Ÿ‘ป

I noticed that when I do a cosco action and undo it, my cursor do not comes back to where it was. Is it possible to ensure it will persist the position?

Doesn't recognize common comment blocks.

It is common (in JavaScript, for instance) to have comment block such as the following:

Often used for jsdoc

/**;
 * Represents a book.;
 * @constructor;
 */;
function Book(title, author) {
}

Ordinary comment block

/*;
* This is a comment.;
*/;

However, Cosco doesn't recognize them as legitimate comment blocks .

My OS: Mac Monterey

My vim configuration:

""
" Plugin: Cosco
" Colon and Semicolon insertion
""

augroup cosco
    autocmd FileType javascript,css,json nmap <silent> <Leader>; <Plug>(cosco-commaOrSemiColon)
    autocmd FileType javascript,css,json imap <silent> <Leader>; <c-o><Plug>(cosco-commaOrSemiColon)
augroup END

let g:cosco_ignore_comment_lines = 1     " Default : 0
let g:auto_comma_or_semicolon = 1     " Default : 0
" let g:cosco_filetype_whitelist = ['php', 'javascript']
let g:cosco_filetype_blacklist = ['vim', 'bash', 'lua']

Semicolons added to methods if braces are opened on the next line

I generally code using the format:

public function name()
{
    something here;
}

When I use this formatting along with the auto add semicolons function it likes to add semicolons to the end of my function declaration like so:

public function name();
{
    something here;
}

Is there a way that we could have it check the next line for an opening brace and not add a semicolon if the next line starts with an opening brace?

Automatically add needed semicolons

How one should configure Vim so that cosco.vim automatically adds needed semicolons? I would like to call cosco.vim on previous line whenever I move somewhere in that file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.