aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
Commit message (Collapse)AuthorAge
...
* | API: nvim_call_dict_function: eliminate `internal` paramJustin M. Keyes2018-05-06
| | | | | | | | | | | | The `internal` param is difficult to explain, and will rarely be anything but `true`. To avoid it, use a hack: check if the resolved dict value starts with "function(".
* | refactor: nvim_call_dict_functionJustin M. Keyes2018-05-06
| | | | | | | | | | - Add test coverage for errors. - Rename, rearrange.
* | API: nvim_call_dict_function #3032Sebastian Witte2018-05-06
|/
* Merge #8218 'Fix errors reported by PVS'Justin M. Keyes2018-04-27
|\ | | | | closes #4983
| * api/vim: Fix PVS/V547: node was already dereferenced, so can’t be NULLZyX2018-04-22
| |
* | API: nvim__stats()Justin M. Keyes2018-04-24
| | | | | | | | Use it to verify fsync() behavior.
* | API/nvim_command_output: handle :echon capture (#8265)Justin M. Keyes2018-04-13
|/ | | ref https://github.com/neovim/python-client/pull/290
* API: nvim_get_proc()Justin M. Keyes2018-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TODO: "exepath" field (win32: QueryFullProcessImageName()) On unix-likes `ps` is used because the platform-specific APIs are a nightmare. For reference, below is a (incomplete) attempt: diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index 09769925aca5..99afbbf290c1 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -208,3 +210,60 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count) return 0; } +/// Gets various properties of the process identified by `pid`. +/// +/// @param pid Process to inspect. +/// @return Map of process properties, empty on error. +Dictionary os_proc_info(int pid) +{ + Dictionary pinfo = ARRAY_DICT_INIT; +#ifdef WIN32 + +#elif defined(__APPLE__) + char buf[PROC_PIDPATHINFO_MAXSIZE]; + if (proc_pidpath(pid, buf, sizeof(buf))) { + name = getName(buf); + PUT(pinfo, "exepath", STRING_OBJ(cstr_to_string(buf))); + return name; + } else { + ILOG("proc_pidpath() failed for pid: %d", pid); + } +#elif defined(BSD) +# if defined(__FreeBSD__) +# define KP_COMM(o) o.ki_comm +# else +# define KP_COMM(o) o.p_comm +# endif + struct kinfo_proc *proc = kinfo_getproc(pid); + if (proc) { + PUT(pinfo, "name", cstr_to_string(KP_COMM(proc))); + xfree(proc); + } else { + ILOG("kinfo_getproc() failed for pid: %d", pid); + } + +#elif defined(__linux__) + char fname[256] = { 0 }; + char buf[MAXPATHL]; + snprintf(fname, sizeof(fname), "/proc/%d/comm", pid); + FILE *fp = fopen(fname, "r"); + // FileDescriptor *f = file_open_new(&error, fname, kFileReadOnly, 0); + // ptrdiff_t file_read(FileDescriptor *const fp, char *const ret_buf, + // const size_t size) + if (fp == NULL) { + ILOG("fopen() of /proc/%d/comm failed", pid); + } else { + size_t n = fread(buf, sizeof(char), sizeof(buf) - 1, fp); + if (n == 0) { + WLOG("fread() of /proc/%d/comm failed", pid); + } else { + size_t end = MIN(sizeof(buf) - 1, n); + end = (end > 0 && buf[end - 1] == '\n') ? end - 1 : end; + buf[end] = '\0'; + PUT(pinfo, "name", STRING_OBJ(cstr_to_string(buf))); + } + } + fclose(fp); +#endif + return pinfo; +}
* nvim_get_proc_children: fallback to shellJustin M. Keyes2018-03-16
| | | | | /proc/…/children may be unavailable because of an unset kernel option. Fallback to `pgrep` invoked in a shell.
* API: nvim_get_proc_children()Justin M. Keyes2018-03-16
| | | | ref https://github.com/libuv/libuv/pull/836
* api: nvim_list_uis #8004geekodour2018-03-03
| | | | | ref #7438 closes #4842
* api: nvim_command_output: direct implJustin M. Keyes2018-01-10
|
* api: change nvim_command_output behaviorJustin M. Keyes2018-01-10
| | | | | | | | | | | | | | | | | | | Implement nvim_command_output with `execute({cmd},"silent")`. Behavior changes: - does not provoke any hit-enter prompt - no longer prepends a newline char - does not capture some noise (like the "[New File]" message, see the change to tabnewentered_spec.lua) Technically ("bug-for-bug") this a breaking change. But the previous behavior of nvim_command_output meant that it probably wasn't used for anything outside of tests. Also remove the undocumented `v:command_output` variable which was a hack introduced only for the purposes of nvim_command_output. closes #7726
* docJustin M. Keyes2017-12-26
| | | | | | | | vim-patch:8.0.1206: no autocmd for entering or leaving the command line (commit a4f6cec7a31ff8dbfa089b9e22227afbeb951e9b) NA patches: vim-patch:8.0.0320: warning for unused variable with small build
* *: Fix linter errorsZyX2017-12-12
|
* doc: hack to avoid doxygen bugJustin M. Keyes2017-12-10
| | | | | | | | Use `@cond <something>` to obscure a section from doxygen. doxygen thinks kvec_withinit_t() is a function. That adds noise to the generated API documentation, and also prevents the following function from being noticed.
* Merge #7234 'built-in expression parser'Justin M. Keyes2017-12-09
|\
| * viml/parser/expressions: Make $ENV not depend on &isidentZyX2017-11-26
| |
| * Merge branch 'master' into expression-parserZyX2017-11-26
| |\ | |/ |/|
| * Merge branch 'master' into expression-parserZyX2017-11-19
| |\
| * | viml/parser/expressions: Add support for parsing assignmentsZyX2017-11-12
| | |
| * | *: Fix linter errorsZyX2017-11-06
| | |
| * | Merge branch 'master' into expression-parserZyX2017-11-06
| |\ \
| * | | api/vim: Add “len” dictionary keyZyX2017-11-06
| | | | | | | | | | | | | | | | | | | | This allows determining where parsing ended which may be needed for e.g. parsing `:echo` with that API function.
| * | | tests: Add missing test casesZyX2017-11-06
| | | |
| * | | api/vim,functests: Add tests for nvim_parse_expression, fix found bugsZyX2017-11-06
| | | |
| * | | vim/api: Actually dump AST, fix some bugs in nvim_parse_expressionZyX2017-11-06
| | | |
| * | | api/vim: Create part of nvim_parse_expression functionZyX2017-11-06
| | | |
| * | | api/vim: Add nvim_parse_expression functionZyX2017-10-29
| | | |
* | | | channels: refactorBjörn Linse2017-11-24
| |_|/ |/| |
* | | Use PRId64 to format Integer when calling api_set_errorJames McCoy2017-11-12
| |/ |/| | | | | | | | | | | | | | | | | | | Integer is a 64-bit type so using %d can produce incorrect results. test/functional/api/highlight_spec.lua @ 35: highlight api nvim_get_hl_by_id ...W7Xi/neovim-0.2.1/test/functional/api/highlight_spec.lua:46: Expected objects to be the same. Passed in: (string) 'Invalid highlight id: 7671724' Expected: (string) 'Invalid highlight id: 30000'
* | doc: API (generated)Justin M. Keyes2017-11-06
| |
* | docJustin M. Keyes2017-11-06
|/
* test: nvim_get_hl_by_name/by_id #7082Justin M. Keyes2017-10-08
| | | | | - test all properties - test failure modes
* Merge #7082 'api: nvim_get_hl_by_name/by_id'Justin M. Keyes2017-10-08
|\
| * Changed prototypes to accept a boolean "rgb"Matthieu Coudron2017-09-30
| |
| * Increased test coverage for RGB and ctermMatthieu Coudron2017-09-30
| |
| * Adds nvim_get_hl_by_name/by_idMatthieu Coudron2017-09-30
|/ | | | | | | | | ...in order to retrieve highlights. Added test/functional/api/highlight_spec.lua HL_NORMAL is not really a good name, since it's more like an empty attribute than the normal's one. If one pays attention, syn_cterm_attr2entry is never called with attr=0 because it's always special cased before. I suggest in subsequent PRs we remove the ATTR_OFF and just insert an EMPTY ATTR/RESET_ATTR/UNINITIALIZED for id 0.
* doc: channel, eventloopJustin M. Keyes2017-09-05
|
* doc/api: nvim_out_write() and friendsJustin M. Keyes2017-08-18
| | | | References #7178
* doc: api.txt; deprecate <special>Justin M. Keyes2017-07-08
|
* 'cpoptions': remove "<" flag; ignore <special>Justin M. Keyes2017-07-08
| | | | Closes #6937 "nvim_get_keymap output is unreliable"
* 'cpoptions': remove "k" flagJustin M. Keyes2017-07-08
| | | | | This was already removed in 3baba1e7bc66, except the documentation and CPO_VI entry. find_term_bykeys() is irrelevant to Nvim.
* Merge #6789 from ZyX-I/lua-pathJustin M. Keyes2017-06-27
|\ | | | | lua: Add paths from &runtimepath to package.path and package.cpath
| * api/vim: Fix nvim_list_runtimepathsZyX2017-05-23
| | | | | | | | | | | | | | | | It used to 1. Always omit last component in runtimepath. 2. Always omit trailing empty item and leave uninitialized memory in place of it.
* | bufhl: use kbtree for bufhlBjörn Linse2017-06-24
| |
* | lint: fix indentation of FUNC_ATTR linesBjörn Linse2017-06-03
| |
* | get_keymap API (#6236)TJ DeVries2017-05-25
|/ | | | | | | * Add api function get keymap nvim_get_keymap(mode) nvim_buf_get_keymap(buffer, mode)
* api/nvim_replace_termcodes: Document keycodes behaviorJustin M. Keyes2017-05-20
|
* api: execute lua directly from the remote apiBjörn Linse2017-05-13
|