Comments (14)
I merged increment_update
branch to master
branch
from gen_tags.vim.
I read the source code of vim-gutentags
, it use platform dependent script to do this job..
I need to check how to do this with vimscript.
from gen_tags.vim.
Due to the the exuberant ctags is not maintained anymore, the successor recommendation
is universal ctags from now on.
There is feature request in universal-ctags/ctags#1421
If this feature is implemented, the ugly prune in vimscript can be removed and the performance should be improved in same time.
Let's see what will be happened. π
from gen_tags.vim.
I'm not sure which parameter is for incremental update in ctags.
Maybe you can try this, by setting let g:gen_tags#ctags_opts = '-a'
in your vimrc
According to ctags help message, -a
or --append
maybe suit for you
-a Append the tags to an existing tag file.
BUT I don't see any difference on my side, when I run both command for Linux Kernel.
# jiasui @ ul80vt in ~/repos/linux-stable on git:master o [8:54:41]
$ time ctags -R
ctags -R 71.40s user 5.56s system 100% cpu 1:16.37 total
# jiasui @ ul80vt in ~/repos/linux-stable on git:master o [8:56:03]
$ time ctags -Ra
ctags -Ra 76.37s user 6.58s system 100% cpu 1:22.50 total
from gen_tags.vim.
The time similarity in both commands is likely due to all tags still being generated for the pwd
both times. I believe the -a
flag just impacts the output.
According to ctags docs:
Indicates whether tags generated from the specified files should be appended
To incrementally generate based on the current file being edited, is it possible to specify the current file for automatic generation? Such as:
ctags -Ra ./path/to/file_being_written_to
This would yield better incremental change times:
# Generate all tags once, up front
$ gtime ctags -R
0.67user 0.07system 0:00.77elapsed 97%CPU
$ wc -l tags
22376 tags
# Now I've declared a new function in ./current_file
# As the file is written to, only generate / append tags for that file
$ gtime ctags -Ra ./current_file
0.01user 0.01system 0:00.04elapsed 72%CPU
$ wc -l tags
22377 tags
from gen_tags.vim.
Hmm, which means gen_tags.vim
need to run ctags -a
for single file?
But it looks -a
will not delete the symbol from tags file which was already deleted?
from gen_tags.vim.
Yea, it is one possibility. Looks like the issue with -a
would be keeping track of subtractive updates - the append with a single file seems like it would handle additive updates just fine.
Got curious about how vim-gutentags handles this. Their docs describe this workflow:
Usually, ctags can only append tags to an existing tag file, so Gutentags removes the tags for the current file first, to make sure the tag file is always consistent with the source code.
from gen_tags.vim.
@lorainekv
I have a dirty hack for this issue at increament_update branch
gen_tags.vim
supports incremental update now.
But for prune exist tags, I added a option g:gen_tags#ctags_prune
for it.
If g:gen_tags#ctags_prune
is 1, gen_tags.vim
will prune exist tags first.
The prune action will impact the performance when tagfile is big. (like linux kernel, >500MB)
Can you have a try? Thanks
from gen_tags.vim.
Nice, thanks for updating this. The subtractive and additive updates to tag files seem to be working now. :)
I am running into some surprising behavior though - I seem to now have tag files in both a project root (for a github repo) and in the ~/.cache/... path. This doesn't seem intended, since it's duplicate tag files. So when I attempt to find a function definition it asks me to choose from in ~/project_folder/file and also in ./project_folder/file.
When I run a vimdiff
on the ~/.cache tagfile and the git repo tag file, I notice that one says !_TAG_FILE_SORTED 0
and the other says !_TAG_FILE_SORTED 1
from gen_tags.vim.
What do you mean about 'git repo tag file'?
Did you generate tags file manually?
gen_tags.vim
will only generate tags in ~/.cache/tags_dir
by default.
If you don't set g:gen_tags#ctags_use_cache_dir
to 0
from gen_tags.vim.
My bad, regarding the repo tag file, I had forgotten to uninstall another plugin I was testing out yesterday. Thanks for the increment update!
from gen_tags.vim.
You're welcome, thanks for the report and clarify π
from gen_tags.vim.
I like the idea and I would like to use this prune+increment feature, but there a few problems currently that don't make it very usable.
@jsfaint Would it be possible to make the "hack" in s:ctags_prune
async by using async jobs? Because otherwise it defeats the purpose of an async plugin. On Unix it would be by using grep or sed I guess.
Also, if I have g:gen_tags#ctags_prune
set to 1 and I save a file outside of the project directory, for example my vimrc, I have this error: Pattern not found: \/Users\/jerome\/.dotfiles\/.vim\/init.vim
. I have this problem with the following Neovim configuration:
let g:loaded_gentags#gtags = 1
let g:gen_tags#ctags_auto_gen = 1
let g:gen_tags#ctags_opts = '-a -u'
let g:gen_tags#ctags_prune = 1
from gen_tags.vim.
@jeromedalbert Sorry for the late reply.
It's known issue which is limitation of pure vim script.
Yeah, I know sed is very efficient, but it only works on *nix platform.
I want gen_tags.vim work on both windows and *nix platform
So I need to find a way which do same thing with sed on windows, or rewrite this part in Python.
Sorry, I do not have spare time to look into this currently.
PR will be appreciated π
from gen_tags.vim.
Related Issues (20)
- Can I redir search result to quickfix list HOT 8
- if HOME path contain backspace on windows, it doesn't work HOT 2
- gtags keymapping is not working HOT 9
- file save will lost tag data HOT 6
- If the previous GenGTAGS exit abnormally, it will not be updated by use GenGTAGS again HOT 2
- ctags can't add g:gen_tags#ctags_opts parameter , it would pop "-f option may not follow a file name" HOT 16
- [question] Can I use Gtags for jump instead of ctags? HOT 5
- [feature request] support ncm2 source HOT 3
- Clipbord is contaminated HOT 11
- Increase Python 3's priority. HOT 2
- ε ³δΊη»ζεΎε€ηζΆε HOT 4
- Auto generate tags throws a unicode error for certain Windows paths HOT 9
- add option to use only ctags HOT 2
- g:gen_tags#global_opts HOT 1
- g:gen_tags#use_cache_dir creates useless directories when used with vim-fugitive HOT 3
- [feature request] Highlight tags HOT 3
- Tags file not sorted error HOT 19
- set ctag rules per filetype HOT 2
- Rebuild tags after branch change HOT 2
- When the directories configured by scm (.git, .hg, .svn) and g:gen_tags#root_marker both exist, the problem that the configuration of g:gen_tags#root_marker is invalid HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gen_tags.vim.