summaryrefslogtreecommitdiffstats
path: root/fun.vim
diff options
context:
space:
mode:
Diffstat (limited to 'fun.vim')
-rw-r--r--fun.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/fun.vim b/fun.vim
new file mode 100644
index 0000000..ce77e92
--- /dev/null
+++ b/fun.vim
@@ -0,0 +1,23 @@
+" Echoes longest line number and lenght.
+
+function! LongestLineLength ( )
+ let maxlength = 0
+ let linenumber = 1
+ while linenumber <= line("$")
+ exe ":".linenumber
+ let linelength = virtcol("$")
+ if maxlength < linelength
+ let maxlength = linelength
+ let maxlinenumber = linenumber
+ endif
+ let linenumber = linenumber+1
+ endwhile
+
+" exe ':0'
+" exe 'normal O'
+" exe 'normal 0C'.maxlength
+ exe "normal" . maxlinenumber . "G"
+ exe ":echo \"" . maxlinenumber . ": " . maxlength . "\""
+endfunction
+
+command LongestLineLength call LongestLineLength()