Skip to content

Commit

Permalink
Working with doc gen
Browse files Browse the repository at this point in the history
  • Loading branch information
charnley committed Jul 5, 2024
1 parent 7a4335a commit 26950ed
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 40 deletions.
13 changes: 13 additions & 0 deletions dot/neovim/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

require 'base' -- Standard VIM settings
require 'plugins' -- Install all plugins
require 'maps' -- Most key mappings
Expand Down
1 change: 1 addition & 0 deletions dot/neovim/lua/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ endif

-- Disable filetype plugin (it overwrites tab/indentation settings)
vim.api.nvim_exec([[filetype plugin off]], false)
-- vim.api.nvim_exec([[filetype plugin on]], false) -- needed for doge#generate

-- Spelling
vim.opt.spelllang="en"
Expand Down
36 changes: 14 additions & 22 deletions dot/neovim/lua/ide.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require('nvim-autopairs').setup({})
require("which-key").setup({})

-- Be able to comment html and js in same file
-- require('ts_context_commentstring').setup({})
require('ts_context_commentstring').setup({})

-- Auto signature hints
require('lsp_signature').setup({
Expand All @@ -32,7 +32,6 @@ cmp.event:on( 'confirm_done',
cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })
)


-- comment
require("Comment").setup {
ignore = "^$",
Expand All @@ -56,9 +55,18 @@ require("Comment").setup {

-- docstring
-- generate docstring
require('neogen').setup()
require('neogen').setup({
languages = {
-- TODO This does not work, super annoying
['svelte'] = require('neogen.configurations.javascript')
}
})
vim.api.nvim_set_keymap("n", "<Leader>nd", ":lua require('neogen').generate()<CR>", {noremap=true, silent=true, desc="Generate docstring"})

-- Doge
-- Open nvim and run :call doge#install()
-- vim.keymap.set('n', '<Leader>nd', '<Plug>(doge-generate)')

-- setup completion
cmp.setup({
snippet = {
Expand Down Expand Up @@ -129,14 +137,14 @@ require'nvim-treesitter.configs'.setup {
"html",
"javascript",
"python",
"svelte",
"tsx",
"typescript",
"vue",
"svelte",
},

highlight = { -- enable highlighting for all file types
-- enable = true,
enable = true,
},

-- need for proper indentation handling (especially for bracket pairs)
Expand Down Expand Up @@ -173,18 +181,7 @@ require'nvim-treesitter.configs'.setup {
},
}

-- local autolist = require("autolist")
-- autolist.setup()
-- autolist.create_mapping_hook("i", "<cr>", autolist.new)
-- autolist.create_mapping_hook("i", "<Tab>", autolist.indent)
-- autolist.create_mapping_hook("i", "<S-Tab>", autolist.indent, "<C-D>")
-- autolist.create_mapping_hook("n", "o", autolist.new)
-- autolist.create_mapping_hook("n", "O", autolist.new_before)
-- autolist.create_mapping_hook("n", ">>", autolist.indent)
-- autolist.create_mapping_hook("n", "<<", autolist.indent)
-- autolist.create_mapping_hook("n", "<leader>r", autolist.force_recalculate)
-- autolist.create_mapping_hook("n", "<leader>x", autolist.invert_entry, "")

-- Write mode
require("autolist").setup()
vim.keymap.set("n", "<leader><tab>", "<cmd>AutolistTab<cr>")
vim.keymap.set("n", "<leader><s-tab>", "<cmd>AutolistShiftTab<cr>")
Expand All @@ -194,8 +191,6 @@ vim.keymap.set("n", "<leader>x", "<cmd>AutolistToggleCheckbox<cr>")
-- vim.keymap.set("n", "<<", "<<<cmd>AutolistRecalculate<cr>")
-- vim.keymap.set("n", "dd", "dd<cmd>AutolistRecalculate<cr>")
-- vim.keymap.set("v", "d", "d<cmd>AutolistRecalculate<cr>")


require("zen-mode").setup{
window = {
width = 0.5,
Expand All @@ -213,12 +208,9 @@ require("zen-mode").setup{
vim.api.nvim_exec([[set nowrap]], false)
end,
}

-- Write mode
vim.api.nvim_set_keymap("n", "<Leader>w", ":ZenMode<CR>", {noremap=true, silent=true, desc="Write mode"})

-- Sticky scrolling

require'treesitter-context'.setup{
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit.
Expand Down
14 changes: 1 addition & 13 deletions dot/neovim/lua/plugins.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

local plugins = {

-- General
Expand All @@ -30,6 +17,7 @@ local plugins = {
-- IDE
{'ThePrimeagen/refactoring.nvim'}, -- refactor chunks of code fast
{'danymat/neogen'}, -- generate docstrings (with treesitter)
-- {"kkoomen/vim-doge"}, -- Generate docstrings
{'gorkunov/smartpairs.vim'}, -- Extend visual selection of bracket
{'kabouzeid/nvim-lspinstall'},
{'neovim/nvim-lspconfig'},
Expand Down
6 changes: 6 additions & 0 deletions dot/neovim/snippets/javascript.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@
"console.log(\"${1}\", ${1})"
],
"description": "debug"
},
"type_variables": {
"prefix": "type",
"body": [
"/** @type {${1}} */"
]
}
}
13 changes: 8 additions & 5 deletions setup.osx/nvim_setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# set -x
set -x
set -e

cd ~/opt
Expand All @@ -9,11 +9,14 @@ mkdir -p neovim
cd neovim

# version="nightly"
version="latest"
# version="latest"
version="v0.10.0"

curl -LO https://github.com/neovim/neovim/releases/$version/download/nvim-macos.tar.gz
tar xzf nvim-macos.tar.gz
url=https://github.com/neovim/neovim/releases/download/$version/nvim-macos-arm64.tar.gz

ln -s $HOME/opt/neovim/nvim-macos/bin/nvim $HOME/bin/vim
curl -LO $url
tar xzf nvim-macos-arm64.tar.gz

ln -s $HOME/opt/neovim/nvim-macos-arm64/bin/nvim $HOME/bin/vim

$HOME/bin/vim --version 1> /dev/null # Check version is there, exit 1 if something failed

0 comments on commit 26950ed

Please sign in to comment.