aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-11-12 15:54:54 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-11-13 23:39:56 +0100
commit28f4f3c48498086307ed825d1761edb5789ca0e8 (patch)
tree880d2104092261fe0457b17a9ddda8a6e0f7f2ed /src/nvim/main.c
parent48bcc7b9710d6db619b05254ea87f4087cdd9764 (diff)
downloadrneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.tar.gz
rneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.tar.bz2
rneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.zip
refactor: follow style guide
- reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index f80fb98918..00eb6e75a5 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1749,7 +1749,6 @@ static void create_windows(mparm_T *parmp)
static void edit_buffers(mparm_T *parmp, char *cwd)
{
int arg_idx; // index in argument list
- int i;
bool advance = true;
win_T *win;
char *p_shm_save = NULL;
@@ -1765,7 +1764,7 @@ static void edit_buffers(mparm_T *parmp, char *cwd)
}
arg_idx = 1;
- for (i = 1; i < parmp->window_count; i++) {
+ for (int i = 1; i < parmp->window_count; i++) {
if (cwd != NULL) {
os_chdir(cwd);
}
@@ -1869,7 +1868,6 @@ static void exe_pre_commands(mparm_T *parmp)
{
char **cmds = parmp->pre_commands;
int cnt = parmp->n_pre_commands;
- int i;
if (cnt <= 0) {
return;
@@ -1878,7 +1876,7 @@ static void exe_pre_commands(mparm_T *parmp)
curwin->w_cursor.lnum = 0; // just in case..
estack_push(ETYPE_ARGS, _("pre-vimrc command line"), 0);
current_sctx.sc_sid = SID_CMDARG;
- for (i = 0; i < cnt; i++) {
+ for (int i = 0; i < cnt; i++) {
do_cmdline_cmd(cmds[i]);
}
estack_pop();
@@ -1889,8 +1887,6 @@ static void exe_pre_commands(mparm_T *parmp)
// Execute "+", "-c" and "-S" arguments.
static void exe_commands(mparm_T *parmp)
{
- int i;
-
// We start commands on line 0, make "vim +/pat file" match a
// pattern on line 1. But don't move the cursor when an autocommand
// with g`" was used.
@@ -1901,7 +1897,7 @@ static void exe_commands(mparm_T *parmp)
estack_push(ETYPE_ARGS, "command line", 0);
current_sctx.sc_sid = SID_CARG;
current_sctx.sc_seq = 0;
- for (i = 0; i < parmp->n_commands; i++) {
+ for (int i = 0; i < parmp->n_commands; i++) {
do_cmdline_cmd(parmp->commands[i]);
if (parmp->cmds_tofree[i]) {
xfree(parmp->commands[i]);