Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start kakoune in insert mode #4123

Closed
Aadniz opened this issue Mar 31, 2021 · 9 comments
Closed

Start kakoune in insert mode #4123

Aadniz opened this issue Mar 31, 2021 · 9 comments

Comments

@Aadniz
Copy link

Aadniz commented Mar 31, 2021

Hi.

I'm making the switch from nano to kakoune, and was wondering if it's possible to start kakoune in insert mode?
Might be something people generally NOT want to do, but as for the switch from nano, I think it's one step in the right direction

In vim, I know you can do this with vim -c 'startinsert' FILENAME

@SolitudeSF
Copy link
Contributor

SolitudeSF commented Mar 31, 2021

kak -e 'exec i'

@alexherbo2
Copy link
Contributor

You might want to start insert mode when creating a new client:

~/.config/kak/kakrc

hook -group start-insert-mode global KakBegin '.*' 'execute-keys i'
hook -group start-insert-mode global ClientCreate '.*' 'execute-keys i'

With this config, kak will start in insert mode, and :new will start in insert mode as well.

See Hooks for other events.

@Aadniz
Copy link
Author

Aadniz commented Mar 31, 2021

You might want to start insert mode when creating a new client:

~/.config/kak/kakrc

hook -group start-insert-mode global KakBegin '.*' 'execute-keys i'
hook -group start-insert-mode global ClientCreate '.*' 'execute-keys i'

With this config, kak will start in insert mode, and :new will start in insert mode as well.

See Hooks for other events.

Thank you! it worked!

A bit curious why this "no-hooks" shows up automatically now:
Screenshot_20210401_010300

@alexherbo2
Copy link
Contributor

Replace with execute-keys -with-hooks i.

See execute-keys specific switches for more details.

@Aadniz
Copy link
Author

Aadniz commented Mar 31, 2021

That fixed it, thank you so much!

@Aadniz Aadniz closed this as completed Mar 31, 2021
@stacyharper
Copy link
Contributor

I'm trying to do this for a specific filetype. I got something like this but this is not working :(

hook global WinSetOption filetype=sms %{ 
    execute-keys -with-hooks i 
} 
 
hook global BufNewFile .*/Draft %{ set buffer filetype sms } 

@alexherbo2
Copy link
Contributor

Try with WinCreate and window scope.

@stacyharper
Copy link
Contributor

Mhh can you be more specific ? I think I tried all combination without success :D

@stacyharper
Copy link
Contributor

Okay I found my way with :

hook global BufCreate .*/Draft %{ 
    set buffer filetype sms 
    hook -once buffer WinDisplay .* %{ 
        execute-keys -with-hooks i 
    } 
} 

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

No branches or pull requests

4 participants