aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mapping.c
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-02-11 10:24:46 +0100
committerGitHub <noreply@github.com>2023-02-11 10:24:46 +0100
commitc8c930ea785aa393ebc819139913a9e05f0ccd45 (patch)
tree7ec328fa4a13dbac9a71361e6036c4d1952f9c10 /src/nvim/mapping.c
parentc9b0fe1f41ebaa6815a69ac614a5b2d1bab6f720 (diff)
downloadrneovim-c8c930ea785aa393ebc819139913a9e05f0ccd45.tar.gz
rneovim-c8c930ea785aa393ebc819139913a9e05f0ccd45.tar.bz2
rneovim-c8c930ea785aa393ebc819139913a9e05f0ccd45.zip
refactor: reduce scope of locals as per the style guide (#22206)
Diffstat (limited to 'src/nvim/mapping.c')
-rw-r--r--src/nvim/mapping.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index 831d1299a8..5547b6c367 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -1434,15 +1434,11 @@ int ExpandMappings(char *pat, regmatch_T *regmatch, int *numMatches, char ***mat
// Return true if there is an abbreviation, false if not.
bool check_abbr(int c, char *ptr, int col, int mincol)
{
- int len;
int scol; // starting column of the abbr.
- int j;
- char *s;
char_u tb[MB_MAXBYTES + 4];
mapblock_T *mp;
mapblock_T *mp2;
int clen = 0; // length in characters
- bool is_id = true;
if (typebuf.tb_no_abbr_cnt) { // abbrev. are not recursive
return false;
@@ -1462,6 +1458,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
}
{
+ bool is_id = true;
bool vim_abbr;
char *p = mb_prevptr(ptr, ptr + col);
if (!vim_iswordp(p)) {
@@ -1489,7 +1486,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
}
if (scol < col) { // there is a word in front of the cursor
ptr += scol;
- len = col - scol;
+ int len = col - scol;
mp = curbuf->b_first_abbr;
mp2 = first_abbr;
if (mp == NULL) {
@@ -1532,7 +1529,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
//
// Character CTRL-] is treated specially - it completes the
// abbreviation, but is not inserted into the input stream.
- j = 0;
+ int j = 0;
if (c != Ctrl_RSB) {
// special key code, split up
if (IS_SPECIAL(c) || c == K_SPECIAL) {
@@ -1568,6 +1565,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
const bool silent = mp->m_silent;
const bool expr = mp->m_expr;
+ char *s;
if (expr) {
s = eval_map_expr(mp, c);
} else {