diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2021-10-24 22:48:51 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2021-10-24 22:48:51 +0200 |
| commit | 67946a1ae4c68010fc2b4fd0f73238f88f7dbbc8 (patch) | |
| tree | 153142323a4046fe17e7743dd30502cd511ca75c | |
| parent | b51479362becb5e0341b9c3fb0a71f4d07d87866 (diff) | |
| parent | 923b5750e2fe96b23930ecdcd5e488b4c64b6b52 (diff) | |
| download | nvim-conf-67946a1ae4c68010fc2b4fd0f73238f88f7dbbc8.tar.gz nvim-conf-67946a1ae4c68010fc2b4fd0f73238f88f7dbbc8.zip | |
Merge branch 'main' of github.com:adalessa/dotfiles
| -rw-r--r-- | init.vim | 1 | ||||
| -rw-r--r-- | lua/alpha/refactor.lua | 45 | ||||
| -rw-r--r-- | plugin/git.vim | 2 | ||||
| -rw-r--r-- | plugin/telescope.vim | 1 |
4 files changed, 46 insertions, 3 deletions
@@ -31,6 +31,7 @@ augroup END filetype plugin indent on autocmd FileType yaml setl indentkeys-=<:> autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab +autocmd FileType cucumber setlocal ts=2 sts=2 sw=2 expandtab nnoremap Y y$ diff --git a/lua/alpha/refactor.lua b/lua/alpha/refactor.lua index d4cea4e..1d89fad 100644 --- a/lua/alpha/refactor.lua +++ b/lua/alpha/refactor.lua @@ -50,8 +50,9 @@ M.setter_getter = function() if (p.type_list == 'array' or p.type_list == nil) then local prev = ts_utils.get_previous_node(node, false, false) if (node.type(prev) == 'comment') then - comment = ts_utils.get_node_text(prev)[1] - comment = string.match(comment, '@var (.*) ') + comment = ts_utils.get_node_text(prev)[2] + -- print(vim.inspect(comment)) + comment = string.match(comment, '@var (.*)') end -- print(vim.inspect(node.type(prev))) -- print(vim.inspect(ts_utils.get_node_text(prev))) @@ -71,7 +72,47 @@ M.setter_getter = function() return (str:gsub("^%l", string.upper)) end + local function mysplit (inputstr, sep) + if sep == nil then + sep = "%s" + end + local t={} + for str in string.gmatch(inputstr, "([^"..sep.."]+)") do + table.insert(t, str) + end + return t + end + + local function implode(delimiter, list) + local len = #list + if len == 0 then + return "" + end + local string = list[1] + for i = 2, len do + string = string .. delimiter .. list[i] + end + return string + end + local varType = p.type_list + if (varType == nil) then + local isNullable = false + local types = {} + local commentTypes = mysplit(comment, "|") + for _, v in ipairs(commentTypes) do + if (v == "null") then + isNullable = true + else + table.insert(types, v) + end + end + varType = implode("|", types) + if (isNullable) then + varType = "?" .. varType + end + + end local insert = {} table.insert(insert, "") diff --git a/plugin/git.vim b/plugin/git.vim index 37c5d9f..3000140 100644 --- a/plugin/git.vim +++ b/plugin/git.vim @@ -10,5 +10,5 @@ nmap <Leader>gdl :diffget //3<CR> nnoremap <leader>ga :Git fetch --all -p<CR> nnoremap <leader>gl :Git pull<CR> -nnoremap <leader>gp :Git push<CR> +nnoremap <leader>gpp :Git push<CR> nnoremap <leader>gpo :Git push -u origin HEAD<CR> diff --git a/plugin/telescope.vim b/plugin/telescope.vim index 5321a31..2a82845 100644 --- a/plugin/telescope.vim +++ b/plugin/telescope.vim @@ -9,6 +9,7 @@ nnoremap <leader>pw :lua require('telescope.builtin').grep_string({ search = vim nnoremap <leader>pp :lua require('telescope.builtin').git_files()<CR> nnoremap <leader>po :lua require('telescope.builtin').find_files()<CR> + nnoremap <leader>pv :lua require('telescope.builtin').lsp_workspace_symbols({ query = vim.fn.input("Symbols > ")})<CR> nnoremap <leader>pe :lua require('alpha.telescope').buffers()<CR> |