Add support for Go in Neovim

This commit is contained in:
Mikkel Svartveit 2023-08-06 22:45:22 +02:00
parent ddca2cbe9f
commit d4423e3dbb
5 changed files with 367 additions and 2 deletions

View file

@ -17,12 +17,14 @@ abbr ns "npm start"
abbr nrs "npm run serve" abbr nrs "npm run serve"
abbr nrd "npm run dev" abbr nrd "npm run dev"
abbr nrw "npm run watch" abbr nrw "npm run watch"
abbr lrr "source venv/bin/activate.fish && litestar run --reload"
abbr venv "source venv/bin/activate.fish" abbr venv "source venv/bin/activate.fish"
abbr lrr "source venv/bin/activate.fish && litestar run --reload"
abbr gw "gow -e=go,mod,html run ."
abbr nobrew "HOMEBREW_NO_AUTO_UPDATE=1 brew" abbr nobrew "HOMEBREW_NO_AUTO_UPDATE=1 brew"
abbr ghv "gh repo view --web" abbr ghv "gh repo view --web"
abbr pr "gh pr checkout" abbr pr "gh pr checkout"
abbr prc "gh pr create --web" abbr prc "gh pr create --web"
abbr gli "nvim (git rev-parse --show-toplevel)/.git/info/exclude"
abbr cloud-push "rsync -auzP --exclude=.DS_Store '/Volumes/Samsung T7/misvaCloud/' ubuntu@cloud.misva.me:~/misvaCloud/" abbr cloud-push "rsync -auzP --exclude=.DS_Store '/Volumes/Samsung T7/misvaCloud/' ubuntu@cloud.misva.me:~/misvaCloud/"
abbr cloud-pull "rsync -auzP --exclude=.DS_Store ubuntu@cloud.misva.me:~/misvaCloud/ '/Volumes/Samsung T7/misvaCloud/'" abbr cloud-pull "rsync -auzP --exclude=.DS_Store ubuntu@cloud.misva.me:~/misvaCloud/ '/Volumes/Samsung T7/misvaCloud/'"
abbr cloud-purge "rsync -auzP --exclude=.DS_Store '/Volumes/Samsung T7/misvaCloud/' ubuntu@cloud.misva.me:~/misvaCloud/ --delete --dry-run" abbr cloud-purge "rsync -auzP --exclude=.DS_Store '/Volumes/Samsung T7/misvaCloud/' ubuntu@cloud.misva.me:~/misvaCloud/ --delete --dry-run"
@ -68,8 +70,10 @@ end
[ -f /opt/homebrew/share/autojump/autojump.fish ]; and source /opt/homebrew/share/autojump/autojump.fish [ -f /opt/homebrew/share/autojump/autojump.fish ]; and source /opt/homebrew/share/autojump/autojump.fish
# Allow running pip packages # Allow running pip packages
export PATH="/Users/mikkelsvartveit/Library/Python/3.9/bin:$PATH" export PATH="$HOME/Library/Python/3.9/bin:$PATH"
# Allow running Go packages
export PATH="$HOME/go/bin:$PATH"
# The next line updates PATH for the Google Cloud SDK. # The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/mikkelsvartveit/Applications/google-cloud-sdk/path.fish.inc' ]; . '/Users/mikkelsvartveit/Applications/google-cloud-sdk/path.fish.inc'; end if [ -f '/Users/mikkelsvartveit/Applications/google-cloud-sdk/path.fish.inc' ]; . '/Users/mikkelsvartveit/Applications/google-cloud-sdk/path.fish.inc'; end

View file

