Skip to content

Instantly share code, notes, and snippets.

@lirenlin
Last active February 26, 2024 23:18
Show Gist options
  • Save lirenlin/63453cda5181028b2565 to your computer and use it in GitHub Desktop.
Save lirenlin/63453cda5181028b2565 to your computer and use it in GitHub Desktop.
build vim with clipboard support

##Install dependency

sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev   libgtk2.0-dev libatk1.0-dev libbonoboui2-dev   libcairo2-dev libx11-dev libxpm-dev libxt-dev

##Configure ./configure --with-features=huge --enable-gui=gnome2 ----enable-pythoninterp=yes

OR

./configure \
    --enable-cscope \
    --with-features=huge \
    --with-x \
    --with-compiledby="Senor QA <senor@qa>"

##Make and check

make -j8
src/vim --version

you will see +clipboard feature enabled

##Install make install

##To make it default You can uninstall the vim in your system first and install your. Alternatively, following the following instructions to make your newly build one default

To make newly installed version “/usr/local/bin/vim” the default one, we’ll use “update-alternatives”.

sudo update-alternatives --install "/usr/bin/vim" "vim" "/usr/local/bin/vim" 1
sudo update-alternatives --install "/usr/bin/vi" "vi" "/usr/local/bin/vim" 1

sudo update-alternatives --config vim
sudo update-alternatives --config vi
sudo update-alternatives --config gvim

ls -lah /usr/bin/vim to check it's a link to your new vim

@lirenlin
Copy link
Author

build vimgdb

vim-7.4.tar.bz2 http://www.vim.org/sources.php
vimgdb-for-vim7.4 (this patch) https://github.com/larrupingpig/vimgdb-for-vim7.4

tar xvf vim-7.4.tar.bz2
patch -p0 < vimgdb-for-vim7.4/vim74.patch
sudo apt-get build-dep vim

cd vim74
./configure --with-features=huge --enable-gui=gnome2 --enable-rubyinterp --enable-pythoninterp --enable-gdb

make -j4
sudo make install

if you got segment fault
make CFLAGS="-O2 -D_FORTIFY_SOURCE=1" -j4
sudo make install

@lirenlin
Copy link
Author

:syntax enable " enable syntax highlighting
:set previewheight=12 " set gdb window initial height
:run macros/gdb_mappings.vim " source key mappings listed in this, F7 to toggle the mappings
:set asm=0 " don't show any assembly stuff
:set gdbprg=gdb " set GDB invocation string (default 'gdb'), optional

. Mappings gdb-mappings
The gdb() function accepts a string as single argument which is sent to GDB as
a GDB command. This can be used to map any command to a key sequence. Examples
of such mappings are given in 'macros/gdb_mappings.vim'. To use those
mappings, source the script: >
:run macros/gdb_mappings.vim
The key is used to toggle between the 'gdb_mappings.vim' mappings and the
default Vim mappings.
List of key mappings in 'gdb_mappings.vim':
launch the interactive gdb input-line window
CTRL-Z send an interrupt to GDB and the program it is running
B info breakpoints
L info locals
A info args
S step
I stepi
CTRL-N next: next source line, skipping all function calls
X nexti
F finish
R run
Q quit
C continue
W where
CTRL-U up: go up one frame
CTRL-D down: go down one frame
CTRL-B set a breakpoint on the line where the cursor is located
CTRL-E clear all breakpoints on the line where the cursor is located
CTRL-P Normal mode: print value of word under cursor
Visual mode: GDB command "createvar" selected expression, see
|gdb-variables|
CTRL-X print value of data referenced by word under cursor
CTRL-B and CTRL-E operate both on source code and on disassembled code in
assembly buffers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment