Skip to main content
added reformatting
Source Link
3N4N
  • 5.9k
  • 1
  • 21
  • 49

I think you should use the function as below:

function! BenIndent()
  let oldLine=line('.')
  normal! gg=G
  execute ':' . oldLine
endfunction
nnoremap -- :call BenIndent()<CR>

Should work now I think.

Here's what I changed from your function:

fun -> function! BenIndent()  " I've just always known functions to be declared this way, I may be wrong
  let oldLine=line('.')
  normal -> normal! gg=G      " the ! sign tells vim to not remap the provided keys, e.g. if you map g to :q then vim would quit when indenting!
  execute ':' . oldLine
endfun -> endfunction         " just my convention
map -> nnoremap -- :call BenIndent()<CR> " the ! signnoremap tells vim to not remapto theuse providedremapped keys and n is for mapping in normal mode only, if you want in other modes change n with v, i or c etc.

prefix of -> is your code and suffix is mine.

I think you should use the function as below:

function! BenIndent()
  let oldLine=line('.')
  normal! gg=G
  execute ':' . oldLine
endfunction
nnoremap -- :call BenIndent()<CR>

Should work now I think.

Here's what I changed from your function:

fun -> function! BenIndent()  " I've just always known functions to be declared this way, I may be wrong
  let oldLine=line('.')
  normal -> normal! gg=G      " the ! sign tells vim to not remap the provided keys, e.g. if you map g to :q then vim would quit when indenting!
  execute ':' . oldLine
endfun -> endfunction         " just my convention
map -> nnoremap -- :call BenIndent()<CR> " the ! sign tells vim to not remap the provided keys

prefix of -> is your code and suffix is mine.

I think you should use the function as below:

function! BenIndent()
  let oldLine=line('.')
  normal! gg=G
  execute ':' . oldLine
endfunction
nnoremap -- :call BenIndent()<CR>

Should work now I think.

Here's what I changed from your function:

fun -> function! BenIndent()  " I've just always known functions to be declared this way, I may be wrong
  let oldLine=line('.')
  normal -> normal! gg=G      " the ! sign tells vim to not remap the provided keys, e.g. if you map g to :q then vim would quit when indenting!
  execute ':' . oldLine
endfun -> endfunction         " just my convention
map -> nnoremap -- :call BenIndent()<CR> " noremap tells vim not to use remapped keys and n is for mapping in normal mode only, if you want in other modes change n with v, i or c etc.

prefix of -> is your code and suffix is mine.

added reformatting
Source Link
3N4N
  • 5.9k
  • 1
  • 21
  • 49

I think you should use the function as below:

function! BenIndent()
  let oldLine=line('.')
  normal! gg=G
  execute ':' . oldLine
endfunction
nnoremap -- :call BenIndent()<CR>

Should work now I think.

Here's what I changed from your function:

fun -> function! BenIndent()  " I've just always known functions to be declared this way, I may be wrong
  let oldLine=line('.')
  normal -> normal! gg=G      " the ! sign tells vim to not remap the provided keys, e.g. if you map g to :q then vim would quit when indenting!
  execute ':' . oldLine
endfun -> endfunction         " just my convention
map -> nnoremap -- :call BenIndent()<CR> " the ! sign tells vim to not remap the provided keys

prefix of -> is your code and suffix is mine.

I think you should use the function as below:

function! BenIndent()
  let oldLine=line('.')
  normal! gg=G
  execute ':' . oldLine
endfunction
nnoremap -- :call BenIndent()<CR>

Should work now I think.

I think you should use the function as below:

function! BenIndent()
  let oldLine=line('.')
  normal! gg=G
  execute ':' . oldLine
endfunction
nnoremap -- :call BenIndent()<CR>

Should work now I think.

Here's what I changed from your function:

fun -> function! BenIndent()  " I've just always known functions to be declared this way, I may be wrong
  let oldLine=line('.')
  normal -> normal! gg=G      " the ! sign tells vim to not remap the provided keys, e.g. if you map g to :q then vim would quit when indenting!
  execute ':' . oldLine
endfun -> endfunction         " just my convention
map -> nnoremap -- :call BenIndent()<CR> " the ! sign tells vim to not remap the provided keys

prefix of -> is your code and suffix is mine.

Post Undeleted by 3N4N
Post Deleted by 3N4N
Source Link
3N4N
  • 5.9k
  • 1
  • 21
  • 49

I think you should use the function as below:

function! BenIndent()
  let oldLine=line('.')
  normal! gg=G
  execute ':' . oldLine
endfunction
nnoremap -- :call BenIndent()<CR>

Should work now I think.