vim.tiny  [Solved]

Message
Author
User avatar
baldyeti
Posts: 717
Joined: Sat Dec 05, 2009 3:37 pm

Re: vim.tiny

#11 Post by baldyeti »

Adrian wrote: Mon Jul 13, 2020 10:04 amI started to use vim exclusively because once you learn it it makes editing much more efficient
I am curious Adrian, aren't you using something like qtcreator when developing the qt-based MX tools ? I'd have thought auto-completion can come real handy when working with rich class libraries.

User avatar
Adrian
Developer
Posts: 8987
Joined: Wed Jul 12, 2006 1:42 am

Re: vim.tiny

#12 Post by Adrian »

baldyeti wrote: Tue Jul 14, 2020 4:50 am
Adrian wrote: Mon Jul 13, 2020 10:04 amI started to use vim exclusively because once you learn it it makes editing much more efficient
I am curious Adrian, aren't you using something like qtcreator when developing the qt-based MX tools ? I'd have thought auto-completion can come real handy when working with rich class libraries.
qtcreator is amazing, but I use vim for editing config files and the like. BTW, qtcreator has a fakevim mode where you could use vim kind of controls to edit, I was not brave enough to enable that.

User avatar
baldyeti
Posts: 717
Joined: Sat Dec 05, 2009 3:37 pm

Re: vim.tiny

#13 Post by baldyeti »

Adrian wrote: Tue Jul 14, 2020 9:56 am qtcreator has a fakevim mode where you could use vim kind of controls to edit, I was not brave enough to enable that.
Ah, good to know. So do KDE's kate and eclipse (vrapper plugin, very nice, also works with pydev or dbeaver).

grgc
Posts: 8
Joined: Mon Dec 13, 2021 12:20 am

Re: vim.tiny

#14 Post by grgc »

Hey Brothers

I also am a fan of vim. I am just learning. In the words of the Shaman, I can use visual. Amazingly, once you start to get the hang of vim, gui based editors are just annoying. I found learning vim a lot like learning to cook a meal. At first, you think that you will never be able to keep track of everything that is going on, but very quickly, you can't even remember why you were confused.

My more immediate concern is that I need to configure vim on MX. I have not yet written a .vimrc, and I would appreciate any tips that are offered.

BTW, I upgraded vim "$ sudo apt-get upgrade vim", it gave me vim HUGE.

Thank you.

User avatar
Adrian
Developer
Posts: 8987
Joined: Wed Jul 12, 2006 1:42 am

Re: vim.tiny

#15 Post by Adrian »

My more immediate concern is that I need to configure vim on MX. I have not yet written a .vimrc, and I would appreciate any tips that are offered.
That's usually personal preference, for example if you want line numbers you can add:

Code: Select all

set number
:set nonumber to turn it off.

If you want syntax highlighting:

Code: Select all

set syntax
One cute thing I added is using \cc to comment out stuff and \xx to uncomment line or selection, it looks like this:

Code: Select all

" insert and remove comments
augroup commentshortcut
  let b:comment_leader = '# '
  autocmd FileType c,cpp,java,scala      let b:comment_leader = '// '
  autocmd FileType sh,ruby,python,perl   let b:comment_leader = '# '
  autocmd FileType conf,fstab            let b:comment_leader = '# '
  autocmd FileType tex                   let b:comment_leader = '% '
  autocmd FileType mail                  let b:comment_leader = '> '
  autocmd FileType vim                   let b:comment_leader = '" '
  noremap <silent> <Leader>cc :<C-B>silent <C-E>s/^\(\s*\)/\1<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
  noremap <silent> <Leader>xx :<C-B>silent <C-E>s/^\(\s*\)\V<C-R>=escape(b:comment_leader,'\/')<CR>/\1/e<CR>:nohlsearch<CR>
augroup END
I stole that from some other people... you can just search for vimrc to see what other people are using...

grgc
Posts: 8
Joined: Mon Dec 13, 2021 12:20 am

Re: vim.tiny

#16 Post by grgc »

Thanks Adrian

User avatar
figueroa
Posts: 1103
Joined: Thu Dec 20, 2018 11:20 pm

Re: vim.tiny

#17 Post by figueroa »

Totally stolen from others, and added to over many years, here is my .vimrc. Use freely, but at own risk. It's only 104 lines, including comments and blank lines to make it more readable.

Code: Select all

" An example for a vimrc file.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2002 Sep 19
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"	      for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM\_vimrc
"	    for OpenVMS:  sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

if has("vms")
  set nobackup		" do not keep a backup file, use versions instead
else
  set backup		" keep a backup file
endif
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don't use Ex mode, use Q for formatting
map Q gq

" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

highlight Comment ctermfg=DarkGray
hi LineNR ctermfg=DarkGray
" hi CursorLineNR ctermfg=Red
" hi String ctermfg=Gray
" hi PreProc ctermfg=Brown

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent off

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal g`\"" |
    \ endif

  augroup END

else

  set noautoindent		" always set autoindenting on

endif " has("autocmd")

"set wrap
"set linebreak
"set nolist
"set wrapmargin=80
"set number

set spellfile=~/.vim/spellfile.add

set spelllang=en_us

map <F2> :set nospell
map <F3> :set spell

set t_BE= 			 " correct bracketed mode paste

set cm=blowfish2
Andy Figueroa
Using Unix from 1984; GNU/Linux from 1993

grgc
Posts: 8
Joined: Mon Dec 13, 2021 12:20 am

Re: vim.tiny

#18 Post by grgc »

Thank you figueroa. Very helpful.

grgc
Posts: 8
Joined: Mon Dec 13, 2021 12:20 am

Re: vim.tiny

#19 Post by grgc »

Thank you figueroa. Very helpful.

Post Reply

Return to “Software / Configuration”