b-r-o-c-k
7170de1971
api: Make nvim_set_option() update :verbose set ...
...
Make `:verbose set ...` show when an option was last modified by an
API client or Lua script/chunk. In the case of an API client, the
channel ID is displayed.
2018-05-03 21:05:20 -05:00
Justin M. Keyes
53f11dcfc7
Merge #8218 'Fix errors reported by PVS'
...
closes #4983
2018-04-27 09:25:02 +02:00
Justin M. Keyes
77cb14cc6d
API: nvim__stats()
...
Use it to verify fsync() behavior.
2018-04-24 00:44:06 +02:00
ZyX
d9c010e45d
api/vim: Fix PVS/V547: node was already dereferenced, so can’t be NULL
2018-04-22 20:23:50 +03:00
Justin M. Keyes
1c3a849881
API/nvim_command_output: handle :echon capture ( #8265 )
...
ref https://github.com/neovim/python-client/pull/290
2018-04-13 00:49:37 +02:00
Justin M. Keyes
a034d4b69d
API: nvim_get_proc()
...
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;
+}
2018-03-18 00:11:45 +01:00
Justin M. Keyes
12af7016e2
nvim_get_proc_children: fallback to shell
...
/proc/…/children may be unavailable because of an unset kernel option.
Fallback to `pgrep` invoked in a shell.
2018-03-16 10:55:12 +01:00
Justin M. Keyes
dbad797edd
API: nvim_get_proc_children()
...
ref https://github.com/libuv/libuv/pull/836
2018-03-16 10:55:12 +01:00
geekodour
9f994bb699
api: nvim_list_uis #8004
...
ref #7438
closes #4842
2018-03-03 15:06:24 +01:00
Justin M. Keyes
5055d4a755
api: nvim_command_output: direct impl
2018-01-10 23:58:56 +01:00
Justin M. Keyes
c095f83116
api: change nvim_command_output behavior
...
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
2018-01-10 23:45:44 +01:00
Justin M. Keyes
fe60fa9faa
doc
...
vim-patch:8.0.1206: no autocmd for entering or leaving the command line
(commit a4f6cec7a3
)
NA patches:
vim-patch:8.0.0320: warning for unused variable with small build
2017-12-26 03:58:28 +01:00
ZyX
45998deb5d
*: Fix linter errors
2017-12-12 00:52:14 +03:00
Justin M. Keyes
dc232b74fb
doc: hack to avoid doxygen bug
...
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.
2017-12-10 17:13:22 +01:00
Justin M. Keyes
3cc7ebf810
Merge #7234 'built-in expression parser'
2017-12-09 18:47:34 +01:00
ZyX
17077b6813
viml/parser/expressions: Make $ENV not depend on &isident
2017-11-26 16:08:53 +03:00
ZyX
b9c7813058
Merge branch 'master' into expression-parser
2017-11-26 15:54:03 +03:00
Björn Linse
5215e3205a
channels: refactor
2017-11-24 14:50:00 +01:00
ZyX
03a129aacf
Merge branch 'master' into expression-parser
2017-11-19 22:05:22 +03:00
James McCoy
0407ddb364
Use PRId64 to format Integer when calling api_set_error
...
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'
2017-11-12 16:45:39 -05:00
ZyX
c7495ebcc0
viml/parser/expressions: Add support for parsing assignments
2017-11-12 02:18:43 +03:00
ZyX
4aebd00a9e
*: Fix linter errors
2017-11-06 20:28:37 +03:00
ZyX
24a353364d
Merge branch 'master' into expression-parser
2017-11-06 20:23:35 +03:00
Justin M. Keyes
280943d9b9
doc: API (generated)
2017-11-06 04:51:34 +01:00
Justin M. Keyes
842a54a1bb
doc
2017-11-06 01:56:04 +01:00
ZyX
ebb5977837
api/vim: Add “len” dictionary key
...
This allows determining where parsing ended which may be needed for e.g. parsing
`:echo` with that API function.
2017-11-06 01:17:39 +03:00
ZyX
7849070f99
tests: Add missing test cases
2017-11-06 01:17:39 +03:00
ZyX
7bc6de7526
api/vim,functests: Add tests for nvim_parse_expression, fix found bugs
2017-11-06 01:17:39 +03:00
ZyX
07ec709141
vim/api: Actually dump AST, fix some bugs in nvim_parse_expression
2017-11-06 01:17:38 +03:00
ZyX
b9d5aea073
api/vim: Create part of nvim_parse_expression function
2017-11-06 01:17:38 +03:00
ZyX
22d161a5dd
api/vim: Add nvim_parse_expression function
2017-10-29 20:11:44 +03:00
Justin M. Keyes
52517321d1
test: nvim_get_hl_by_name/by_id #7082
...
- test all properties
- test failure modes
2017-10-08 21:17:20 +02:00
Justin M. Keyes
04187a1c74
Merge #7082 'api: nvim_get_hl_by_name/by_id'
2017-10-08 19:09:14 +02:00
Matthieu Coudron
3a00648639
Changed prototypes to accept a boolean "rgb"
2017-09-30 11:43:26 +09:00
Matthieu Coudron
e3a2cca387
Increased test coverage for RGB and cterm
2017-09-30 11:43:26 +09:00
Matthieu Coudron
ba7277cfb4
Adds nvim_get_hl_by_name/by_id
...
...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.
2017-09-30 11:43:26 +09:00
Justin M. Keyes
cdd9e868ef
doc: channel, eventloop
2017-09-05 15:01:07 +02:00
Justin M. Keyes
b13070ec01
doc/api: nvim_out_write() and friends
...
References #7178
2017-08-18 21:43:57 +02:00
Justin M. Keyes
0b88bf256d
doc: api.txt; deprecate <special>
2017-07-08 16:34:35 +02:00
Justin M. Keyes
0ea7e45bc1
'cpoptions': remove "<" flag; ignore <special>
...
Closes #6937 "nvim_get_keymap output is unreliable"
2017-07-08 16:34:35 +02:00
Justin M. Keyes
78c5201234
'cpoptions': remove "k" flag
...
This was already removed in 3baba1e7bc
, except the documentation and
CPO_VI entry. find_term_bykeys() is irrelevant to Nvim.
2017-07-08 16:34:33 +02:00
Justin M. Keyes
f34befe74c
Merge #6789 from ZyX-I/lua-path
...
lua: Add paths from &runtimepath to package.path and package.cpath
2017-06-27 02:29:15 +02:00
Björn Linse
1eff241ec6
bufhl: use kbtree for bufhl
2017-06-24 11:09:10 +02:00
Björn Linse
3f553ac0b9
lint: fix indentation of FUNC_ATTR lines
2017-06-03 08:17:22 +02:00
TJ DeVries
45626de63f
get_keymap API ( #6236 )
...
* Add api function get keymap
nvim_get_keymap(mode)
nvim_buf_get_keymap(buffer, mode)
2017-05-25 12:41:53 +02:00
ZyX
a5a5c83608
api/vim: Fix nvim_list_runtimepaths
...
It used to
1. Always omit last component in runtimepath.
2. Always omit trailing empty item and leave uninitialized memory in place of
it.
2017-05-23 00:16:23 +03:00
Justin M. Keyes
bdd73fc07f
api/nvim_replace_termcodes: Document keycodes behavior
2017-05-20 22:20:32 +02:00
Björn Linse
f424189093
api: execute lua directly from the remote api
2017-05-13 15:03:42 +02:00
Björn Linse
2d5920ae1a
api: always use prefix FUNC_API, also change NOEVAL to REMOTE_ONLY
2017-05-10 17:37:34 +02:00
ZyX
09f849b600
Merge branch 'master' into luaviml'/lua
2017-05-08 15:43:45 +03:00