@ -0,0 +1,291 @@
{
"global": {
"ask_for_confirmation_before_quitting": true,
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false,
"unsafe_ui": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
"basic.simultaneous_threshold_milliseconds": 50,
"basic.to_delayed_action_delay_milliseconds": 500,
"basic.to_if_alone_timeout_milliseconds": 500,
"basic.to_if_held_down_threshold_milliseconds": 500,
"mouse_motion_to_scroll.speed": 100
},
"rules": [
{
"description": "Post Esc if Caps is tapped, Control if held.",
"manipulators": [
{
"from": {
"key_code": "left_control",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_control",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "escape"
}
],
"type": "basic"
}
]
}
]
},
"devices": [
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 641,
"vendor_id": 1452
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 641,
"vendor_id": 1452
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 666,
"vendor_id": 76
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 613,
"vendor_id": 1452
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 50504,
"vendor_id": 1133
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 50504,
"vendor_id": 1133
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
}
],
"fn_function_keys": [
{
"from": {
"key_code": "f1"
},
"to": [
{
"consumer_key_code": "display_brightness_decrement"
}
]
},
{
"from": {
"key_code": "f2"
},
"to": [
{
"consumer_key_code": "display_brightness_increment"
}
]
},
{
"from": {
"key_code": "f3"
},
"to": [
{
"apple_vendor_keyboard_key_code": "mission_control"
}
]
},
{
"from": {
"key_code": "f4"
},
"to": [
{
"apple_vendor_keyboard_key_code": "spotlight"
}
]
},
{
"from": {
"key_code": "f5"
},
"to": [
{
"consumer_key_code": "dictation"
}
]
},
{
"from": {
"key_code": "f6"
},
"to": [
{
"key_code": "f6"
}
]
},
{
"from": {
"key_code": "f7"
},
"to": [
{
"consumer_key_code": "rewind"
}
]
},
{
"from": {
"key_code": "f8"
},
"to": [
{
"consumer_key_code": "play_or_pause"
}
]
},
{
"from": {
"key_code": "f9"
},
"to": [
{
"consumer_key_code": "fast_forward"
}
]
},
{
"from": {
"key_code": "f10"
},
"to": [
{
"consumer_key_code": "mute"
}
]
},
{
"from": {
"key_code": "f11"
},
"to": [
{
"consumer_key_code": "volume_decrement"
}
]
},
{
"from": {
"key_code": "f12"
},
"to": [
{
"consumer_key_code": "volume_increment"
}
]
}
],
"name": "Default profile",
"parameters": {
"delay_milliseconds_before_open_device": 1000
},
"selected": true,
"simple_modifications": [
{
"from": {
"key_code": "caps_lock"
},
"to": [
{
"key_code": "left_control"
}
]
},
{
"from": {
"key_code": "escape"
},
"to": [
{
"key_code": "caps_lock"
}
]
}
],
"virtual_hid_keyboard": {
"country_code": 0,
"indicate_sticky_modifier_keys_state": true,
"mouse_key_xy_scale": 100
}
}
]
}

View file

@ -130,6 +130,69 @@
"manipulate_caps_lock_led": false, "manipulate_caps_lock_led": false,
"simple_modifications": [], "simple_modifications": [],
"treat_as_built_in_keyboard": false "treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 45849,
"vendor_id": 1133
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [
{
"from": {
"key_code": "left_command"
},
"to": [
{
"key_code": "left_option"
}
]
},
{
"from": {
"key_code": "left_option"
},
"to": [
{
"key_code": "left_command"
}
]
}
],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 50475,
"vendor_id": 1133
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 50475,
"vendor_id": 1133
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
} }
], ],
"fn_function_keys": [ "fn_function_keys": [

View file

@ -1,11 +1,14 @@
{ {
"coc.preferences.formatOnSaveFiletypes": [ "coc.preferences.formatOnSaveFiletypes": [
"go",
"javascript", "javascript",
"javascriptreact", "javascriptreact",
"typescript", "typescript",
"typescriptreact", "typescriptreact",
"vue", "vue",
"svelte", "svelte",
"html",
"css",
"json", "json",
"graphql", "graphql",
"markdown" "markdown"

View file

@ -32,6 +32,7 @@ require("lazy").setup({
vim.g.coc_global_extensions = { vim.g.coc_global_extensions = {
"coc-pyright", "coc-pyright",
"coc-clangd", "coc-clangd",
"coc-go",
"coc-tsserver", "coc-tsserver",
"@yaegassy/coc-volar", "@yaegassy/coc-volar",
"coc-svelte", "coc-svelte",
@ -40,6 +41,8 @@ require("lazy").setup({
"coc-prettier", "coc-prettier",
"coc-eslint", "coc-eslint",
} }
vim.api.nvim_command("autocmd BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport')")
end end
}, },
@ -232,6 +235,7 @@ require("lazy").setup({
javascript = "node", javascript = "node",
typescript = "ts-node --esm", typescript = "ts-node --esm",
c = "gcc -o main % && ./main", c = "gcc -o main % && ./main",
go = "go run",
}, },
}, },
init = function() init = function()