aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-11-16 10:59:11 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-11-20 19:57:09 +0100
commita6e3d93421ba13c407a96fac9cc01fa41ec7ad98 (patch)
treee84209969b11fe2f0dabcad00a271468b2199bc9 /src/nvim/ops.c
parentec79ff893d5906e1f0d90953cffa535ffae47823 (diff)
downloadrneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.tar.gz
rneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.tar.bz2
rneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.zip
refactor: enable formatting for ternaries
This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 34aa2c80db..c6f7c74d6b 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -451,8 +451,8 @@ static void shift_block(oparg_T *oap, int amount)
const colnr_T block_space_width = non_white_col - oap->start_vcol;
// We will shift by "total" or "block_space_width", whichever is less.
const colnr_T shift_amount = block_space_width < total
- ? block_space_width
- : total;
+ ? block_space_width
+ : total;
// The column to which we will shift the text.
const colnr_T destination_col = non_white_col - shift_amount;
@@ -688,8 +688,8 @@ void op_reindent(oparg_T *oap, Indenter how)
// there is no change still need to remove the Visual highlighting.
if (last_changed != 0) {
changed_lines(curbuf, first_changed, 0,
- oap->is_VIsual ? start_lnum + oap->line_count :
- last_changed + 1, 0, true);
+ oap->is_VIsual ? start_lnum + oap->line_count
+ : last_changed + 1, 0, true);
} else if (oap->is_VIsual) {
redraw_curbuf_later(UPD_INVERTED);
}
@@ -2067,8 +2067,8 @@ void op_tilde(oparg_T *oap)
} else {
while (true) {
did_change |= swapchars(oap->op_type, &pos,
- pos.lnum == oap->end.lnum ? oap->end.col + 1 :
- (int)strlen(ml_get_pos(&pos)));
+ pos.lnum == oap->end.lnum ? oap->end.col + 1
+ : (int)strlen(ml_get_pos(&pos)));
if (ltoreq(oap->end, pos) || inc(&pos) == -1) {
break;
}
@@ -2913,8 +2913,9 @@ void do_put(int regname, yankreg_T *reg, int dir, int count, int flags)
bool non_linewise_vis = (VIsual_active && VIsual_mode != 'V');
// PUT_LINE has special handling below which means we use 'i' to start.
- char command_start_char = non_linewise_vis ? 'c' :
- (flags & PUT_LINE ? 'i' : (dir == FORWARD ? 'a' : 'i'));
+ char command_start_char = non_linewise_vis
+ ? 'c'
+ : (flags & PUT_LINE ? 'i' : (dir == FORWARD ? 'a' : 'i'));
// To avoid 'autoindent' on linewise puts, create a new line with `:put _`.
if (flags & PUT_LINE) {
@@ -3125,8 +3126,8 @@ void do_put(int regname, yankreg_T *reg, int dir, int count, int flags)
}
// In an empty buffer the empty line is going to be replaced, include
// it in the saved lines.
- if ((buf_is_empty(curbuf) ?
- u_save(0, 2) : u_save(lnum - 1, lnum)) == FAIL) {
+ if ((buf_is_empty(curbuf)
+ ? u_save(0, 2) : u_save(lnum - 1, lnum)) == FAIL) {
goto end;
}
if (dir == FORWARD) {
@@ -6201,8 +6202,8 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
break;
}
op_reindent(oap,
- *curbuf->b_p_inde != NUL ? get_expr_indent :
- get_c_indent);
+ *curbuf->b_p_inde != NUL ? get_expr_indent
+ : get_c_indent);
break;
}